Motr  M0
iscdemo.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2021 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 #include <unistd.h> /* getopt */
22 
23 #include "lib/memory.h" /* m0_alloc m0_free */
24 #include "rpc/conn.h" /* m0_rpc_conn_addr */
25 #include "rpc/session.h" /* iop_session */
26 #include "xcode/xcode.h"
27 #include "conf/schema.h" /* M0_CST_ISCS */
28 #include "layout/layout.h" /* M0_DEFAULT_LAYOUT_ID */
29 #include "layout/plan.h" /* m0_layout_plan_build */
30 #include "motr/client.h"
31 
32 #include "util.h"
33 #include "common.h"
34 #include "libdemo.h" /* mm_result */
35 #include "libdemo_xc.h" /* isc_args_xc */
36 
37 
42 };
43 
44 static int op_type_parse(const char *op_name)
45 {
46  if (op_name == NULL)
47  return -EINVAL;
48  else if (!strcmp(op_name, "ping"))
49  return ICT_PING;
50  else if (!strcmp(op_name, "min"))
51  return ICT_MIN;
52  else if (!strcmp(op_name, "max"))
53  return ICT_MAX;
54  else
55  return -EINVAL;
56 
57 }
58 
59 static int minmax_input_prepare(struct m0_buf *out, struct m0_fid *comp_fid,
60  struct m0_layout_io_plop *iop,
61  uint32_t *reply_len, enum isc_comp_type type)
62 {
63  int rc;
64  struct m0_buf buf = M0_BUF_INIT0;
65  struct isc_targs ta = {};
66 
67  if (iop->iop_ext.iv_vec.v_nr == 0) {
68  ERR("at least 1 segment is required\n");
69  return -EINVAL;
70  }
71  ta.ist_cob = iop->iop_base.pl_ent;
73  &ta.ist_ioiv);
74  if (rc != 0)
75  return rc;
76  rc = m0_xcode_obj_enc_to_buf(&M0_XCODE_OBJ(isc_targs_xc, &ta),
77  &buf.b_addr, &buf.b_nob);
78  if (rc != 0)
79  return rc;
80 
81  *out = M0_BUF_INIT0; /* to avoid panic */
82  rc = m0_buf_copy_aligned(out, &buf, M0_0VEC_SHIFT);
83  m0_buf_free(&buf);
84 
85  if (type == ICT_MIN)
86  isc_fid_get("comp_min", comp_fid);
87  else
88  isc_fid_get("comp_max", comp_fid);
89 
90  *reply_len = CBL_DEFAULT_MAX;
91 
92  return rc;
93 }
94 
95 static int ping_input_prepare(struct m0_buf *buf, struct m0_fid *comp_fid,
96  uint32_t *reply_len, enum isc_comp_type type)
97 {
98  char *greeting;
99 
100  *buf = M0_BUF_INIT0;
101  greeting = m0_strdup("Hello");
102  if (greeting == NULL)
103  return -ENOMEM;
104 
105  m0_buf_init(buf, greeting, strlen(greeting));
106  isc_fid_get("hello_world", comp_fid);
107  *reply_len = CBL_DEFAULT_MAX;
108 
109  return 0;
110 }
111 
112 static int input_prepare(struct m0_buf *buf, struct m0_fid *comp_fid,
113  struct m0_layout_io_plop *iop, uint32_t *reply_len,
114  enum isc_comp_type type)
115 {
116  switch (type) {
117  case ICT_PING:
118  return ping_input_prepare(buf, comp_fid, reply_len, type);
119  case ICT_MIN:
120  case ICT_MAX:
121  return minmax_input_prepare(buf, comp_fid, iop,
122  reply_len, type);
123  }
124  return -EINVAL;
125 }
126 
130 static struct mm_result *
131 op_result(struct mm_result *x, struct mm_result *y, enum isc_comp_type op_type)
132 {
133  int rc;
134  int len;
135  char *buf;
136  double val1;
137  double val2;
138 
139  len = x->mr_rbuf.b_nob + y->mr_lbuf.b_nob;
140  buf = malloc(x->mr_rbuf.b_nob + y->mr_lbuf.b_nob + 1);
141  if (buf == NULL) {
142  ERR("failed to allocate %d of memory for result\n", len);
143  return NULL;
144  }
145 
146  /*
147  * Glue two edge buffers from the two results and read the value
148  * from it. This value must be accounted in the final computation.
149  */
150  memcpy(buf, x->mr_rbuf.b_addr, x->mr_rbuf.b_nob);
151  buf[x->mr_rbuf.b_nob] = '\0';
152  DBG2("xrbuf=%s\n", buf);
153  memcpy(buf + x->mr_rbuf.b_nob, y->mr_lbuf.b_addr, y->mr_lbuf.b_nob);
154  buf[x->mr_rbuf.b_nob + y->mr_lbuf.b_nob] = '\0';
155 
156  rc = sscanf(buf, "%lf%n", &val1, &len);
157  if (rc < 1) {
158  ERR("failed to read the resulting xr-value\n");
159  m0_free(buf);
160  return NULL;
161  }
162 
163  y->mr_idx += x->mr_nr;
164  y->mr_nr += x->mr_nr;
165 
166  DBG2("buf=%s val1=%lf\n", buf, val1);
167 
168  /*
169  * It may happen that there will be two values in the buffer (when
170  * the split happens right around the delimiter), so we should try
171  * to read it and account it in the final computation too.
172  */
173  val2 = val1;
174  rc = sscanf(buf + len, "%lf", &val2);
175  if (rc == 1) {
176  DBG2("val2=%lf\n", val2);
177  y->mr_idx++;
178  y->mr_nr++;
179  }
180 
181  DBG2("xval=%lf yval=%lf\n", x->mr_val, y->mr_val);
182 
183  if (ICT_MIN == op_type)
184  y->mr_val = min3(min_check(x->mr_val, y->mr_val), val1, val2);
185  else
186  y->mr_val = max3(max_check(x->mr_val, y->mr_val), val1, val2);
187 
188  /* Update the resulting value index. */
189  if (y->mr_val == x->mr_val)
190  y->mr_idx = x->mr_idx;
191  else if (y->mr_val == val1)
192  y->mr_idx = x->mr_nr;
193  else if (y->mr_val == val2)
194  y->mr_idx = x->mr_nr + 1;
195 
196  m0_free(buf);
197 
198  return y;
199 }
200 
201 enum elm_order {
204 };
205 
206 static void set_idx(struct mm_result *res, enum elm_order e)
207 {
208  if (ELM_FIRST == e)
209  res->mr_idx = 0;
210  else
211  res->mr_idx = res->mr_nr;
212 }
213 
217 static void check_edge_val(struct mm_result *res, enum elm_order e,
218  enum isc_comp_type type)
219 {
220  const char *buf;
221  double val;
222 
223  if (ELM_FIRST == e)
224  buf = res->mr_lbuf.b_addr;
225  else // last
226  buf = res->mr_rbuf.b_addr;
227 
228  if (sscanf(buf, "%lf", &val) < 1) {
229  ERR("failed to parse egde value=%s\n", buf);
230  return;
231  }
232 
233  DBG2("edge val=%lf (%s)\n", val, (ELM_FIRST == e) ? "first" : "last");
234 
235  if (res->mr_nr == 1) {
236  res->mr_val = val;
237  return;
238  }
239 
240  if (ICT_MIN == type && val < res->mr_val) {
241  res->mr_val = val;
242  set_idx(res, e);
243  } else if (ICT_MAX == type && val > res->mr_val) {
244  res->mr_val = val;
245  set_idx(res, e);
246  }
247 }
248 
250 {
251  m0_free(r->mr_lbuf.b_addr);
252  m0_free(r->mr_rbuf.b_addr);
253 }
254 
255 static void *minmax_output_prepare(struct m0_buf *result,
256  bool last_unit,
257  struct mm_result *prev,
258  enum isc_comp_type type)
259 {
260  int rc;
261  struct mm_result new = {};
262 
263  rc = m0_xcode_obj_dec_from_buf(&M0_XCODE_OBJ(mm_result_xc, &new),
264  result->b_addr, result->b_nob);
265  if (rc != 0) {
266  ERR("failed to parse result: rc=%d\n", rc);
267  goto out;
268  }
269  if (prev == NULL) {
270  M0_ALLOC_PTR(prev);
271  check_edge_val(&new, ELM_FIRST, type);
272  *prev = new;
273  goto out;
274  }
275 
276  if (last_unit)
277  check_edge_val(&new, ELM_LAST, type);
278 
279  /* Copy the current resulting value. */
280  if (op_result(prev, &new, type)) {
282  *prev = new;
283  }
284  out:
285  /* Print the result. */
286  if (last_unit && prev != NULL) {
287  printf("idx=%lu val=%lf\n", prev->mr_idx, prev->mr_val);
289  m0_free(prev);
290  prev = NULL;
291  }
292 
293  return prev;
294 }
295 
301 static void* output_process(struct m0_buf *result, bool last,
302  void *out, enum isc_comp_type type)
303 {
304  switch (type) {
305  case ICT_PING:
306  printf ("Hello-%s @%s\n", (char*)result->b_addr, (char*)out);
307  memset(result->b_addr, 'a', result->b_nob);
308  return NULL;
309  case ICT_MIN:
310  case ICT_MAX:
311  return minmax_output_prepare(result, last, out, type);
312  }
313  return NULL;
314 }
315 
316 char *prog;
317 
318 const char *help_str = "\
319 \n\
320 Usage: %s OPTIONS COMP OBJ_ID LEN\n\
321 \n\
322  Supported COMPutations: ping, min, max\n\
323 \n\
324  OBJ_ID is two uint64 numbers in hi:lo format (dec or hex)\n\
325  LEN is the length of object (in KiB)\n\
326 \n\
327  Motr-related mandatory options:\n\
328  -e <addr> endpoint address\n\
329  -x <addr> ha-agent (hax) endpoint address\n\
330  -f <fid> process fid\n\
331  -p <fid> profile fid\n\
332 \n\
333  Other non-mandatory options:\n\
334  -v increase verbosity (-vv to increase even more)\n\
335  -h this help\n\
336 \n";
337 
338 static void usage()
339 {
340  fprintf(stderr, help_str, prog);
341  exit(1);
342 }
343 
348 int read_id(const char *s, struct m0_uint128 *id)
349 {
350  int res;
351  long long hi, lo;
352 
353  res = sscanf(s, "%lli:%lli", &hi, &lo);
354  if (res == 1) {
355  id->u_hi = 0;
356  id->u_lo = hi;
357  } else if (res == 2) {
358  id->u_hi = hi;
359  id->u_lo = lo;
360  }
361 
362  return res;
363 }
364 
365 int launch_comp(struct m0_layout_plan *plan, int op_type, bool last)
366 {
367  int rc;
368  int reqs_nr = 0;
369  uint32_t reply_len;
370  struct isc_req *req;
371  struct m0_layout_plop *plop = NULL;
372  struct m0_layout_io_plop *iopl;
373  static void *out_args = NULL; /* computation output */
374  const char *conn_addr = NULL;
375  struct m0_fid comp_fid;
376  struct m0_buf buf;
377 
378  for (;;) {
379  M0_ALLOC_PTR(req);
380  if (req == NULL) {
381  ERR("request allocation failed\n");
382  break;
383  }
384  rc = m0_layout_plan_get(plan, 0, &plop);
385  if (rc != 0) {
386  ERR("failed to get plop: rc=%d\n", rc);
387  usage();
388  }
389 
390  if (plop->pl_type == M0_LAT_DONE)
391  break;
392 
393  if (plop->pl_type == M0_LAT_OUT_READ)
394  continue; /* XXX not used atm */
395 
396  M0_ASSERT(plop->pl_type == M0_LAT_READ);
397 
398  m0_layout_plop_start(plop);
399 
400  iopl = container_of(plop, struct m0_layout_io_plop, iop_base);
401 
402  DBG("req=%d goff=%lu segs=%d\n", reqs_nr, iopl->iop_goff,
403  iopl->iop_ext.iv_vec.v_nr);
404  /* Prepare arguments for the computation. */
405  rc = input_prepare(&buf, &comp_fid, iopl, &reply_len, op_type);
406  if (rc != 0) {
407  m0_layout_plop_done(plop);
408  ERR("input preparation failed: %d\n", rc);
409  break;
410  }
411 
412  rc = isc_req_prepare(req, &buf, &comp_fid, iopl, reply_len);
413  if (rc != 0) {
414  m0_buf_free(&buf);
415  m0_layout_plop_done(plop);
416  m0_free(req);
417  ERR("request preparation failed: %d\n", rc);
418  break;
419  }
420 
421  rc = isc_req_send(req);
422  conn_addr = m0_rpc_conn_addr(iopl->iop_session->s_conn);
423  if (rc != 0) {
424  ERR("error from %s received: rc=%d\n",
425  conn_addr, rc);
426  break;
427  }
428  reqs_nr++;
429  }
430 
431  /* Wait for all the replies. */
432  while (reqs_nr-- > 0)
434 
435  /* Process the replies. */
436  m0_list_teardown(&isc_reqs, req, struct isc_req, cir_link) {
437  iopl = M0_AMB(iopl, req->cir_plop, iop_base);
438  DBG2("req=%d goff=%lu\n", ++reqs_nr, iopl->iop_goff);
439  if (rc == 0 && req->cir_rc == 0) {
440  if (op_type == ICT_PING)
441  out_args = (void*)conn_addr;
442  out_args = output_process(&req->cir_result,
444  out_args, op_type);
445  }
446  m0_layout_plop_done(req->cir_plop);
447  isc_req_fini(req);
448  m0_free(req);
449  }
450 
451  return rc;
452 }
453 
454 static int open_entity(struct m0_entity *entity)
455 {
456  int rc;
457  struct m0_op *op = NULL;
458 
459  m0_entity_open(entity, &op);
460  m0_op_launch(&op, 1);
462  M0_TIME_NEVER) ?: m0_rc(op);
463  m0_op_fini(op);
464  m0_op_free(op);
465 
466  return rc;
467 }
468 
469 int main(int argc, char **argv)
470 {
471  int rc;
472  int opt;
473  struct m0_client *cinst = NULL;
474  struct m0_op *op = NULL;
475  struct m0_layout_plan *plan;
476  struct m0_uint128 obj_id;
477  struct m0_indexvec ext;
478  struct m0_bufvec data;
479  struct m0_bufvec attr;
480  struct m0_config conf = {};
481  int op_type;
482  int unit_sz;
483  int units_nr;
484  m0_bcount_t len;
485  m0_bcount_t bs;
486  m0_bindex_t off = 0;
487  struct m0_obj obj = {};
488 
489  prog = basename(strdup(argv[0]));
490 
491  while ((opt = getopt(argc, argv, ":vhe:x:f:p:")) != -1) {
492  switch (opt) {
493  case 'e':
494  conf.mc_local_addr = optarg;
495  break;
496  case 'x':
497  conf.mc_ha_addr = optarg;
498  break;
499  case 'f':
500  conf.mc_process_fid = optarg;
501  break;
502  case 'p':
503  conf.mc_profile = optarg;
504  break;
505  case 'v':
506  trace_level++;
507  break;
508  case 'h':
509  usage();
510  break;
511  default:
512  ERR("unknown option: %c\n", optopt);
513  usage();
514  break;
515  }
516  }
517 
518  if (conf.mc_local_addr == NULL || conf.mc_ha_addr == NULL ||
519  conf.mc_process_fid == NULL || conf.mc_profile == NULL) {
520  ERR("mandatory parameter is missing\n");
521  usage();
522  }
523  if (argc - optind < 3)
524  usage();
525 
526  op_type = op_type_parse(argv[optind]);
527  if (op_type == -EINVAL)
528  usage();
529  if (read_id(argv[optind + 1], &obj_id) < 1)
530  usage();
531  len = atoll(argv[optind + 2]);
532  if (len < 4) {
533  ERR("object length should be at least 4K\n");
534  usage();
535  }
536  len *= 1024;
537 
538  m0trace_on = true;
539 
540  rc = isc_init(&conf, &cinst);
541  if (rc != 0) {
542  fprintf(stderr,"isc_init() failed: %d\n", rc);
543  usage();
544  }
545 
546  m0_xc_iscservice_demo_libdemo_init();
547 
548  m0_obj_init(&obj, &uber_realm, &obj_id, M0_DEFAULT_LAYOUT_ID);
549  rc = open_entity(&obj.ob_entity);
550  if (rc != 0) {
551  ERR("failed to open object: rc=%d\n", rc);
552  usage();
553  }
554 
555  bs = isc_m0gs(&obj, cinst);
556  if (bs == 0) {
557  ERR("cannot figure out bs to use\n");
558  usage();
559  }
560  unit_sz = m0_obj_layout_id_to_unit_size(obj.ob_attr.oa_layout_id);
561 
562  for (; rc == 0 && len > 0; len -= len < bs ? len : bs, off += bs) {
563  if (len < bs)
564  bs = (len + unit_sz - 1) / unit_sz * unit_sz;
565  units_nr = bs / unit_sz;
566  DBG("unit_sz=%d units=%d\n", unit_sz, units_nr);
567 
568  rc = alloc_segs(&data, &ext, &attr, unit_sz, units_nr);
569  if (rc != 0) {
570  ERR("failed to alloc_segs: rc=%d\n", rc);
571  usage();
572  }
573  set_exts(&ext, off, unit_sz);
574 
575  rc = m0_obj_op(&obj, M0_OC_READ, &ext, &data, &attr, 0, 0, &op);
576  if (rc != 0) {
577  ERR("failed to create op: rc=%d\n", rc);
578  usage();
579  }
580 
581  plan = m0_layout_plan_build(op);
582  if (plan == NULL) {
583  ERR("failed to build access plan\n");
584  usage();
585  }
586 
587  rc = launch_comp(plan, op_type, len <= bs ? true : false);
588 
589  m0_layout_plan_fini(plan);
590  free_segs(&data, &ext, &attr);
591  }
592 
593  isc_fini(cinst);
594 
595  return rc != 0 ? 1 : 0;
596 }
597 
598 /*
599  * Local variables:
600  * c-indentation-style: "K&R"
601  * c-basic-offset: 8
602  * tab-width: 8
603  * fill-column: 80
604  * scroll-step: 1
605  * End:
606  */
M0_INTERNAL int m0_buf_copy_aligned(struct m0_buf *dst, const struct m0_buf *src, unsigned shift)
Definition: buf.c:119
int optind
M0_INTERNAL void m0_layout_plop_done(struct m0_layout_plop *plop)
Definition: plan.c:311
static void check_edge_val(struct mm_result *res, enum elm_order e, enum isc_comp_type type)
Definition: iscdemo.c:217
#define m0_strdup(s)
Definition: string.h:43
Definition: client.h:788
struct m0_list isc_reqs
Definition: util.c:44
#define NULL
Definition: misc.h:38
M0_INTERNAL int m0_layout_plan_get(struct m0_layout_plan *plan, uint64_t colour, struct m0_layout_plop **plop)
Definition: plan.c:278
void isc_fid_get(const char *f_name, struct m0_fid *fid)
Definition: common.c:26
Definition: idx_mock.c:52
#define m0_list_teardown(head, pos, type, member)
Definition: list.h:334
static bool x
Definition: sm.c:168
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
void * b_addr
Definition: buf.h:39
void m0_op_fini(struct m0_op *op)
Definition: client.c:847
static struct io_request req
Definition: file.c:100
struct m0_buf mr_lbuf
Definition: libdemo.h:50
#define min_check(a, b)
Definition: arith.h:88
void free_segs(struct m0_bufvec *data, struct m0_indexvec *ext, struct m0_bufvec *attr)
Definition: util.c:67
#define max_check(a, b)
Definition: arith.h:95
static struct m0_realm uber_realm
Definition: m0hsm.c:49
int32_t m0_rc(const struct m0_op *op)
Definition: client.c:943
int launch_comp(struct m0_layout_plan *plan, int op_type, bool last)
Definition: iscdemo.c:365
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
Definition: buf.c:37
static struct mm_result * op_result(struct mm_result *x, struct mm_result *y, enum isc_comp_type op_type)
Definition: iscdemo.c:131
struct m0_bufvec data
Definition: di.c:40
#define ERR(_fmt,...)
Definition: util.h:129
uint64_t mr_idx
Definition: libdemo.h:44
struct m0_fid pl_ent
Definition: plan.h:398
isc_comp_type
Definition: iscdemo.c:38
Definition: conf.py:1
uint64_t m0_bindex_t
Definition: types.h:80
char * optarg
#define M0_BITS(...)
Definition: misc.h:236
uint64_t m0_bcount_t
Definition: types.h:77
static int void * buf
Definition: dir.c:1019
#define container_of(ptr, type, member)
Definition: misc.h:33
int trace_level
Definition: util.c:41
void isc_req_fini(struct isc_req *req)
Definition: util.c:229
static struct foo * obj
Definition: tlist.c:302
Definition: sock.c:887
int read_id(const char *s, struct m0_uint128 *id)
Definition: iscdemo.c:348
struct m0_io_indexvec ist_ioiv
Definition: libdemo.h:60
int32_t m0_op_wait(struct m0_op *op, uint64_t bits, m0_time_t to)
Definition: client.c:739
struct m0_vec iv_vec
Definition: vec.h:139
op
Definition: libdemo.c:64
int m0_obj_op(struct m0_obj *obj, enum m0_obj_opcode opcode, struct m0_indexvec *ext, struct m0_bufvec *data, struct m0_bufvec *attr, uint64_t mask, uint32_t flags, struct m0_op **op)
Definition: io.c:717
M0_INTERNAL const char * m0_rpc_conn_addr(const struct m0_rpc_conn *conn)
Definition: conn.c:1306
Definition: buf.h:37
int m0_obj_layout_id_to_unit_size(uint64_t layout_id)
Definition: obj.c:851
Definition: client.h:641
int main(int argc, char **argv)
Definition: iscdemo.c:469
static void usage()
Definition: iscdemo.c:338
#define max3(a, b, c)
Definition: arith.h:104
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:949
static void set_idx(struct mm_result *res, enum elm_order e)
Definition: iscdemo.c:206
m0_bcount_t b_nob
Definition: buf.h:38
#define M0_ASSERT(cond)
m0_bindex_t iop_goff
Definition: plan.h:489
static int input_prepare(struct m0_buf *buf, struct m0_fid *comp_fid, struct m0_layout_io_plop *iop, uint32_t *reply_len, enum isc_comp_type type)
Definition: iscdemo.c:112
static void * output_process(struct m0_buf *result, bool last, void *out, enum isc_comp_type type)
Definition: iscdemo.c:301
uint64_t set_exts(struct m0_indexvec *ext, uint64_t off, uint64_t bsz)
Definition: util.c:95
static int op_type_parse(const char *op_name)
Definition: iscdemo.c:44
enum m0_layout_plop_type pl_type
Definition: plan.h:357
void m0_op_launch(struct m0_op **op, uint32_t nr)
Definition: client.c:725
#define M0_BUF_INIT0
Definition: buf.h:71
M0_INTERNAL int m0_layout_plop_start(struct m0_layout_plop *plop)
Definition: plan.c:299
M0_INTERNAL int m0_xcode_obj_enc_to_buf(struct m0_xcode_obj *obj, void **buf, m0_bcount_t *len)
Definition: xcode.c:832
static void * minmax_output_prepare(struct m0_buf *result, bool last_unit, struct mm_result *prev, enum isc_comp_type type)
Definition: iscdemo.c:255
static void mm_result_free_xcode_bufs(struct mm_result *r)
Definition: iscdemo.c:249
uint32_t v_nr
Definition: vec.h:51
double mr_val
Definition: libdemo.h:48
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
Definition: buf.c:55
struct m0_uint128 obj_id
Definition: example1.c:53
M0_INTERNAL bool m0_list_is_empty(const struct m0_list *head)
Definition: list.c:42
const char * help_str
Definition: iscdemo.c:318
struct m0_layout_plop iop_base
Definition: plan.h:479
struct m0_rpc_session * iop_session
Definition: plan.h:482
struct m0_indexvec iop_ext
Definition: plan.h:486
static struct m0_client cinst
Definition: sync.c:84
M0_INTERNAL void m0_layout_plan_fini(struct m0_layout_plan *plan)
Definition: plan.c:229
static int minmax_input_prepare(struct m0_buf *out, struct m0_fid *comp_fid, struct m0_layout_io_plop *iop, uint32_t *reply_len, enum isc_comp_type type)
Definition: iscdemo.c:59
static int open_entity(struct m0_entity *entity)
Definition: iscdemo.c:454
char * prog
Definition: iscdemo.c:316
Definition: fid.h:38
M0_INTERNAL int m0_indexvec_mem2wire(struct m0_indexvec *mem_ivec, int max_frags_nr, uint32_t bshift, struct m0_io_indexvec *wire_ivec)
Definition: vec.c:1087
struct m0_semaphore isc_sem
Definition: util.c:43
#define DBG(_fmt,...)
Definition: m0hsm_api.c:72
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
int isc_init(struct m0_config *conf, struct m0_client **cinst)
Definition: util.c:247
static int r[NR]
Definition: thread.c:46
static int ping_input_prepare(struct m0_buf *buf, struct m0_fid *comp_fid, uint32_t *reply_len, enum isc_comp_type type)
Definition: iscdemo.c:95
M0_INTERNAL int m0_xcode_obj_dec_from_buf(struct m0_xcode_obj *obj, void *buf, m0_bcount_t len)
Definition: xcode.c:850
uint64_t mr_nr
Definition: libdemo.h:46
void m0_obj_init(struct m0_obj *obj, struct m0_realm *parent, const struct m0_uint128 *id, uint64_t layout_id)
Definition: client.c:403
M0_INTERNAL struct m0_layout_plan * m0_layout_plan_build(struct m0_op *op)
Definition: plan.c:136
uint64_t isc_m0gs(struct m0_obj *obj, struct m0_client *cinst)
Definition: util.c:49
Definition: util.h:48
int alloc_segs(struct m0_bufvec *data, struct m0_indexvec *ext, struct m0_bufvec *attr, uint64_t bsz, uint32_t cnt)
Definition: util.c:75
#define DBG2(_fmt,...)
Definition: util.h:133
#define M0_XCODE_OBJ(type, ptr)
Definition: xcode.h:962
elm_order
Definition: iscdemo.c:201
bool m0trace_on
Definition: util.c:42
void isc_fini(struct m0_client *cinst)
Definition: util.c:281
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
Definition: semaphore.c:49
#define out(...)
Definition: gen.c:41
void m0_op_free(struct m0_op *op)
Definition: client.c:885
int isc_req_prepare(struct isc_req *req, struct m0_buf *args, const struct m0_fid *comp_fid, struct m0_layout_io_plop *iop, uint32_t reply_len)
Definition: util.c:108
#define min3(a, b, c)
Definition: arith.h:103
int type
Definition: dir.c:1031
int m0_entity_open(struct m0_entity *entity, struct m0_op **op)
Definition: obj.c:885
int optopt
void m0_free(void *data)
Definition: memory.c:146
static struct m0_addb2_source * s
Definition: consumer.c:39
int32_t rc
Definition: trigger_fop.h:47
static void hi(void)
Definition: nucleus.c:93
int isc_req_send(struct isc_req *req)
Definition: util.c:198
struct m0_fid ist_cob
Definition: libdemo.h:58
struct m0_rpc_conn * s_conn
Definition: session.h:312
static struct m0_addb2_frame_header last
Definition: storage.c:93
Definition: vec.h:145