Motr  M0
fop.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CONF
23 #include "lib/trace.h"
24 
25 #include "conf/fop.h"
26 #include "conf/onwire_xc.h"
27 #include "conf/confd_fom.h" /* m0_confd_fom_create */
28 #include "conf/confd.h" /* m0_confd_stype */
29 #include "rpc/rpc_opcodes.h"
30 #include "fop/fom_generic.h" /* m0_generic_conf */
31 #include "conf/flip_fop.h"
32 #include "conf/flip_fop_xc.h" /* m0_xc_flip_fop_init, m0_xc_flip_fop_fini */
33 #include "conf/load_fop.h"
34 #include "conf/load_fop_xc.h" /* m0_xc_load_fop_init, m0_xc_load_fop_fini */
35 
44 
47 
48 #ifndef __KERNEL__
49 static const struct m0_fom_type_ops confd_fom_ops = {
51 };
52 #endif
53 
54 
55 extern struct m0_sm_conf conf_load_conf;
56 extern struct m0_sm_state_descr conf_load_phases[];
57 
60 
61 extern const struct m0_fom_type_ops conf_load_fom_type_ops;
62 
63 
64 extern struct m0_sm_conf conf_flip_conf;
65 extern struct m0_sm_state_descr conf_flip_phases[];
66 
69 
70 extern const struct m0_fom_type_ops conf_flip_fom_type_ops;
71 
72 
73 M0_INTERNAL int m0_conf_fops_init(void)
74 {
76  .name = "Configuration fetch request",
78  .xt = m0_conf_fetch_xc,
79 #ifndef __KERNEL__
80  .fom_ops = &confd_fom_ops,
81  .svc_type = &m0_confd_stype,
82  .sm = &m0_generic_conf,
83 #endif
84  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST);
86  .name = "Configuration fetch response",
88  .xt = m0_conf_fetch_resp_xc,
89  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
90  /*
91  * XXX Argh! Why bother defining update _stubs_? Do we win anything? Is
92  * it worth the cost of maintenance?
93  */
95  .name = "Configuration update request",
97  .xt = m0_conf_update_xc,
98 #ifndef __KERNEL__
99  .fom_ops = &confd_fom_ops,
100  .svc_type = &m0_confd_stype,
101  .sm = &m0_generic_conf,
102 #endif
103  .rpc_flags = M0_RPC_MUTABO_REQ);
105  .name = "Configuration update response",
107  .xt = m0_conf_update_resp_xc,
108  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
109 
110 
111  /*
112  * Provided by m0gccxml2xcode after parsing load_fop.h
113  */
114  m0_xc_conf_load_fop_init();
115 
116 #ifndef __KERNEL__
119 #endif
120 
122  .name = "Conf Load configure request",
124  .xt = m0_fop_conf_load_xc,
125 #ifndef __KERNEL__
126  .fom_ops = &conf_load_fom_type_ops,
127  .svc_type = &m0_confd_stype,
128  .sm = &conf_load_conf,
129 #endif
130  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST);
131 
133  .name = "Conf Load configure reply",
135  .xt = m0_fop_conf_load_rep_xc,
136  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
137 
138  /*
139  * Provided by m0gccxml2xcode after parsing flip_fop.h
140  */
141  m0_xc_conf_flip_fop_init();
142 
143 #ifndef __KERNEL__
146 #endif
147 
149  .name = "Conf Flip configure request",
151  .xt = m0_fop_conf_flip_xc,
152 #ifndef __KERNEL__
153  .fom_ops = &conf_flip_fom_type_ops,
154  .svc_type = &m0_confd_stype,
155  .sm = &conf_flip_conf,
156 #endif
157  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST);
158 
160  .name = "Conf Flip configure reply",
162  .xt = m0_fop_conf_flip_rep_xc,
163  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
164 
165  return 0;
166 }
167 
168 M0_INTERNAL void m0_conf_fops_fini(void)
169 {
172 
175 
178 
181 
182  m0_xc_conf_load_fop_fini();
183 }
184 
185 M0_INTERNAL int m0_confx_types_init(void)
186 {
187  M0_ENTRY();
188  return M0_RC(0);
189 }
190 
191 M0_INTERNAL void m0_confx_types_fini(void)
192 {
193  M0_ENTRY();
194  M0_LEAVE();
195 }
196 
198 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL int m0_confx_types_init(void)
Definition: fop.c:185
static const struct m0_fom_type_ops confd_fom_ops
Definition: fop.c:49
const struct m0_fom_type_ops conf_flip_fom_type_ops
Definition: flip_fom.c:72
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
Definition: sm.h:350
struct m0_fop_type m0_fop_conf_flip_rep_fopt
Definition: fop.c:68
M0_LEAVE()
struct m0_sm_conf conf_load_conf
Definition: load_fom.c:96
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
M0_INTERNAL void m0_sm_conf_extend(const struct m0_sm_state_descr *base, struct m0_sm_state_descr *sub, uint32_t nr)
Definition: sm.c:763
struct m0_sm_state_descr conf_load_phases[]
Definition: load_fom.c:66
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
struct m0_sm_conf conf_flip_conf
Definition: flip_fom.c:94
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
struct m0_fop_type m0_conf_update_resp_fopt
Definition: fop.c:46
struct m0_reqh_service_type m0_confd_stype
Definition: confd.c:453
return M0_RC(rc)
struct m0_fop_type m0_fop_conf_load_fopt
Definition: fop.c:58
#define M0_ENTRY(...)
Definition: trace.h:170
int opcode
Definition: crate.c:301
struct m0_fop_type m0_fop_conf_load_rep_fopt
Definition: fop.c:59
struct m0_fop_type m0_conf_update_fopt
Definition: fop.c:45
struct m0_sm_state_descr conf_flip_phases[]
Definition: flip_fom.c:79
const char * name
Definition: trace.c:110
M0_INTERNAL void m0_conf_fops_fini(void)
Definition: fop.c:168
M0_INTERNAL int m0_confd_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: confd_fom.c:73
uint32_t scf_nr_states
Definition: sm.h:354
M0_INTERNAL int m0_conf_fops_init(void)
Definition: fop.c:73
struct m0_sm_state_descr * scf_state
Definition: sm.h:356
const struct m0_fom_type_ops conf_load_fom_type_ops
Definition: load_fom.c:59
struct m0_fop_type m0_fop_conf_flip_fopt
Definition: fop.c:67
struct m0_fop_type m0_conf_fetch_resp_fopt
Definition: fop.c:43
M0_INTERNAL void m0_confx_types_fini(void)
Definition: fop.c:191
struct m0_fop_type m0_conf_fetch_fopt
Definition: fop.c:42