Motr  M0
addb2.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-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 #pragma once
24 
25 #ifndef __MOTR_ADDB2_ADDB2_H__
26 #define __MOTR_ADDB2_ADDB2_H__
27 
191 /* import */
192 #include "lib/types.h"
193 #include "lib/time.h"
194 #include "lib/tlist.h"
195 #include "lib/misc.h" /* ARRAY_SIZE */
196 #include "xcode/xcode_attr.h"
197 
198 /* export */
199 struct m0_addb2_mach;
200 struct m0_addb2_sensor;
201 struct m0_addb2_trace;
202 struct m0_addb2_trace_obj;
203 
219 void m0_addb2_push(uint64_t id, int n, const uint64_t *value);
220 
229 void m0_addb2_pop (uint64_t id);
230 
240 void m0_addb2_add (uint64_t id, int n, const uint64_t *value);
241 
252 #define M0_ADDB2_ADD(id, ...) \
253  m0_addb2_add(id, ARRAY_SIZE(((uint64_t[]){ __VA_ARGS__ })), \
254  (const uint64_t[]){ __VA_ARGS__ })
255 
261 #define M0_ADDB2_PUSH(id, ...) \
262  m0_addb2_push(id, ARRAY_SIZE(((uint64_t[]){ __VA_ARGS__ })), \
263  (const uint64_t[]){ __VA_ARGS__ })
264 
276 #define M0_ADDB2_OBJ(obj) ((sizeof *(obj))/sizeof(uint64_t)), (uint64_t *)(obj)
277 
281 #define M0_ADDB2_IN(id, stmnt, ...) \
282 do { \
283  M0_ADDB2_PUSH(id , ##__VA_ARGS__); \
284  (stmnt); \
285  m0_addb2_pop(id); \
286 } while (0)
287 
298  void (*so_snapshot)(struct m0_addb2_sensor *s, uint64_t *area);
304  void (*so_fini)(struct m0_addb2_sensor *s);
305 };
306 
312  const struct m0_addb2_sensor_ops *s_ops;
316  uint64_t s_id;
318  unsigned s_nr;
319  uint64_t s_magix;
320 };
321 
332 void m0_addb2_sensor_add(struct m0_addb2_sensor *s, uint64_t id, unsigned nr,
333  int idx, const struct m0_addb2_sensor_ops *ops);
338 
345 
346 void m0_addb2_force_all(void);
347 
369  struct m0_addb2_trace_obj *tobj);
374  void (*apo_idle)(struct m0_addb2_mach *mach);
375 };
376 
383 void m0_addb2_trace_done(const struct m0_addb2_trace *trace);
384 
400  void *cookie);
407 
419 
424 
430 void *m0_addb2_mach_cookie(const struct m0_addb2_mach *mach);
431 
432 int m0_addb2_module_init(void);
433 void m0_addb2_module_fini(void);
435 /* Internal interface. */
436 
442  uint64_t tr_nr;
443  uint64_t *tr_body;
444 } M0_XCA_SEQUENCE M0_XCA_DOMAIN(rpc);
445 
465  void (*o_done)(struct m0_addb2_trace_obj *obj);
468  bool o_force;
469  uint64_t o_magix;
470 };
471 
473 #endif /* __MOTR_ADDB2_ADDB2_H__ */
474 
475 /*
476  * Local variables:
477  * c-indentation-style: "K&R"
478  * c-basic-offset: 8
479  * tab-width: 8
480  * fill-column: 80
481  * scroll-step: 1
482  * End:
483  */
484 /*
485  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
486  */
void m0_addb2_force(m0_time_t delay)
Definition: addb2.c:589
static size_t nr
Definition: dump.c:1505
int m0_addb2_module_init(void)
Definition: addb2.c:770
struct m0_addb2_trace_obj M0_XCA_DOMAIN
uint64_t m0_time_t
Definition: time.h:37
const struct m0_addb2_sensor_ops * s_ops
Definition: addb2.h:312
static int delay
Definition: dump.c:174
int const char const void * value
Definition: dir.c:325
void m0_addb2_mach_fini(struct m0_addb2_mach *mach)
Definition: addb2.c:560
struct m0_tlink s_linkage
Definition: addb2.h:314
static struct m0_addb2_mach * mach
Definition: storage.c:42
uint64_t s_magix
Definition: addb2.h:319
static struct foo * obj
Definition: tlist.c:302
uint64_t o_magix
Definition: addb2.h:469
struct m0_addb2_trace o_tr
Definition: addb2.h:451
struct m0_tlink o_linkage
Definition: addb2.h:453
void m0_addb2_trace_done(const struct m0_addb2_trace *ctrace)
Definition: addb2.c:650
void m0_addb2_push(uint64_t id, int n, const uint64_t *value)
Definition: addb2.c:412
void m0_addb2_module_fini(void)
Definition: addb2.c:783
void m0_addb2_mach_stop(struct m0_addb2_mach *mach)
Definition: addb2.c:630
void m0_addb2_sensor_add(struct m0_addb2_sensor *s, uint64_t id, unsigned nr, int idx, const struct m0_addb2_sensor_ops *ops)
Definition: addb2.c:480
void m0_addb2_add(uint64_t id, int n, const uint64_t *value)
Definition: addb2.c:466
int(* apo_submit)(struct m0_addb2_mach *mach, struct m0_addb2_trace_obj *tobj)
Definition: addb2.h:368
void m0_addb2_pop(uint64_t id)
Definition: addb2.c:440
uint64_t n
Definition: fops.h:107
void(* so_fini)(struct m0_addb2_sensor *s)
Definition: addb2.h:304
uint64_t s_id
Definition: addb2.h:316
void(* apo_idle)(struct m0_addb2_mach *mach)
Definition: addb2.h:374
void * m0_addb2_mach_cookie(const struct m0_addb2_mach *mach)
Definition: addb2.c:645
void(* so_snapshot)(struct m0_addb2_sensor *s, uint64_t *area)
Definition: addb2.h:298
void m0_addb2_force_all(void)
Definition: addb2.c:613
void m0_addb2_sensor_del(struct m0_addb2_sensor *s)
Definition: addb2.c:504
uint64_t tr_nr
Definition: addb2.h:442
struct m0_fom_ops ops
Definition: io_foms.c:623
static struct m0_addb2_source * s
Definition: consumer.c:39
unsigned s_nr
Definition: addb2.h:318
struct m0_addb2_mach * o_mach
Definition: addb2.h:455
void(* o_done)(struct m0_addb2_trace_obj *obj)
Definition: addb2.h:465
void m0_addb2_mach_wait(struct m0_addb2_mach *mach)
Definition: addb2.c:639
struct m0_addb2_mach * m0_addb2_mach_init(const struct m0_addb2_mach_ops *ops, void *cookie)
Definition: addb2.c:521
uint64_t * tr_body
Definition: addb2.h:443