Motr  M0
UUID support

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB
 
#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB
 

Enumerations

enum  { MACHINE_ID_LEN = 32 }
 
enum  { M0_UUID_STRLEN = 36 }
 

Functions

 module_param (node_uuid, charp, S_IRUGO)
 
 MODULE_PARM_DESC (node_uuid, "UUID of Motr node")
 
static const char * m0_param_node_uuid_get (void)
 
int m0_node_uuid_string_get (char buf[M0_UUID_STRLEN+1])
 
void m0_kmod_uuid_file_set (const char *path)
 
void m0_node_uuid_string_set (const char *uuid)
 
M0_INTERNAL int m0_uuid_parse (const char *str, struct m0_uint128 *val)
 
M0_INTERNAL void m0_uuid_format (const struct m0_uint128 *val, char *buf, size_t len)
 
M0_INTERNAL void m0_uuid_generate (struct m0_uint128 *u)
 

Variables

static char * node_uuid = "00000000-0000-0000-0000-000000000000"
 
static const char * uuid_file = "/etc/machine-id"
 
static char default_node_uuid [M0_UUID_STRLEN+1]
 
static bool use_default_node_uuid = false
 
M0_EXTERN struct m0_uint128 m0_node_uuid
 

Detailed Description

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM [1/2]

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB

Definition at line 30 of file uuuid.c.

◆ M0_TRACE_SUBSYSTEM [2/2]

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_LIB

Definition at line 32 of file kuuid.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MACHINE_ID_LEN 

Definition at line 39 of file uuuid.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_UUID_STRLEN 

Definition at line 35 of file uuid.h.

Function Documentation

◆ m0_kmod_uuid_file_set()

void m0_kmod_uuid_file_set ( const char *  path)

Definition at line 59 of file uuuid.c.

Here is the caller graph for this function:

◆ m0_node_uuid_string_get()

int m0_node_uuid_string_get ( char  buf[M0_UUID_STRLEN+1])

Construct the node uuid from the kernel's node_uuid parameter.

Constructs the node UUID in user space by reading our kernel module's node_uuid parameter.

Definition at line 51 of file kuuid.c.

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

◆ m0_node_uuid_string_set()

void m0_node_uuid_string_set ( const char *  uuid)

Definition at line 64 of file uuuid.c.

Here is the caller graph for this function:

◆ m0_param_node_uuid_get()

static const char* m0_param_node_uuid_get ( void  )
static

Return the value of the kernel node_uuid parameter.

Definition at line 43 of file kuuid.c.

Here is the caller graph for this function:

◆ m0_uuid_format()

M0_INTERNAL void m0_uuid_format ( const struct m0_uint128 val,
char *  buf,
size_t  len 
)

Produce the 8-4-4-4-12 hexadecimal string representation of a UUID from its numerical form. See Universally unique identifier for more details.

Parameters
valThe numerical UUID.
bufString buffer.
lenLength of the buffer. It must be at least M0_UUID_STRLEN+1 bytes long.

Definition at line 107 of file uuid.c.

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

◆ m0_uuid_generate()

M0_INTERNAL void m0_uuid_generate ( struct m0_uint128 u)

Definition at line 44 of file uuid.c.

Here is the caller graph for this function:

◆ m0_uuid_parse()

M0_INTERNAL int m0_uuid_parse ( const char *  str,
struct m0_uint128 val 
)

Parse the 8-4-4-4-12 hexadecimal string representation of a UUID and convert to numerical form. See Universally unique identifier for more details.

Definition at line 77 of file uuid.c.

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

◆ module_param()

module_param ( node_uuid  ,
charp  ,
S_IRUGO   
)

◆ MODULE_PARM_DESC()

MODULE_PARM_DESC ( node_uuid  ,
"UUID of Motr node  
)

Variable Documentation

◆ default_node_uuid

char default_node_uuid[M0_UUID_STRLEN+1]
static
Initial value:
=
"00000000-0000-0000-0000-000000000000"

Default node uuid which can be used instead of a "real" one, which is obtained from kernel module; this can be handy for some utility applications which don't need full functionality of libmotr.so, so they can provide some fake uuid.

Definition at line 53 of file uuuid.c.

◆ m0_node_uuid

M0_EXTERN struct m0_uint128 m0_node_uuid

The UUID of a Motr node.

Definition at line 65 of file uuid.h.

◆ node_uuid

char* node_uuid = "00000000-0000-0000-0000-000000000000"
static

Definition at line 36 of file kuuid.c.

◆ use_default_node_uuid

bool use_default_node_uuid = false
static

Flag, which specify whether to use a "real" node uuid or a default one.

Definition at line 57 of file uuuid.c.

◆ uuid_file

const char* uuid_file = "/etc/machine-id"
static

The default path to read node uuid parameter is "etc/machine-id". It can be updated in the function m0_kmod_uuid_file_set().

Definition at line 46 of file uuuid.c.