Motr  M0
sw_onwire_fop.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #include "lib/memory.h"
24 #include "lib/string.h"
25 
26 #include "fop/fop.h"
27 #include "rpc/rpc.h"
28 #include "rpc/rpc_opcodes.h"
29 
30 #include "cm/cm.h"
32 #include "cm/repreb/sw_onwire_fop_xc.h"
33 
34 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CM
35 #include "lib/trace.h"
36 
43 extern const struct m0_sm_conf m0_cm_repreb_sw_onwire_conf;
44 
45 M0_INTERNAL
47  const struct m0_fom_type_ops *fomt_ops,
48  enum M0_RPC_OPCODES op,
49  const char *name,
50  const struct m0_xcode_type *xt,
51  uint64_t rpc_flags,
52  struct m0_cm_type *cmt)
53 {
55  .name = name,
56  .opcode = op,
57  .xt = xt,
58  .rpc_flags = rpc_flags,
59  .fom_ops = fomt_ops,
61  .svc_type = &cmt->ct_stype);
62 }
63 
65 {
67 }
68 
69 M0_INTERNAL int
71  struct m0_fop *fop,
72  void (*fop_release)(struct m0_ref *),
73  uint64_t proxy_id, const char *local_ep,
74  const struct m0_cm_sw *sw,
75  const struct m0_cm_sw *out_interval)
76 {
77  struct m0_cm_sw_onwire *swo_fop;
78  int rc = 0;
79  M0_ENTRY("cm=%p proxy_id=%" PRIu64 " local_ep=%s", cm, proxy_id, local_ep);
80 
81  M0_PRE(cm != NULL && sw != NULL && local_ep != NULL);
82 
85  if (rc != 0) {
87  return M0_RC(rc);
88  }
89  swo_fop = m0_fop_data(fop);
90  rc = m0_cm_sw_onwire_init(cm, swo_fop, proxy_id, local_ep, sw,
91  out_interval);
92 
93  return M0_RC(rc);
94 }
95 
96 #undef M0_TRACE_SUBSYSTEM
97 
99 /*
100  * Local variables:
101  * c-indentation-style: "K&R"
102  * c-basic-offset: 8
103  * tab-width: 8
104  * fill-column: 80
105  * scroll-step: 1
106  * End:
107  */
#define M0_PRE(cond)
M0_INTERNAL void m0_cm_repreb_sw_onwire_fop_init(struct m0_fop_type *ft, const struct m0_fom_type_ops *fomt_ops, enum M0_RPC_OPCODES op, const char *name, const struct m0_xcode_type *xt, uint64_t rpc_flags, struct m0_cm_type *cmt)
Definition: sw_onwire_fop.c:46
Definition: sw.h:45
#define NULL
Definition: misc.h:38
M0_RPC_OPCODES
Definition: rpc_opcodes.h:41
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
Definition: sm.h:350
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
Definition: fop.c:79
void fop_release(struct m0_ref *ref)
Definition: stats_ut_svc.c:148
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
struct m0_fom_type_ops fomt_ops
Definition: pd_ut.c:179
return M0_RC(rc)
static struct m0_cm * cm
Definition: cm.c:63
op
Definition: libdemo.c:64
#define M0_ENTRY(...)
Definition: trace.h:170
int opcode
Definition: crate.c:301
#define PRIu64
Definition: types.h:58
const char * name
Definition: trace.c:110
Definition: refs.h:34
M0_INTERNAL int m0_cm_sw_onwire_init(struct m0_cm *cm, struct m0_cm_sw_onwire *sw_onwire, uint64_t proxy_id, const char *ep, const struct m0_cm_sw *sw, const struct m0_cm_sw *out_interval)
Definition: sw.c:76
M0_INTERNAL void m0_cm_repreb_sw_onwire_fop_fini(struct m0_fop_type *ft)
Definition: sw_onwire_fop.c:64
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
Definition: fop.c:71
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
Definition: fop.c:136
M0_INTERNAL int m0_cm_repreb_sw_onwire_fop_setup(struct m0_cm *cm, struct m0_fop_type *ft, struct m0_fop *fop, void(*fop_release)(struct m0_ref *), uint64_t proxy_id, const char *local_ep, const struct m0_cm_sw *sw, const struct m0_cm_sw *out_interval)
Definition: sw_onwire_fop.c:70
Definition: cm.h:143
static const char * local_ep(const struct m0_cm *cm)
Definition: cm_utils.c:397
Definition: cm.h:166
static struct m0_fop * fop
Definition: item.c:57
struct m0_reqh_service_type ct_stype
Definition: cm.h:145
static struct m0_fop_type * ft[]
Definition: service_ut.c:856
const struct m0_sm_conf m0_cm_repreb_sw_onwire_conf
Definition: sw_onwire_fom.c:60
int32_t rc
Definition: trigger_fop.h:47
Definition: fop.h:79