Motr  M0
Configuration Object Operations (lspec)

Functions

static bool _generic_obj_invariant (const void *bob)
 
static bool _concrete_obj_invariant (const struct m0_conf_obj *obj)
 
 M0_BOB_DEFINE (static, &generic_obj_bob, m0_conf_obj)
 
M0_INTERNAL bool m0_conf_obj_invariant (const struct m0_conf_obj *obj)
 
M0_INTERNAL struct m0_conf_objm0_conf_obj_create (const struct m0_fid *id, struct m0_conf_cache *cache)
 
static int stub_create (struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
 
M0_INTERNAL int m0_conf_obj_find (struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
 
M0_INTERNAL int m0_conf_obj_find_lock (struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
 
M0_INTERNAL void m0_conf_obj_delete (struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_conf_obj_get (struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_conf_obj_get_lock (struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_conf_obj_put (struct m0_conf_obj *obj)
 
static bool confx_obj_is_valid (const struct m0_confx_obj *flat)
 
M0_INTERNAL int m0_conf_obj_fill (struct m0_conf_obj *dest, const struct m0_confx_obj *src)
 
M0_INTERNAL bool m0_conf_obj_match (const struct m0_conf_obj *cached, const struct m0_confx_obj *flat)
 
const struct m0_fidm0_conf_objx_fid (const struct m0_confx_obj *obj)
 
const struct m0_conf_obj_typem0_conf_objx_type (const struct m0_confx_obj *obj)
 

Variables

static const struct m0_bob_type generic_obj_bob
 

Detailed Description

See also
DLD of configuration caching, Logical Specification

Function Documentation

◆ _concrete_obj_invariant()

static bool _concrete_obj_invariant ( const struct m0_conf_obj obj)
static

Definition at line 70 of file obj_ops.c.

Here is the caller graph for this function:

◆ _generic_obj_invariant()

static bool _generic_obj_invariant ( const void *  bob)
static

Definition at line 57 of file obj_ops.c.

Here is the call graph for this function:

◆ confx_obj_is_valid()

static bool confx_obj_is_valid ( const struct m0_confx_obj flat)
static

Performs sanity checking of given m0_confx_obj.

Definition at line 220 of file obj_ops.c.

Here is the caller graph for this function:

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( static  ,
generic_obj_bob,
m0_conf_obj   
)

◆ m0_conf_obj_create()

M0_INTERNAL struct m0_conf_obj* m0_conf_obj_create ( const struct m0_fid id,
struct m0_conf_cache cache 
)

Allocates and initialises configuration object of given type.

Copies ‘id’ into ->co_id of the resulting object.

Note, that m0_conf_obj_create() does not add the resulting object into configuration cache.

Precondition
cache != NULL && m0_fid_is_set(id)
Postcondition
ergo(retval != NULL, retval->co_status == M0_CS_MISSING)

Definition at line 80 of file obj_ops.c.

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

◆ m0_conf_obj_delete()

M0_INTERNAL void m0_conf_obj_delete ( struct m0_conf_obj obj)

Finalises and frees configuration object.

Precondition
obj->co_nrefs == 0 && obj->co_status != M0_CS_LOADING

Definition at line 167 of file obj_ops.c.

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

◆ m0_conf_obj_fill()

M0_INTERNAL int m0_conf_obj_fill ( struct m0_conf_obj dest,
const struct m0_confx_obj src 
)

Enriches a stub with configuration data.

Parameters
destA stub to be filled with configuration data.
srcOn-wire object, providing the configuration data.

Note, that the caller is responsible for passing valid m0_confx_obj via ‘src’ parameter.

Precondition
‘src’ is valid
m0_mutex_is_locked(dest->co_cache->ca_lock)
m0_conf_obj_is_stub(dest) && dest->co_nrefs == 0
m0_conf_obj_type(dest) == m0_conf_objx_type(src)
m0_fid_eq(&dest->co_id, &src->o_id)
Postcondition
m0_conf_obj_invariant(dest)
m0_mutex_is_locked(dest->co_cache->ca_lock)
dest->co_status == (retval == 0 ? M0_CS_READY : M0_CS_MISSING)

Definition at line 232 of file obj_ops.c.

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

◆ m0_conf_obj_find()

M0_INTERNAL int m0_conf_obj_find ( struct m0_conf_cache cache,
const struct m0_fid id,
struct m0_conf_obj **  out 
)

Finds registered object with given identity or, if no object is found, creates and registers a stub.

Precondition
m0_mutex_is_locked(cache->ca_lock)
Postcondition
ergo(retval == 0, m0_conf_obj_invariant(*out) && (*out)->co_cache == cache)

Definition at line 136 of file obj_ops.c.

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

◆ m0_conf_obj_find_lock()

M0_INTERNAL int m0_conf_obj_find_lock ( struct m0_conf_cache cache,
const struct m0_fid id,
struct m0_conf_obj **  out 
)

Definition at line 154 of file obj_ops.c.

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

◆ m0_conf_obj_get()

M0_INTERNAL void m0_conf_obj_get ( struct m0_conf_obj obj)

Increments reference counter of given configuration object.

Precondition
m0_mutex_is_locked(obj->co_cache->ca_lock)
obj->co_status == M0_CS_READY
Postcondition
obj->co_nrefs > 0

Definition at line 186 of file obj_ops.c.

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

◆ m0_conf_obj_get_lock()

M0_INTERNAL void m0_conf_obj_get_lock ( struct m0_conf_obj obj)

Definition at line 198 of file obj_ops.c.

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

◆ m0_conf_obj_invariant()

M0_INTERNAL bool m0_conf_obj_invariant ( const struct m0_conf_obj obj)

Validates given configuration object.

Definition at line 52 of file obj_ops.c.

Here is the call graph for this function:

◆ m0_conf_obj_match()

M0_INTERNAL bool m0_conf_obj_match ( const struct m0_conf_obj cached,
const struct m0_confx_obj flat 
)

Returns false iff cached configuration object and on-wire object have conflicting data.

Note, that the caller is responsible for passing valid m0_confx_obj via ‘flat’ parameter.

Precondition
‘flat’ is valid

Definition at line 254 of file obj_ops.c.

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

◆ m0_conf_obj_put()

M0_INTERNAL void m0_conf_obj_put ( struct m0_conf_obj obj)

Decrements reference counter of given configuration object.

Broadcasts obj->co_chan if the object becomes unpinned (i.e., if the decremented counter reaches 0).

Precondition
m0_mutex_is_locked(obj->co_cache->ca_lock)
obj->co_nrefs > 0 && obj->co_status == M0_CS_READY

Definition at line 205 of file obj_ops.c.

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

◆ m0_conf_objx_fid()

const struct m0_fid* m0_conf_objx_fid ( const struct m0_confx_obj obj)

Definition at line 266 of file obj_ops.c.

Here is the caller graph for this function:

◆ m0_conf_objx_type()

const struct m0_conf_obj_type* m0_conf_objx_type ( const struct m0_confx_obj obj)

Definition at line 271 of file obj_ops.c.

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

◆ stub_create()

static int stub_create ( struct m0_conf_cache cache,
const struct m0_fid id,
struct m0_conf_obj **  out 
)
static

Definition at line 117 of file obj_ops.c.

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

Variable Documentation

◆ generic_obj_bob

const struct m0_bob_type generic_obj_bob
static
Initial value:
= {
.bt_name = "m0_conf_obj",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_conf_obj, co_gen_magic),
.bt_magix = M0_CONF_OBJ_MAGIC,
}
static bool _generic_obj_invariant(const void *bob)
Definition: obj_ops.c:57
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 44 of file obj_ops.c.