Motr  M0
Configuration Object Operations

Detailed Functional Specification. More...

Data Structures

struct  m0_conf_obj_ops
 

Enumerations

enum  m0_conf_dirval { M0_CONF_DIREND = 0, M0_CONF_DIRNEXT, M0_CONF_DIRMISS }
 

Functions

M0_INTERNAL struct m0_conf_objm0_conf_obj_create (const struct m0_fid *id, struct m0_conf_cache *cache)
 
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 bool m0_conf_obj_invariant (const 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)
 
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)
 

Detailed Description

Detailed Functional Specification.

See also
DLD of configuration caching, Functional Specification

Enumeration Type Documentation

◆ m0_conf_dirval

Symbolic names for m0_conf_obj_ops::coo_readdir() return values.

Enumerator
M0_CONF_DIREND 

End of directory is reached.

M0_CONF_DIRNEXT 

The next directory entry is available immediately.

M0_CONF_DIRMISS 

The next directory entry is missing from configuration cache or is a stub.

Definition at line 64 of file obj_ops.h.

Function Documentation

◆ 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: