Motr  M0
File identifier

Data Structures

struct  m0_fid
 
struct  m0_fid_arr
 
struct  m0_fid_type
 
struct  m0_fid_item
 

Macros

#define FID_F   "<%" PRIx64 ":%" PRIx64 ">"
 
#define FID_SF   " < %" SCNx64 " : %" SCNx64 " > "
 
#define FID_P(f)   (f)->f_container, (f)->f_key
 
#define FID_S(f)   &(f)->f_container, &(f)->f_key
 
#define M0_FID_TCONTAINER(type, container)
 
#define M0_FID_INIT(container, key)
 
#define M0_FID_TINIT(type, container, key)   M0_FID_INIT(M0_FID_TCONTAINER((type), (container)), (key))
 
#define M0_FID0   M0_FID_INIT(0ULL, 0ULL)
 
#define M0_FID_BUF(fid)
 

Enumerations

enum  { M0_FID_TYPE_MASK = 0x00ffffffffffffffULL, M0_FID_STR_LEN = 64 }
 

Functions

M0_INTERNAL void m0_fid_type_register (const struct m0_fid_type *fidt)
 
M0_INTERNAL void m0_fid_type_unregister (const struct m0_fid_type *fidt)
 
M0_INTERNAL const struct m0_fid_typem0_fid_type_get (uint8_t id)
 
M0_INTERNAL const struct m0_fid_typem0_fid_type_gethi (uint64_t id)
 
M0_INTERNAL const struct m0_fid_typem0_fid_type_getfid (const struct m0_fid *fid)
 
M0_INTERNAL const struct m0_fid_typem0_fid_type_getname (const char *name)
 
M0_INTERNAL bool m0_fid_is_valid (const struct m0_fid *fid)
 
M0_INTERNAL bool m0_fid_is_set (const struct m0_fid *fid)
 
M0_INTERNAL void m0_fid_set (struct m0_fid *fid, uint64_t container, uint64_t key)
 
M0_INTERNAL void m0_fid_tset (struct m0_fid *fid, uint8_t tid, uint64_t container, uint64_t key)
 
M0_INTERNAL uint8_t m0_fid_tget (const struct m0_fid *fid)
 
M0_INTERNAL void m0_fid_tchange (struct m0_fid *fid, uint8_t tid)
 
M0_INTERNAL void m0_fid_tassume (struct m0_fid *fid, const struct m0_fid_type *ft)
 
M0_INTERNAL void m0_fid_tgenerate (struct m0_fid *fid, const uint8_t tid)
 
M0_INTERNAL bool m0_fid_eq (const struct m0_fid *fid0, const struct m0_fid *fid1)
 
M0_INTERNAL int m0_fid_cmp (const struct m0_fid *fid0, const struct m0_fid *fid1)
 
static int fid_sscanf (const char *s, struct m0_fid *fid, int *nob)
 
M0_INTERNAL int m0_fid_sscanf (const char *s, struct m0_fid *fid)
 
M0_INTERNAL int m0_fid_print (char *s, size_t s_len, const struct m0_fid *fid)
 
static int xt_read (const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
 
M0_INTERNAL int m0_fid_init (void)
 
M0_INTERNAL void m0_fid_fini (void)
 
M0_INTERNAL uint64_t m0_fid_hash (const struct m0_fid *fid)
 
M0_INTERNAL int m0_fid_arr_copy (struct m0_fid_arr *to, const struct m0_fid_arr *from)
 
M0_INTERNAL bool m0_fid_arr_eq (const struct m0_fid_arr *a, const struct m0_fid_arr *b)
 
M0_INTERNAL bool m0_fid_arr_all_unique (const struct m0_fid_arr *a)
 
struct m0_fid M0_XCA_DOMAIN (conf|rpc)
 
 M0_TL_DESCR_DEFINE (m0_fids, "m0_fid list", M0_INTERNAL, struct m0_fid_item, i_link, i_magic, M0_FID_MAGIC, M0_FID_HEAD_MAGIC)
 
 M0_TL_DEFINE (m0_fids, M0_INTERNAL, struct m0_fid_item)
 
 M0_TL_DESCR_DECLARE (m0_fids, M0_EXTERN)
 
 M0_TL_DECLARE (m0_fids, M0_INTERNAL, struct m0_fid_item)
 

Variables

static const struct m0_fid_typefid_types [256]
 
static const struct m0_fid_type misc
 
static const struct m0_xcode_type_ops xt_ops
 
enum { ... }  M0_XCA_DOMAIN
 

Detailed Description

Macro Definition Documentation

◆ FID_F

#define FID_F   "<%" PRIx64 ":%" PRIx64 ">"

Definition at line 75 of file fid.h.

◆ FID_P

#define FID_P (   f)    (f)->f_container, (f)->f_key

Definition at line 77 of file fid.h.

◆ FID_S

#define FID_S (   f)    &(f)->f_container, &(f)->f_key

Definition at line 78 of file fid.h.

◆ FID_SF

#define FID_SF   " < %" SCNx64 " : %" SCNx64 " > "

Definition at line 76 of file fid.h.

◆ M0_FID0

#define M0_FID0   M0_FID_INIT(0ULL, 0ULL)

Definition at line 93 of file fid.h.

◆ M0_FID_BUF

#define M0_FID_BUF (   fid)
Value:
((struct m0_buf){ \
.b_nob = sizeof *(fid), \
.b_addr = (fid) \
})
void * b_addr
Definition: buf.h:39
struct m0_fid fid
Definition: di.c:46
Definition: buf.h:37

Definition at line 95 of file fid.h.

◆ M0_FID_INIT

#define M0_FID_INIT (   container,
  key 
)
Value:
((struct m0_fid) { \
.f_container = (container), \
.f_key = (key) \
})
struct m0_container container
Definition: fid.h:38
uint64_t f_key
Definition: fid.h:40
Definition: idx_mock.c:47

Definition at line 84 of file fid.h.

◆ M0_FID_TCONTAINER

#define M0_FID_TCONTAINER (   type,
  container 
)
Value:
((((uint64_t)(type)) << (64 - 8)) | \
(((uint64_t)(container)) & M0_FID_TYPE_MASK))
struct m0_container container
int type
Definition: dir.c:1031

Definition at line 80 of file fid.h.

◆ M0_FID_TINIT

#define M0_FID_TINIT (   type,
  container,
  key 
)    M0_FID_INIT(M0_FID_TCONTAINER((type), (container)), (key))

Definition at line 90 of file fid.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_FID_TYPE_MASK 

Clears high 8 bits off.

M0_FID_STR_LEN 

Definition at line 69 of file fid.h.

Function Documentation

◆ fid_sscanf()

static int fid_sscanf ( const char *  s,
struct m0_fid fid,
int *  nob 
)
static

Parses fid string representation.

Three formats are supported:

* CONT:KEY, where CONT and KEY are in sexadecimal.
* <CONT:KEY>, where CONT and KEY are in sexadecimal.

* TYPE|CONT:KEY, where TYPE is a 1-character fid type
  (m0_fid_type::ft_id), CONT is the container sans type and KEY is the
  key (key and container are in %*i format: decimal by default,
  sexadecimal when start with 0x, octal when start with 0).

Definition at line 199 of file fid.c.

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

◆ m0_fid_arr_all_unique()

M0_INTERNAL bool m0_fid_arr_all_unique ( const struct m0_fid_arr a)

Definition at line 327 of file fid.c.

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

◆ m0_fid_arr_copy()

M0_INTERNAL int m0_fid_arr_copy ( struct m0_fid_arr to,
const struct m0_fid_arr from 
)

Definition at line 303 of file fid.c.

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

◆ m0_fid_arr_eq()

M0_INTERNAL bool m0_fid_arr_eq ( const struct m0_fid_arr a,
const struct m0_fid_arr b 
)

Definition at line 319 of file fid.c.

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

◆ m0_fid_cmp()

M0_INTERNAL int m0_fid_cmp ( const struct m0_fid fid0,
const struct m0_fid fid1 
)

Definition at line 170 of file fid.c.

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

◆ m0_fid_eq()

M0_INTERNAL bool m0_fid_eq ( const struct m0_fid fid0,
const struct m0_fid fid1 
)

Definition at line 164 of file fid.c.

◆ m0_fid_fini()

M0_INTERNAL void m0_fid_fini ( void  )

Definition at line 289 of file fid.c.

Here is the call graph for this function:

◆ m0_fid_hash()

M0_INTERNAL uint64_t m0_fid_hash ( const struct m0_fid fid)

Definition at line 295 of file fid.c.

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

◆ m0_fid_init()

M0_INTERNAL int m0_fid_init ( void  )

Definition at line 281 of file fid.c.

Here is the call graph for this function:

◆ m0_fid_is_set()

M0_INTERNAL bool m0_fid_is_set ( const struct m0_fid fid)

Definition at line 106 of file fid.c.

Here is the call graph for this function:

◆ m0_fid_is_valid()

M0_INTERNAL bool m0_fid_is_valid ( const struct m0_fid fid)

Definition at line 96 of file fid.c.

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

◆ m0_fid_print()

M0_INTERNAL int m0_fid_print ( char *  s,
size_t  s_len,
const struct m0_fid fid 
)

Definition at line 233 of file fid.c.

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

◆ m0_fid_set()

M0_INTERNAL void m0_fid_set ( struct m0_fid fid,
uint64_t  container,
uint64_t  key 
)

Definition at line 116 of file fid.c.

◆ m0_fid_sscanf()

M0_INTERNAL int m0_fid_sscanf ( const char *  s,
struct m0_fid fid 
)

Definition at line 227 of file fid.c.

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

◆ m0_fid_tassume()

M0_INTERNAL void m0_fid_tassume ( struct m0_fid fid,
const struct m0_fid_type ft 
)

Definition at line 146 of file fid.c.

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

◆ m0_fid_tchange()

M0_INTERNAL void m0_fid_tchange ( struct m0_fid fid,
uint8_t  tid 
)

Definition at line 139 of file fid.c.

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

◆ m0_fid_tgenerate()

M0_INTERNAL void m0_fid_tgenerate ( struct m0_fid fid,
const uint8_t  tid 
)

Definition at line 155 of file fid.c.

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

◆ m0_fid_tget()

M0_INTERNAL uint8_t m0_fid_tget ( const struct m0_fid fid)

Definition at line 133 of file fid.c.

Here is the caller graph for this function:

◆ m0_fid_tset()

M0_INTERNAL void m0_fid_tset ( struct m0_fid fid,
uint8_t  tid,
uint64_t  container,
uint64_t  key 
)

Definition at line 126 of file fid.c.

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

◆ m0_fid_type_get()

M0_INTERNAL const struct m0_fid_type * m0_fid_type_get ( uint8_t  id)

Definition at line 64 of file fid.c.

Here is the caller graph for this function:

◆ m0_fid_type_getfid()

M0_INTERNAL const struct m0_fid_type * m0_fid_type_getfid ( const struct m0_fid fid)

Definition at line 76 of file fid.c.

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

◆ m0_fid_type_gethi()

M0_INTERNAL const struct m0_fid_type * m0_fid_type_gethi ( uint64_t  id)

Definition at line 70 of file fid.c.

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

◆ m0_fid_type_getname()

M0_INTERNAL const struct m0_fid_type * m0_fid_type_getname ( const char *  name)

Definition at line 81 of file fid.c.

◆ m0_fid_type_register()

M0_INTERNAL void m0_fid_type_register ( const struct m0_fid_type fidt)

Definition at line 46 of file fid.c.

Here is the caller graph for this function:

◆ m0_fid_type_unregister()

M0_INTERNAL void m0_fid_type_unregister ( const struct m0_fid_type fidt)

Definition at line 55 of file fid.c.

Here is the caller graph for this function:

◆ M0_TL_DECLARE()

M0_TL_DECLARE ( m0_fids  ,
M0_INTERNAL  ,
struct m0_fid_item   
)

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( m0_fids  ,
M0_INTERNAL  ,
struct m0_fid_item   
)

◆ M0_TL_DESCR_DECLARE()

M0_TL_DESCR_DECLARE ( m0_fids  ,
M0_EXTERN   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( m0_fids  ,
"m0_fid list ,
M0_INTERNAL  ,
struct m0_fid_item  ,
i_link  ,
i_magic  ,
M0_FID_MAGIC  ,
M0_FID_HEAD_MAGIC   
)

◆ M0_XCA_DOMAIN()

struct m0_fid M0_XCA_DOMAIN ( conf rpc)

◆ xt_read()

static int xt_read ( const struct m0_xcode_cursor it,
struct m0_xcode_obj obj,
const char *  str 
)
static

m0_xcode_type_ops::xto_read() implementation for fids.

Parses fids in xcode-readable strings.

See also
xt_ops, m0_xcode_read().

Definition at line 263 of file fid.c.

Here is the call graph for this function:

Variable Documentation

◆ fid_types

const struct m0_fid_type* fid_types[256]
static

Definition at line 44 of file fid.c.

◆ M0_XCA_DOMAIN

enum { ... } M0_XCA_DOMAIN

◆ misc

const struct m0_fid_type misc
static
Initial value:
= {
.ft_id = 0,
.ft_name = "miscellaneous"
}

Type of miscellaneous fids used in tests, etc.

Definition at line 251 of file fid.c.

◆ xt_ops

const struct m0_xcode_type_ops xt_ops
static
Initial value:
= {
.xto_read = &xt_read
}
static int xt_read(const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
Definition: fid.c:263

xcode operations for fids.

Definition at line 277 of file fid.c.