Motr  M0
fops.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-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/string.h"
24 #include "lib/memory.h"
25 #include "lib/errno.h"
26 #include "fop/fop.h"
27 #include "fop/fom_generic.h"
28 #include "fop/fop_item_type.h"
29 #include "rpc/rpc_opcodes.h"
30 #include "fdmi/fdmi.h"
31 #include "fdmi/fops.h"
32 #include "fdmi/fops_xc.h"
33 #include "fdmi/service.h"
34 
35 M0_INTERNAL int m0_fdmi_req_fom_create(struct m0_fop *fop, struct m0_fom **m,
36  struct m0_reqh *reqh);
37 
39  .fto_undo = NULL,
40  .fto_redo = NULL,
41 };
42 
43 #ifndef __KERNEL__
45 #endif
46 
51 
52 extern const struct m0_fom_ops fdmi_rr_fom_ops;
53 extern const struct m0_fom_type_ops fdmi_rr_fom_type_ops;
54 #ifndef __KERNEL__
55 extern const struct m0_sm_conf fdmi_rr_fom_sm_conf;
56 extern const struct m0_sm_conf fdmi_plugin_dock_fom_sm_conf;
57 #endif
58 
59 M0_INTERNAL int m0_fdms_fopts_init(void)
60 {
62  .name = "FDMI record notification",
64  .xt = m0_fop_fdmi_record_xc,
65  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST,
66 #ifndef __KERNEL__
68  .svc_type = &m0_fdmi_service_type,
70 #endif
71  .fop_ops = &m0_fdmi_fop_ops);
72 
74  .name = "FDMI record release",
76  .xt = m0_fop_fdmi_rec_release_xc,
77  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST,
78  .fop_ops = &m0_fdmi_fop_ops,
79 #ifndef __KERNEL__
80  .fom_ops = &fdmi_rr_fom_type_ops,
81  .svc_type = &m0_fdmi_service_type,
82  .sm = &fdmi_rr_fom_sm_conf
83 #endif
84  );
85 
86 
87  return 0;
88 }
89 
90 M0_INTERNAL int m0_fdms_rep_fopts_init(void)
91 {
93  .name = "FDMI record notification reply",
95  .xt = m0_fop_fdmi_record_reply_xc,
96  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
97 
99  .name = "FDMI record release reply",
101  .xt = m0_fop_fdmi_rec_release_reply_xc,
102  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY,
103  .sm = &m0_generic_conf);
104 
105  return 0;
106 }
107 
108 M0_INTERNAL int m0_fdms_fop_init(void)
109 {
110  /*
111  * Provided by m0gccxml2xcode after parsing fdmi_fops.h
112  */
113  m0_xc_fdmi_fops_init();
114 
115  return m0_fdms_fopts_init() ?:
117 }
118 M0_EXPORTED(m0_fdms_fop_init);
119 
120 M0_INTERNAL void m0_fdms_fop_fini(void)
121 {
124 
127 
128  m0_xc_fdmi_fops_fini();
129 }
130 M0_EXPORTED(m0_fdms_fop_fini);
131 
132 /*
133  * Local variables:
134  * c-indentation-style: "K&R"
135  * c-basic-offset: 8
136  * tab-width: 8
137  * fill-column: 80
138  * scroll-step: 1
139  * End:
140  */
141 /*
142  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
143  */
struct m0_fop_type m0_fop_fdmi_rec_release_rep_fopt
Definition: fops.c:50
M0_EXTERN struct m0_reqh_service_type m0_fdmi_service_type
Definition: fdmi.h:194
const struct m0_sm_conf fdmi_rr_fom_sm_conf
#define NULL
Definition: misc.h:38
static struct m0_addb2_mach * m
Definition: consumer.c:38
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
Definition: sm.h:350
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
int opcode
Definition: crate.c:301
const char * name
Definition: trace.c:110
M0_INTERNAL int m0_fdms_fop_init(void)
Definition: fops.c:108
const struct m0_sm_conf fdmi_plugin_dock_fom_sm_conf
M0_INTERNAL int m0_fdms_rep_fopts_init(void)
Definition: fops.c:90
struct m0_fom_type_ops m0_fdmi_fom_type_ops
M0_INTERNAL void m0_fdms_fop_fini(void)
Definition: fops.c:120
struct m0_fop_type m0_fop_fdmi_rec_release_fopt
Definition: fops.c:49
const struct m0_fom_type_ops fdmi_rr_fom_type_ops
Definition: reqh.h:94
struct m0_fop_type m0_fop_fdmi_rec_not_rep_fopt
Definition: fops.c:48
Definition: fom.h:481
struct m0_fop_type m0_fop_fdmi_rec_not_fopt
Definition: fops.c:47
struct m0_reqh reqh
Definition: rm_foms.c:48
const struct m0_fop_type_ops m0_fdmi_fop_ops
Definition: fops.c:38
static struct m0_fop * fop
Definition: item.c:57
const struct m0_fom_type_ops * m0_fdmi__pdock_fom_type_ops_get(void)
const struct m0_fom_ops fdmi_rr_fom_ops
M0_INTERNAL int m0_fdmi_req_fom_create(struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh)
M0_INTERNAL int m0_fdms_fopts_init(void)
Definition: fops.c:59
int(* fto_undo)(struct m0_fop_fol_frag *ffrag, struct m0_fol *fol)
Definition: fop.h:273
Definition: fop.h:79