Motr  M0
helpers.h File Reference
#include "helpers/ufid.h"
Include dependency graph for helpers.h:

Go to the source code of this file.

Macros

#define __MOTR_HELPERS_HELPERS_H__
 

Functions

M0_INTERNAL int m0_ufid_init (struct m0_client *m0c, struct m0_ufid_generator *gr)
 
M0_INTERNAL void m0_ufid_fini (struct m0_ufid_generator *gr)
 
int m0_ufid_new (struct m0_ufid_generator *gr, uint32_t nr_ids, uint32_t nr_skip_ids, struct m0_uint128 *id128)
 
int m0_ufid_next (struct m0_ufid_generator *gr, uint32_t nr_ids, struct m0_uint128 *id128)
 

Macro Definition Documentation

◆ __MOTR_HELPERS_HELPERS_H__

#define __MOTR_HELPERS_HELPERS_H__

Definition at line 25 of file helpers.h.

Function Documentation

◆ m0_ufid_fini()

M0_INTERNAL void m0_ufid_fini ( struct m0_ufid_generator gr)

Finalises Unique File/object ID (UFID) generator.

Parameters
grThe UFID generator to be finalised.

Definition at line 283 of file ufid.c.

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

◆ m0_ufid_init()

M0_INTERNAL int m0_ufid_init ( struct m0_client m0c,
struct m0_ufid_generator gr 
)

Initialises Unique File/object ID (UFID) generator.

Parameters
m0cThe Client instance contains required process FID.
grThe UFID generator to be initialised.
Returns
Returns 0 on success. Negative errno in case of error.

Definition at line 248 of file ufid.c.

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

◆ m0_ufid_new()

int m0_ufid_new ( struct m0_ufid_generator gr,
uint32_t  nr_ids,
uint32_t  nr_skip_ids,
struct m0_uint128 id128 
)

Primary interface to obtain one or more unique file/object IDs of 128 bits.

m0_ufid_new() obtains new FID range which is unique across nodes/processes.

Input Params:

Parameters
grPointer to an UFID generator.
nr_idsNumber of IDs that should be allocated. nr_ids value cannot be greater than (2^20-1).
nr_skip_idsNumber of FIDs to skip. It invalidates nr_skip_ids ID range and cannot be greater than (2^20-1).
id128[Output]Starting ID of generated range.
Returns
Returns 0 on success. Negative errno in case of error.

Error Values: -EINVAL In case of errors in parameters. -ETIME In case clock errors are detected. -EPERM In case module is not initialized before invoking this interface.

Definition at line 298 of file ufid.c.

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

◆ m0_ufid_next()

int m0_ufid_next ( struct m0_ufid_generator gr,
uint32_t  nr_ids,
struct m0_uint128 id128 
)

m0_ufid_next() is a simple wrapper of m0_ufid_new() which always tries to allocate FID range starting from current available FID.

See also
m0_ufid_new() above for argument descriptions.

Definition at line 338 of file ufid.c.

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