Motr  M0
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 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_FOP
24 #include "lib/trace.h"
25 
26 #include "lib/memory.h"
27 #include "lib/misc.h" /* M0_SET0 */
28 #include "lib/errno.h"
29 #include "motr/magic.h"
30 #include "rpc/rpc_machine.h" /* m0_rpc_machine, m0_rpc_machine_lock */
31 #include "rpc/addb2.h"
32 #include "fop/fop.h"
33 #include "fop/fop_xc.h"
34 #include "fop/fom.h"
35 #include "fop/fom_generic.h"
36 #include "fop/fom_generic_xc.h"
37 #include "fop/fom_long_lock.h" /* m0_fom_ll_global_init */
38 #include "addb2/identifier.h"
39 #include "reqh/reqh.h"
40 
46 static struct m0_mutex fop_types_lock;
47 static struct m0_tl fop_types_list;
48 
49 M0_TL_DESCR_DEFINE(ft, "fop types", static, struct m0_fop_type,
50  ft_linkage, ft_magix,
52 
53 M0_TL_DEFINE(ft, static, struct m0_fop_type);
54 
55 M0_INTERNAL const char *m0_fop_name(const struct m0_fop *fop)
56 {
57  return fop->f_type != NULL ? fop->f_type->ft_name : "untyped";
58 }
59 
60 static size_t fop_data_size(const struct m0_fop *fop)
61 {
62  M0_PRE(fop->f_type->ft_xt != NULL);
63  return fop->f_type->ft_xt->xct_sizeof;
64 }
65 
66 M0_INTERNAL bool m0_fop_rpc_is_locked(struct m0_fop *fop)
67 {
69 }
70 
71 M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
72 {
73  M0_PRE(fop->f_data.fd_data == NULL && fop->f_type != NULL);
74 
76  return fop->f_data.fd_data == NULL ? -ENOMEM : 0;
77 }
78 
79 M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt,
80  void *data, void (*fop_release)(struct m0_ref *))
81 {
82  M0_ENTRY();
83  M0_PRE(fop != NULL && fopt != NULL && fop_release != NULL);
84 
86  fop->f_type = fopt;
87  M0_SET0(&fop->f_item);
90  M0_LOG(M0_DEBUG, "fop: %p %s", fop, m0_fop_name(fop));
91 
92  M0_POST(m0_ref_read(&fop->f_ref) == 1);
93  M0_LEAVE();
94 }
95 
96 struct m0_fop *m0_fop_alloc(struct m0_fop_type *fopt, void *data,
97  struct m0_rpc_machine *mach)
98 {
99  struct m0_fop *fop;
100 
101  M0_PRE(mach != NULL);
102 
103  M0_ALLOC_PTR(fop);
104  if (fop == NULL)
105  return NULL;
106 
108  if (data == NULL) {
109  int rc = m0_fop_data_alloc(fop);
110  if (rc != 0) {
111  m0_fop_fini(fop);
112  m0_free(fop);
113  return NULL;
114  }
115  }
117  M0_POST(m0_ref_read(&fop->f_ref) == 1);
118  return fop;
119 }
120 M0_EXPORTED(m0_fop_alloc);
121 
122 struct m0_fop *m0_fop_alloc_at(struct m0_rpc_session *sess,
123  struct m0_fop_type *fopt)
124 {
125  return m0_fop_alloc(fopt, NULL, m0_fop_session_machine(sess));
126 }
127 M0_EXPORTED(m0_fop_alloc_at);
128 
130  struct m0_fop_type *rept)
131 {
132  return m0_fop_alloc(rept, NULL, m0_fop_rpc_machine(req));
133 }
134 M0_EXPORTED(m0_fop_reply_alloc);
135 
136 M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
137 {
138  M0_PRE(fop != NULL);
139  M0_ENTRY("fop: %p %s", fop, m0_fop_name(fop));
140  M0_PRE(M0_IN(m0_ref_read(&fop->f_ref), (0, 1)));
141 
143  if (fop->f_data.fd_data != NULL)
145  M0_LEAVE();
146 }
147 
148 M0_INTERNAL void m0_fop_release(struct m0_ref *ref)
149 {
150  struct m0_fop *fop;
151 
152  M0_ENTRY();
153  M0_PRE(ref != NULL);
154 
155  fop = container_of(ref, struct m0_fop, f_ref);
156  m0_fop_fini(fop);
157  m0_free(fop);
158 
159  M0_LEAVE();
160 }
161 
162 struct m0_fop *m0_fop_get(struct m0_fop *fop)
163 {
164  uint64_t count = m0_ref_read(&fop->f_ref);
165 
166  M0_ENTRY("fop: %p %s [%llu -> %llu]", fop, m0_fop_name(fop),
167  (unsigned long long)count, (unsigned long long)count + 1);
168  M0_PRE(count > 0);
169 
170  m0_ref_get(&fop->f_ref);
171 
172  M0_LEAVE();
173  return fop;
174 }
175 M0_EXPORTED(m0_fop_get);
176 
177 void m0_fop_put(struct m0_fop *fop)
178 {
179  uint64_t count = m0_ref_read(&fop->f_ref);
180 
181  M0_ENTRY("fop: %p %s [%llu -> %llu]", fop, m0_fop_name(fop),
182  (unsigned long long)count, (unsigned long long)count - 1);
184  M0_PRE(count > 0);
185 
186  m0_ref_put(&fop->f_ref);
187 
188  M0_LEAVE();
189 }
190 M0_EXPORTED(m0_fop_put);
191 
192 void m0_fop_put0(struct m0_fop *fop)
193 {
194  if (fop != NULL)
195  m0_fop_put(fop);
196 }
197 M0_EXPORTED(m0_fop_put0);
198 
200 {
201  struct m0_rpc_machine *mach;
202 
203  M0_PRE(m0_ref_read(&fop->f_ref) > 0);
204 
206  M0_ASSERT(mach != NULL);
208  m0_fop_put(fop);
210 }
211 M0_EXPORTED(m0_fop_put_lock);
212 
214 {
215  if (fop != NULL)
217 }
218 M0_EXPORTED(m0_fop_put0_lock);
219 
220 void *m0_fop_data(const struct m0_fop *fop)
221 {
222  return fop->f_data.fd_data;
223 }
224 M0_EXPORTED(m0_fop_data);
225 
226 uint32_t m0_fop_opcode(const struct m0_fop *fop)
227 {
229 }
230 M0_EXPORTED(m0_fop_opcode);
231 
232 void m0_fop_type_fini(struct m0_fop_type *fopt)
233 {
234  M0_ENTRY("name=%s opcode=%"PRIu32" rpc_flags=%"PRIu64,
235  fopt->ft_name, fopt->ft_rpc_item_type.rit_opcode,
238  if (fopt->ft_magix == M0_FOP_TYPE_MAGIC) {
240  ft_tlink_del_fini(fopt);
241  fopt->ft_magix = 0;
242  }
244 }
245 M0_EXPORTED(m0_fop_type_fini);
246 
248  const struct __m0_fop_type_init_args *args)
249 {
250  struct m0_rpc_item_type *rpc_type;
251  const struct m0_xcode_type *xt = args->xt;
252 
253  M0_ENTRY("name=%s opcode=%"PRIu32" rpc_flags=%"PRIu64,
254  args->name, args->opcode, args->rpc_flags);
255  M0_PRE(ft->ft_magix == 0);
256  M0_PRE(ergo(args->rpc_flags & M0_RPC_ITEM_TYPE_REPLY,
257  xt->xct_nr > 0 && xt->xct_child[0].xf_type == &M0_XT_U32));
258  M0_PRE_EX(xt == NULL ||
261  M0_BITS(M0_XA_ATOM)));
262 
263  rpc_type = &ft->ft_rpc_item_type;
264 
265  ft->ft_name = args->name;
266  ft->ft_xt = xt;
267  ft->ft_ops = args->fop_ops;
268 
269  rpc_type->rit_opcode = args->opcode;
270  rpc_type->rit_flags = args->rpc_flags;
271  rpc_type->rit_ops = args->rpc_ops ?: &m0_fop_default_item_type_ops;
272 
273  m0_fom_type_init(&ft->ft_fom_type, args->opcode,
274  args->fom_ops, args->svc_type, args->sm);
275  m0_rpc_item_type_register(rpc_type);
277  ft_tlink_init_at(ft, &fop_types_list);
279 }
280 M0_EXPORTED(m0_fop_type_init);
281 
282 M0_INTERNAL void m0_fop_type_init_nr(const struct m0_fop_type_batch *batch)
283 {
284  for (; batch->tb_type != NULL; ++batch)
285  m0_fop_type_init(batch->tb_type, &batch->tb_args);
286 }
287 
288 M0_INTERNAL void m0_fop_type_fini_nr(const struct m0_fop_type_batch *batch)
289 {
290  for (; batch->tb_type != NULL; ++batch) {
291  if (batch->tb_type->ft_magix != 0)
292  m0_fop_type_fini(batch->tb_type);
293  }
294 }
295 
296 M0_INTERNAL struct m0_fop_type *m0_fop_type_next(struct m0_fop_type *ftype)
297 {
298  struct m0_fop_type *rtype;
299 
301  if (ftype == NULL) {
302  /* Returns head of fop_types_list */
303  rtype = ft_tlist_head(&fop_types_list);
304  } else {
305  /* Returns Next from fop_types_list */
306  rtype = ft_tlist_next(&fop_types_list, ftype);
307  }
309  return rtype;
310 }
311 
312 
314 M0_EXTERN struct m0_sm_conf fom_states_conf;
315 M0_INTERNAL int m0_fops_init(void)
316 {
318  ft_tlist_init(&fop_types_list);
321 
322  m0_fop_fol_frag_type.rpt_xt = m0_fop_fol_frag_xc;
325  "fop generic record frag");
327 }
328 
329 M0_INTERNAL void m0_fops_fini(void)
330 {
332  /* Do not finalise fop_types_list, it can be validly non-empty. */
334 
336 }
337 
338 struct m0_rpc_item *m0_fop_to_rpc_item(const struct m0_fop *fop)
339 {
340  M0_PRE(fop != NULL);
341 
342  return (struct m0_rpc_item *)&fop->f_item;
343 }
344 M0_EXPORTED(m0_fop_to_rpc_item);
345 
347 {
348  M0_PRE(item != NULL);
349  return container_of(item, struct m0_fop, f_item);
350 }
351 
353 {
354  M0_PRE(fop != NULL);
355  M0_PRE(mach != NULL);
356 
358 }
359 
361 {
362  M0_PRE(fop != NULL);
363 
364  return fop->f_item.ri_rmachine;
365 }
366 M0_EXPORTED(m0_fop_rpc_machine);
367 
368 M0_INTERNAL struct m0_fop_type *m0_item_type_to_fop_type
369  (const struct m0_rpc_item_type *item_type) {
370  M0_PRE(item_type != NULL);
371 
372  return container_of(item_type, struct m0_fop_type, ft_rpc_item_type);
373 }
374 
375 M0_INTERNAL int m0_fop_encdec(struct m0_fop *fop,
376  struct m0_bufvec_cursor *cur,
377  enum m0_xcode_what what)
378 {
379  int result;
380  struct m0_xcode_obj xo = M0_FOP_XCODE_OBJ(fop);
381 
382  result = m0_xcode_encdec(&xo, cur, what);
383  if (result == 0 && m0_fop_data(fop) == NULL)
384  fop->f_data.fd_data = xo.xo_ptr;
385  return result;
386 }
387 
388 M0_INTERNAL struct m0_fop_type *m0_fop_type_find(uint32_t opcode)
389 {
390  struct m0_fop_type *ftype = NULL;
391 
392  while ((ftype = m0_fop_type_next(ftype)) != NULL) {
393  if(ftype->ft_rpc_item_type.rit_opcode == opcode)
394  break;
395  }
396  return ftype;
397 }
398 
399 static int fop_xc_type(uint32_t opcode, const struct m0_xcode_type **out)
400 {
401  struct m0_fop_type *ftype;
402 
403  ftype = m0_fop_type_find(opcode);
404  if (ftype == NULL)
405  return M0_ERR(-EINVAL);
406 
407  *out = ftype->ft_xt;
408  return 0;
409 }
410 
411 M0_INTERNAL int m0_fop_xc_type(const struct m0_xcode_obj *par,
412  const struct m0_xcode_type **out)
413 {
414  struct m0_fop_fol_frag *rp = par->xo_ptr;
415 
416  return fop_xc_type(rp->ffrp_fop_code, out);
417 }
418 
419 M0_INTERNAL int m0_fop_rep_xc_type(const struct m0_xcode_obj *par,
420  const struct m0_xcode_type **out)
421 {
422  struct m0_fop_fol_frag *rp = par->xo_ptr;
423 
424  return fop_xc_type(rp->ffrp_rep_code, out);
425 }
426 
427 M0_INTERNAL int m0_fop_fol_add(struct m0_fop *fop, struct m0_fop *rep,
428  struct m0_dtx *dtx)
429 {
430  struct m0_fol_frag *frag;
431  struct m0_fop_fol_frag *rp;
432 
433  M0_ALLOC_PTR(frag);
434  if (frag == NULL)
435  return M0_ERR(-ENOMEM);
436 
437  M0_ALLOC_PTR(rp);
438  if (rp == NULL) {
439  m0_free(frag);
440  return M0_ERR(-ENOMEM);
441  }
442 
444  rp->ffrp_rep_code = rep->f_type->ft_rpc_item_type.rit_opcode;
445  rp->ffrp_fop = m0_fop_data(fop);
446  rp->ffrp_rep = m0_fop_data(rep);
447 
449  m0_fol_frag_add(&dtx->tx_fol_rec, frag);
450  return 0;
451 }
452 
454 {
455  M0_PRE(s != NULL && s->s_conn != NULL);
456 
457  return s->s_conn->c_rpc_machine;
458 }
459 M0_EXPORTED(m0_fop_session_machine);
460 
462 {
463  struct m0_fom_type *ft = &type->ft_fom_type;
464  struct m0_rpc_item_type *rt = &type->ft_rpc_item_type;
465  uint64_t mask = ((uint64_t)rt->rit_opcode) << 12;
466 
468  return (ft->ft_conf.scf_name != NULL ?
469  m0_sm_addb2_init(&ft->ft_conf, M0_AVI_PHASE,
470  mask | (M0_AFC_PHASE << 8)) : 0) ?:
471  m0_sm_addb2_init(&ft->ft_state_conf, M0_AVI_STATE,
472  mask | (M0_AFC_STATE << 8)) ?:
473  m0_sm_addb2_init(&rt->rit_outgoing_conf, M0_AVI_RPC_OUT_PHASE,
474  mask | (M0_AFC_RPC_OUT << 8)) ?:
475  m0_sm_addb2_init(&rt->rit_incoming_conf, M0_AVI_RPC_IN_PHASE,
476  mask | (M0_AFC_RPC_IN << 8));
477 }
478 
480 {
481  M0_PRE(fop != NULL);
482 
483  return &m0_fop_rpc_machine(fop)->rm_tm;
484 }
485 
487 {
488  M0_PRE(fop != NULL);
489 
490  return m0_fop_tm_get(fop)->ntm_dom;
491 }
492 
494 {
495  struct m0_fom_type *ft = &type->ft_fom_type;
496  struct m0_rpc_item_type *rt = &type->ft_rpc_item_type;
497 
498  m0_sm_addb2_fini(&ft->ft_conf);
499  m0_sm_addb2_fini(&ft->ft_state_conf);
500  m0_sm_addb2_fini(&rt->rit_outgoing_conf);
501  m0_sm_addb2_fini(&rt->rit_incoming_conf);
502 }
503 
505 #undef M0_TRACE_SUBSYSTEM
506 
507 /*
508  * Local variables:
509  * c-indentation-style: "K&R"
510  * c-basic-offset: 8
511  * tab-width: 8
512  * fill-column: 80
513  * scroll-step: 1
514  * End:
515  */
void * fd_data
Definition: fop.h:75
uint32_t ffrp_rep_code
Definition: fop.h:356
M0_INTERNAL int m0_xcode_encdec(struct m0_xcode_obj *obj, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: xcode.c:416
const struct m0_rpc_item_type_ops m0_fop_default_item_type_ops
uint32_t rit_opcode
Definition: item.h:474
uint32_t m0_fop_opcode(const struct m0_fop *fop)
Definition: fop.c:226
#define M0_PRE(cond)
M0_INTERNAL void m0_sm_conf_init(struct m0_sm_conf *conf)
Definition: sm.c:340
Definition: dtm.h:554
const struct m0_xcode_type * xf_type
Definition: xcode.h:253
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
#define M0_FOL_FRAG_TYPE_INIT(frag, name)
Definition: fol.h:349
M0_TL_DEFINE(ft, static, struct m0_fop_type)
M0_INTERNAL int m0_sm_addb2_init(struct m0_sm_conf *conf, uint64_t id, uint64_t counter)
Definition: sm.c:846
#define NULL
Definition: misc.h:38
static size_t fop_data_size(const struct m0_fop *fop)
Definition: fop.c:60
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
Definition: addb2.c:791
#define ergo(a, b)
Definition: misc.h:293
Definition: sm.h:350
const struct m0_rpc_item_type_ops * rit_ops
Definition: item.h:476
M0_INTERNAL int m0_fol_frag_type_register(struct m0_fol_frag_type *type)
Definition: fol.c:178
static struct io_request req
Definition: file.c:100
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
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
static struct m0_mutex fop_types_lock
Definition: fop.c:46
size_t xct_nr
Definition: xcode.h:343
void fop_release(struct m0_ref *ref)
Definition: stats_ut_svc.c:148
const struct m0_xcode_type * ft_xt
Definition: fop.h:230
void m0_fop_type_addb2_deinstrument(struct m0_fop_type *type)
Definition: fop.c:493
M0_EXTERN struct m0_sm_conf fom_states_conf
Definition: fop.c:314
M0_INTERNAL void m0_fol_frag_init(struct m0_fol_frag *frag, void *data, const struct m0_fol_frag_type *type)
Definition: fol.c:121
struct m0_bufvec data
Definition: di.c:40
struct m0_net_domain * ntm_dom
Definition: net.h:853
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
struct m0_xcode_field xct_child[0]
Definition: xcode.h:345
M0_INTERNAL void m0_xcode_free_obj(struct m0_xcode_obj *obj)
Definition: xcode.c:248
static struct m0_addb2_mach * mach
Definition: storage.c:42
#define M0_BITS(...)
Definition: misc.h:236
#define container_of(ptr, type, member)
Definition: misc.h:33
m0_xcode_what
Definition: xcode.h:647
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
M0_INTERNAL void m0_rpc_item_type_register(struct m0_rpc_item_type *item_type)
Definition: item.c:154
Definition: ub.c:49
void m0_rpc_item_init(struct m0_rpc_item *item, const struct m0_rpc_item_type *itype)
Definition: item.c:364
static struct m0_rpc_item * item
Definition: item.c:56
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
M0_INTERNAL struct m0_fop_type * m0_fop_type_next(struct m0_fop_type *ftype)
Definition: fop.c:296
struct m0_fol_frag_type m0_fop_fol_frag_type
M0_INTERNAL void m0_fops_fini(void)
Definition: fop.c:329
static m0_bcount_t count
Definition: xcode.c:167
struct m0_fom_type ft_fom_type
Definition: fop.h:232
const struct m0_fol_frag_type_ops * rpt_ops
Definition: fol.h:270
#define M0_ENTRY(...)
Definition: trace.h:170
void m0_rpc_item_fini(struct m0_rpc_item *item)
Definition: item.c:394
int opcode
Definition: crate.c:301
M0_INTERNAL bool m0_rpc_machine_is_locked(const struct m0_rpc_machine *machine)
Definition: rpc_machine.c:565
void m0_fop_put0_lock(struct m0_fop *fop)
Definition: fop.c:213
void m0_fop_rpc_machine_set(struct m0_fop *fop, struct m0_rpc_machine *mach)
Definition: fop.c:352
struct m0_fop_type * f_type
Definition: fop.h:81
#define PRIu64
Definition: types.h:58
M0_INTERNAL void m0_ref_put(struct m0_ref *ref)
Definition: refs.c:38
struct m0_rpc_machine * m0_fop_rpc_machine(const struct m0_fop *fop)
Definition: fop.c:360
void m0_ref_init(struct m0_ref *ref, int init_num, void(*release)(struct m0_ref *ref))
Definition: refs.c:24
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL const char * m0_fop_name(const struct m0_fop *fop)
Definition: fop.c:55
M0_INTERNAL void m0_ref_get(struct m0_ref *ref)
Definition: refs.c:32
static int fop_xc_type(uint32_t opcode, const struct m0_xcode_type **out)
Definition: fop.c:399
M0_INTERNAL void m0_rpc_machine_unlock(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:558
M0_INTERNAL bool m0_fop_rpc_is_locked(struct m0_fop *fop)
Definition: fop.c:66
M0_INTERNAL int m0_fop_fol_add(struct m0_fop *fop, struct m0_fop *rep, struct m0_dtx *dtx)
Definition: fop.c:427
const struct m0_xcode_type * rpt_xt
Definition: fol.h:269
struct __m0_fop_type_init_args tb_args
Definition: fop.h:325
Definition: refs.h:34
const char * ft_name
Definition: fop.h:225
M0_INTERNAL int m0_fop_rep_xc_type(const struct m0_xcode_obj *par, const struct m0_xcode_type **out)
Definition: fop.c:419
struct m0_net_transfer_mc rm_tm
Definition: rpc_machine.h:88
#define M0_ASSERT(cond)
struct m0_rpc_machine * m0_fop_session_machine(const struct m0_rpc_session *s)
Definition: fop.c:453
Definition: tlist.h:251
M0_INTERNAL void m0_fom_type_init(struct m0_fom_type *type, uint64_t id, const struct m0_fom_type_ops *ops, const struct m0_reqh_service_type *svc_type, const struct m0_sm_conf *sm)
Definition: fom.c:1596
static struct rectype rt[]
Definition: beck.c:428
struct m0_fop * m0_fop_get(struct m0_fop *fop)
Definition: fop.c:162
void * m0_alloc(size_t size)
Definition: memory.c:126
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
#define M0_POST(cond)
M0_INTERNAL void m0_sm_addb2_fini(struct m0_sm_conf *conf)
Definition: sm.c:870
m0_xcode_type_flags
Definition: xcode.h:300
M0_INTERNAL struct m0_fop_type * m0_item_type_to_fop_type(const struct m0_rpc_item_type *item_type)
Definition: fop.c:369
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
Definition: fop.c:71
M0_INTERNAL void m0_rpc_item_type_deregister(struct m0_rpc_item_type *item_type)
Definition: item.c:176
struct m0_fol_rec tx_fol_rec
Definition: dtm.h:561
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
Definition: fop.c:136
M0_INTERNAL int m0_fops_init(void)
Definition: fop.c:315
M0_INTERNAL int m0_fop_xc_type(const struct m0_xcode_obj *par, const struct m0_xcode_type **out)
Definition: fop.c:411
M0_INTERNAL struct m0_fop_type * m0_fop_type_find(uint32_t opcode)
Definition: fop.c:388
uint64_t rit_flags
Definition: item.h:478
struct m0_fop * m0_fop_reply_alloc(struct m0_fop *req, struct m0_fop_type *rept)
Definition: fop.c:129
struct m0_fop_data f_data
Definition: fop.h:82
#define PRIu32
Definition: types.h:66
const struct m0_xcode_type M0_XT_U32
Definition: xcode.c:932
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
Definition: refs.c:44
void m0_fop_type_init(struct m0_fop_type *ft, const struct __m0_fop_type_init_args *args)
Definition: fop.c:247
M0_TL_DESCR_DEFINE(ft, "fop types", static, struct m0_fop_type, ft_linkage, ft_magix, M0_FOP_TYPE_MAGIC, M0_FOP_TYPE_HEAD_MAGIC)
struct m0_ref f_ref
Definition: fop.h:80
M0_FOL_FRAG_TYPE_DECLARE(m0_fop_fol_frag,, NULL, NULL, NULL, NULL)
M0_INTERNAL void m0_rpc_machine_lock(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:551
M0_INTERNAL void m0_fop_release(struct m0_ref *ref)
Definition: fop.c:148
void m0_fop_put0(struct m0_fop *fop)
Definition: fop.c:192
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_net_domain * m0_fop_domain_get(const struct m0_fop *fop)
Definition: fop.c:486
M0_INTERNAL void m0_fol_frag_add(struct m0_fol_rec *rec, struct m0_fol_frag *frag)
Definition: fol.c:468
int m0_fop_type_addb2_instrument(struct m0_fop_type *type)
Definition: fop.c:461
const struct m0_fop_type_ops * ft_ops
Definition: fop.h:228
struct m0_rpc_item * m0_fop_to_rpc_item(const struct m0_fop *fop)
Definition: fop.c:338
struct m0_fop * m0_fop_alloc_at(struct m0_rpc_session *sess, struct m0_fop_type *fopt)
Definition: fop.c:122
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
M0_INTERNAL void m0_fop_type_init_nr(const struct m0_fop_type_batch *batch)
Definition: fop.c:282
void m0_fop_put_lock(struct m0_fop *fop)
Definition: fop.c:199
static struct m0_fop * fop
Definition: item.c:57
M0_INTERNAL int m0_fop_encdec(struct m0_fop *fop, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: fop.c:375
struct m0_rpc_item_type ft_rpc_item_type
Definition: fop.h:235
size_t xct_sizeof
Definition: xcode.h:341
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
Definition: fop.c:346
M0_INTERNAL void m0_fol_frag_type_deregister(struct m0_fol_frag_type *type)
Definition: fol.c:201
void * xo_ptr
Definition: xcode.h:353
static struct m0_fop_type * ft[]
Definition: service_ut.c:856
#define out(...)
Definition: gen.c:41
int type
Definition: dir.c:1031
M0_INTERNAL void m0_sm_conf_fini(struct m0_sm_conf *conf)
Definition: sm.c:376
struct m0_rpc_machine * ri_rmachine
Definition: item.h:160
#define M0_PRE_EX(cond)
struct m0_fop_type * tb_type
Definition: fop.h:324
#define M0_FOP_XCODE_OBJ(f)
Definition: fop.h:334
M0_INTERNAL void m0_fom_ll_global_init(void)
Definition: fom_long_lock.c:60
void m0_free(void *data)
Definition: memory.c:146
Definition: mutex.h:47
static struct m0_addb2_source * s
Definition: consumer.c:39
void m0_fop_put(struct m0_fop *fop)
Definition: fop.c:177
uint64_t ft_magix
Definition: fop.h:236
struct m0_rpc_item f_item
Definition: fop.h:83
int32_t rc
Definition: trigger_fop.h:47
M0_INTERNAL void m0_fop_type_fini_nr(const struct m0_fop_type_batch *batch)
Definition: fop.c:288
struct m0_net_transfer_mc * m0_fop_tm_get(const struct m0_fop *fop)
Definition: fop.c:479
static struct m0_tl fop_types_list
Definition: fop.c:47
Definition: fop.h:79
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
Definition: fop.c:96
uint32_t ffrp_fop_code
Definition: fop.h:354