Motr  M0
common.h File Reference
#include "conf/obj.h"
#include "conf/obj_ops.h"
#include "conf/onwire.h"
#include "conf/dir.h"
#include "fid/fid.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "lib/misc.h"
Include dependency graph for common.h:

Go to the source code of this file.

Data Structures

struct  conf_dir_entries
 
struct  conf_dir_encoding_pair
 
struct  conf_dir_relation
 

Macros

#define __MOTR_CONF_OBJS_COMMON_H__
 
#define X_CONF(_, NAME, ft_id)   M0_CONF__ ## NAME ## _FT_ID = ft_id,
 
#define M0_CONF__BOB_DEFINE(type, magic, check)
 
#define M0_CONF__INVARIANT_DEFINE(name, type)
 
#define M0_CONF__CTOR_DEFINE(name, type, ops)
 
#define CONF_DIR_ENTRIES(relfid, entry_type, entries)   ((struct conf_dir_entries){ (relfid), (entry_type), (entries) })
 

Enumerations

enum  { M0_CONF_OBJ_TYPES }
 

Functions

M0_INTERNAL int dir_create_and_populate (struct m0_conf_dir **result, const struct conf_dir_entries *de, struct m0_conf_obj *dir_parent)
 
M0_INTERNAL int conf_dirs_encode (const struct conf_dir_encoding_pair *how, size_t how_nr)
 
M0_INTERNAL int conf_dirs_lookup (struct m0_conf_obj **out, const struct m0_fid *name, const struct conf_dir_relation *rels, size_t nr_rels)
 
M0_INTERNAL bool arrays_eq (const char **cached, const struct m0_bufs *flat)
 
M0_INTERNAL int arrfid_from_dir (struct m0_fid_arr *dest, const struct m0_conf_dir *dir)
 
M0_INTERNAL void arrfid_free (struct m0_fid_arr *arr)
 
M0_INTERNAL void confx_encode (struct m0_confx_obj *dest, const struct m0_conf_obj *src)
 
M0_INTERNAL int u32arr_decode (const struct arr_u32 *src, uint32_t **dest)
 
M0_INTERNAL int u32arr_encode (struct arr_u32 *dest, const uint32_t *src, uint32_t src_nr)
 
M0_INTERNAL bool u32arr_cmp (const struct arr_u32 *a1, const uint32_t *a2, uint32_t a2_nr)
 
M0_INTERNAL void u32arr_free (struct arr_u32 *arr)
 
M0_INTERNAL int conf_pvers_decode (struct m0_conf_pver ***dest, const struct m0_fid_arr *src, struct m0_conf_cache *cache)
 
M0_INTERNAL int conf_pvers_encode (struct m0_fid_arr *dest, const struct m0_conf_pver **src)
 
M0_INTERNAL int conf_obj_lookup_denied (const struct m0_conf_obj *parent, const struct m0_fid *name, struct m0_conf_obj **out)
 
M0_INTERNAL const struct m0_fid ** conf_obj_downlinks_none (const struct m0_conf_obj *obj)
 

Macro Definition Documentation

◆ __MOTR_CONF_OBJS_COMMON_H__

#define __MOTR_CONF_OBJS_COMMON_H__

Definition at line 24 of file common.h.

◆ CONF_DIR_ENTRIES

#define CONF_DIR_ENTRIES (   relfid,
  entry_type,
  entries 
)    ((struct conf_dir_entries){ (relfid), (entry_type), (entries) })

Definition at line 88 of file common.h.

◆ M0_CONF__BOB_DEFINE

#define M0_CONF__BOB_DEFINE (   type,
  magic,
  check 
)
Value:
const struct m0_bob_type type ## _bob = { \
.bt_name = #type, \
.bt_magix_offset = M0_MAGIX_OFFSET(struct type, \
type ## _cast_field.co_con_magic), \
.bt_magix = magic, \
.bt_check = check \
}; \
M0_BOB_DEFINE(static, &type ## _bob, type)
static uint64_t magic(const struct m0_tl_descr *d, const void *obj)
Definition: tlist.c:286
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356
void check(struct workload *w)
int type
Definition: dir.c:1031

Definition at line 48 of file common.h.

◆ M0_CONF__CTOR_DEFINE

#define M0_CONF__CTOR_DEFINE (   name,
  type,
  ops 
)
Value:
static struct m0_conf_obj *name(void) \
{ \
struct type *x; \
struct m0_conf_obj *ret; \
if (x == NULL) \
return NULL; \
\
type ## _bob_init(x); \
ret = &x->type ## _cast_field; \
ret->co_ops = ops; \
return ret; \
} \
struct __ ## type ## _semicolon_catcher
#define NULL
Definition: misc.h:38
static bool x
Definition: sm.c:168
const char * name
Definition: trace.c:110
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
int type
Definition: dir.c:1031
struct m0_fom_ops ops
Definition: io_foms.c:623

Definition at line 66 of file common.h.

◆ M0_CONF__INVARIANT_DEFINE

#define M0_CONF__INVARIANT_DEFINE (   name,
  type 
)
Value:
static bool name(const struct m0_conf_obj *obj) \
{ \
return type ## _bob_check(container_of(obj, struct type, \
type ## _cast_field)); \
} \
struct __ ## type ## _semicolon_catcher
#define container_of(ptr, type, member)
Definition: misc.h:33
static struct foo * obj
Definition: tlist.c:302
const char * name
Definition: trace.c:110
int type
Definition: dir.c:1031

Definition at line 58 of file common.h.

◆ X_CONF

#define X_CONF (   _,
  NAME,
  ft_id 
)    M0_CONF__ ## NAME ## _FT_ID = ft_id,

Definition at line 41 of file common.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_CONF_OBJ_TYPES 

Definition at line 40 of file common.h.

Function Documentation

◆ arrays_eq()

M0_INTERNAL bool arrays_eq ( const char **  cached,
const struct m0_bufs flat 
)

◆ arrfid_free()

M0_INTERNAL void arrfid_free ( struct m0_fid_arr arr)

Definition at line 104 of file common.c.

Here is the caller graph for this function:

◆ arrfid_from_dir()

M0_INTERNAL int arrfid_from_dir ( struct m0_fid_arr dest,
const struct m0_conf_dir dir 
)

Definition at line 82 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conf_dirs_encode()

M0_INTERNAL int conf_dirs_encode ( const struct conf_dir_encoding_pair how,
size_t  how_nr 
)

Definition at line 43 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conf_dirs_lookup()

M0_INTERNAL int conf_dirs_lookup ( struct m0_conf_obj **  out,
const struct m0_fid name,
const struct conf_dir_relation rels,
size_t  nr_rels 
)

Definition at line 64 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conf_obj_downlinks_none()

M0_INTERNAL const struct m0_fid** conf_obj_downlinks_none ( const struct m0_conf_obj obj)

Definition at line 226 of file common.c.

◆ conf_obj_lookup_denied()

M0_INTERNAL int conf_obj_lookup_denied ( const struct m0_conf_obj parent,
const struct m0_fid name,
struct m0_conf_obj **  out 
)

Definition at line 217 of file common.c.

Here is the call graph for this function:

◆ conf_pvers_decode()

M0_INTERNAL int conf_pvers_decode ( struct m0_conf_pver ***  dest,
const struct m0_fid_arr src,
struct m0_conf_cache cache 
)

Definition at line 161 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conf_pvers_encode()

M0_INTERNAL int conf_pvers_encode ( struct m0_fid_arr dest,
const struct m0_conf_pver **  src 
)

Definition at line 194 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ confx_encode()

M0_INTERNAL void confx_encode ( struct m0_confx_obj dest,
const struct m0_conf_obj src 
)

Definition at line 110 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dir_create_and_populate()

M0_INTERNAL int dir_create_and_populate ( struct m0_conf_dir **  result,
const struct conf_dir_entries de,
struct m0_conf_obj dir_parent 
)

Definition at line 33 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ u32arr_cmp()

M0_INTERNAL bool u32arr_cmp ( const struct arr_u32 a1,
const uint32_t *  a2,
uint32_t  a2_nr 
)

Definition at line 145 of file common.c.

Here is the caller graph for this function:

◆ u32arr_decode()

M0_INTERNAL int u32arr_decode ( const struct arr_u32 src,
uint32_t **  dest 
)

Definition at line 116 of file common.c.

Here is the call graph for this function:

◆ u32arr_encode()

M0_INTERNAL int u32arr_encode ( struct arr_u32 dest,
const uint32_t *  src,
uint32_t  src_nr 
)

Definition at line 129 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ u32arr_free()

M0_INTERNAL void u32arr_free ( struct arr_u32 arr)

Definition at line 151 of file common.c.

Here is the caller graph for this function: