Motr  M0
Persistent objects format

Data Structures

struct  m0_format_header
 
struct  m0_format_footer
 
struct  m0_format_tag
 
struct  m0_be_mutex
 
struct  m0_be_rwlock
 
struct  m0_be_clink
 
struct  m0_be_chan
 

Macros

#define M0_BE_MUTEX_PAD   168
 
#define M0_BE_RWLOCK_PAD   144
 
#define M0_BE_CLINK_PAD   sizeof(struct m0_clink)
 

Enumerations

enum  m0_format_type {
  M0_FORMAT_TYPE_BEGIN = 1, M0_FORMAT_TYPE_RPC_PACKET = M0_FORMAT_TYPE_BEGIN, M0_FORMAT_TYPE_RPC_ITEM, M0_FORMAT_TYPE_BE_BTREE,
  M0_FORMAT_TYPE_BE_BNODE, M0_FORMAT_TYPE_BE_EMAP_KEY, M0_FORMAT_TYPE_BE_EMAP_REC, M0_FORMAT_TYPE_BE_EMAP,
  M0_FORMAT_TYPE_BE_LIST, M0_FORMAT_TYPE_BE_SEG_HDR, M0_FORMAT_TYPE_BALLOC, M0_FORMAT_TYPE_ADDB2_FRAME_HEADER,
  M0_FORMAT_TYPE_STOB_AD_0TYPE_REC, M0_FORMAT_TYPE_STOB_AD_DOMAIN, M0_FORMAT_TYPE_COB_DOMAIN, M0_FORMAT_TYPE_COB_NSREC,
  M0_FORMAT_TYPE_BALLOC_GROUP_DESC, M0_FORMAT_TYPE_EXT, M0_FORMAT_TYPE_CAS_INDEX, M0_FORMAT_TYPE_POOLNODE,
  M0_FORMAT_TYPE_POOLDEV, M0_FORMAT_TYPE_POOL_SPARE_USAGE, M0_FORMAT_TYPE_CAS_STATE, M0_FORMAT_TYPE_CAS_CTG,
  M0_FORMAT_TYPE_NR
}
 

Functions

M0_INTERNAL void m0_format_header_pack (struct m0_format_header *dest, const struct m0_format_tag *src)
 
M0_INTERNAL void m0_format_header_unpack (struct m0_format_tag *dest, const struct m0_format_header *src)
 
M0_INTERNAL void m0_format_footer_generate (struct m0_format_footer *footer, const void *buffer, uint32_t size)
 
static int get_footer_from_buf (const void *buffer, const struct m0_format_footer **footer, uint32_t *footer_offset)
 
M0_INTERNAL void m0_format_footer_update (const void *buffer)
 
static void format_iem_post (const char *msg, bool iem)
 
M0_INTERNAL int m0_format_footer_verify_generic (const struct m0_format_footer *footer, const void *buffer, uint32_t size, bool iem)
 
M0_INTERNAL int m0_format_footer_verify (const void *buffer, bool iem)
 
struct m0_format_header M0_XCA_DOMAIN (be|rpc)
 
 M0_BASSERT (M0_FORMAT_TYPE_NR< UINT16_MAX)
 
struct m0_be_mutex M0_XCA_DOMAIN (be)
 
 M0_BASSERT (sizeof(struct m0_mutex)<=sizeof(M0_FIELD_VALUE(struct m0_be_mutex, bm_u.pad)))
 
 M0_BASSERT (sizeof(struct m0_rwlock)<=sizeof(M0_FIELD_VALUE(struct m0_be_rwlock, bl_u.pad)))
 
 M0_BASSERT (sizeof(struct m0_clink)<=sizeof(M0_FIELD_VALUE(struct m0_be_clink, bc_u.pad)))
 

Variables

struct m0_format_tag M0_XCA_DOMAIN
 
enum m0_format_type M0_XCA_ENUM
 

Detailed Description

Macro Definition Documentation

◆ M0_BE_CLINK_PAD

#define M0_BE_CLINK_PAD   sizeof(struct m0_clink)

Definition at line 193 of file format.h.

◆ M0_BE_MUTEX_PAD

#define M0_BE_MUTEX_PAD   168

Definition at line 191 of file format.h.

◆ M0_BE_RWLOCK_PAD

#define M0_BE_RWLOCK_PAD   144

Definition at line 192 of file format.h.

Enumeration Type Documentation

◆ m0_format_type

Format types

Enumerator
M0_FORMAT_TYPE_BEGIN 
M0_FORMAT_TYPE_RPC_PACKET 
M0_FORMAT_TYPE_RPC_ITEM 
M0_FORMAT_TYPE_BE_BTREE 
M0_FORMAT_TYPE_BE_BNODE 
M0_FORMAT_TYPE_BE_EMAP_KEY 
M0_FORMAT_TYPE_BE_EMAP_REC 
M0_FORMAT_TYPE_BE_EMAP 
M0_FORMAT_TYPE_BE_LIST 
M0_FORMAT_TYPE_BE_SEG_HDR 
M0_FORMAT_TYPE_BALLOC 
M0_FORMAT_TYPE_ADDB2_FRAME_HEADER 
M0_FORMAT_TYPE_STOB_AD_0TYPE_REC 
M0_FORMAT_TYPE_STOB_AD_DOMAIN 
M0_FORMAT_TYPE_COB_DOMAIN 
M0_FORMAT_TYPE_COB_NSREC 
M0_FORMAT_TYPE_BALLOC_GROUP_DESC 
M0_FORMAT_TYPE_EXT 
M0_FORMAT_TYPE_CAS_INDEX 
M0_FORMAT_TYPE_POOLNODE 
M0_FORMAT_TYPE_POOLDEV 
M0_FORMAT_TYPE_POOL_SPARE_USAGE 
M0_FORMAT_TYPE_CAS_STATE 
M0_FORMAT_TYPE_CAS_CTG 
M0_FORMAT_TYPE_NR 

Definition at line 82 of file format.h.

Function Documentation

◆ format_iem_post()

static void format_iem_post ( const char *  msg,
bool  iem 
)
static

Definition at line 115 of file format.c.

Here is the caller graph for this function:

◆ get_footer_from_buf()

static int get_footer_from_buf ( const void *  buffer,
const struct m0_format_footer **  footer,
uint32_t *  footer_offset 
)
static

Definition at line 67 of file format.c.

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

◆ M0_BASSERT() [1/4]

M0_BASSERT ( )

◆ M0_BASSERT() [2/4]

M0_BASSERT ( sizeof(struct m0_mutex)<=sizeof(M0_FIELD_VALUE(struct m0_be_mutex, bm_u.pad))  )

◆ M0_BASSERT() [3/4]

M0_BASSERT ( sizeof(struct m0_rwlock)<=sizeof(M0_FIELD_VALUE(struct m0_be_rwlock, bl_u.pad))  )

◆ M0_BASSERT() [4/4]

M0_BASSERT ( sizeof(struct m0_clink)<=sizeof(M0_FIELD_VALUE(struct m0_be_clink, bc_u.pad))  )

◆ m0_format_footer_generate()

M0_INTERNAL void m0_format_footer_generate ( struct m0_format_footer footer,
const void *  buffer,
uint32_t  size 
)

Definition at line 59 of file format.c.

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

◆ m0_format_footer_update()

M0_INTERNAL void m0_format_footer_update ( const void *  buffer)

Updates existing footer in a struct.

Expects a corretcly filled m0_format_header to be present at the beginning of a buffer.

Definition at line 95 of file format.c.

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

◆ m0_format_footer_verify()

M0_INTERNAL int m0_format_footer_verify ( const void *  buffer,
bool  iem 
)

A wrapper around m0_format_footer_verify_generic() for the case when header and footer are contained withing the same parent/container struct.

Parameters
buffer- should point to a struct with m0_format_header and m0_format_footer inside; header should be right at the beginning of the struct; checksum is verified for the header and all other fields in the struct, which come after it but before the footer.
iem- true for metadata operations. false for non metadata operations and tools.

Definition at line 149 of file format.c.

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

◆ m0_format_footer_verify_generic()

M0_INTERNAL int m0_format_footer_verify_generic ( const struct m0_format_footer footer,
const void *  buffer,
uint32_t  size,
bool  iem 
)

Verifies format footer, ensuring that checksum in the footer matches the data. It can be used when header and footer aren't contained within the same parent/container struct

Parameters
footer- actual footer, with original checksum
buffer- beginning of the data for which checksum is calculated
size- size of the data
iem- true for metadata operations. false for non metadata operations and tools.

Definition at line 125 of file format.c.

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

◆ m0_format_header_pack()

M0_INTERNAL void m0_format_header_pack ( struct m0_format_header dest,
const struct m0_format_tag src 
)

Definition at line 40 of file format.c.

Here is the caller graph for this function:

◆ m0_format_header_unpack()

M0_INTERNAL void m0_format_header_unpack ( struct m0_format_tag dest,
const struct m0_format_header src 
)

Definition at line 49 of file format.c.

Here is the caller graph for this function:

◆ M0_XCA_DOMAIN() [1/2]

struct m0_format_header M0_XCA_DOMAIN ( be rpc)

◆ M0_XCA_DOMAIN() [2/2]

struct m0_be_mutex M0_XCA_DOMAIN ( be  )

Variable Documentation

◆ M0_XCA_DOMAIN

struct m0_format_tag M0_XCA_DOMAIN

◆ M0_XCA_ENUM

enum m0_format_type M0_XCA_ENUM