Motr  M0
rm_rwlock.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "fid/fid_xc.h"
#include "xcode/xcode.h"
#include "rm/rm_rwlock.h"
#include "addb2/addb2.h"
Include dependency graph for rm_rwlock.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RM
 
#define R_RW(res)   container_of(res, struct m0_rw_lockable, rwl_resource)
 
#define RW_XO(rw)   (&M0_XCODE_OBJ(m0_fid_xc, (void *)(rw)->rwl_fid))
 
#define CR_XO(cr)   (&M0_XCODE_OBJ(&M0_XT_U64, (void *)&(cr)->cr_datum))
 

Functions

static bool rwlockable_equal (const struct m0_rm_resource *resource0, const struct m0_rm_resource *resource1)
 
static m0_bcount_t rwlockable_len (const struct m0_rm_resource *resource)
 
static int rwlockable_encode (struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource)
 
static int rwlockable_decode (struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource)
 
static void rwlockable_credit_init (struct m0_rm_resource *resource, struct m0_rm_credit *credit)
 
static void rwlockable_resource_free (struct m0_rm_resource *resource)
 
static bool rwlock_cr_intersects (const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
 
static m0_bcount_t rwlock_cr_len (const struct m0_rm_credit *c0)
 
static int rwlock_cr_join (struct m0_rm_credit *self, const struct m0_rm_credit *c1)
 
static int rwlock_cr_disjoin (struct m0_rm_credit *self, const struct m0_rm_credit *c1, struct m0_rm_credit *intersection)
 
static int rwlock_cr_copy (struct m0_rm_credit *dest, const struct m0_rm_credit *self)
 
static int rwlock_cr_diff (struct m0_rm_credit *self, const struct m0_rm_credit *c1)
 
static bool rwlock_cr_conflicts (const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
 
static bool rwlock_cr_is_subset (const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
 
static int rwlock_cr_encode (struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
 
static int rwlock_cr_decode (struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
 
static void rwlock_cr_free (struct m0_rm_credit *self)
 
static void rwlock_cr_initial_capital (struct m0_rm_credit *self)
 
M0_INTERNAL int m0_rwlockable_domain_type_init (struct m0_rm_domain *rwl_dom, struct m0_rm_resource_type *rwl_rt)
 
M0_INTERNAL void m0_rwlockable_domain_type_fini (struct m0_rm_domain *rwl_dom, struct m0_rm_resource_type *rwl_rt)
 
static bool rwlock_credit_invariant (const struct m0_rm_credit *rwlock_cr)
 
M0_INTERNAL void m0_rw_lockable_init (struct m0_rw_lockable *lockable, const struct m0_fid *fid, struct m0_rm_domain *dom)
 
M0_INTERNAL void m0_rw_lockable_fini (struct m0_rw_lockable *lockable)
 
M0_INTERNAL void m0_rm_rwlock_owner_init (struct m0_rm_owner *owner, struct m0_fid *fid, struct m0_rw_lockable *lockable, struct m0_rm_remote *creditor)
 
M0_INTERNAL void m0_rm_rwlock_owner_fini (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_rwlock_req_init (struct m0_rm_incoming *req, struct m0_rm_owner *owner, const struct m0_rm_incoming_ops *ops, enum m0_rm_incoming_flags flags, enum m0_rm_rwlock_req_type type)
 
M0_INTERNAL void m0_rm_rwlock_req_fini (struct m0_rm_incoming *req)
 
M0_INTERNAL int m0_rw_lockable_type_register (struct m0_rm_domain *dom, struct m0_rm_resource_type *rtype)
 
M0_INTERNAL void m0_rw_lockable_type_deregister (struct m0_rm_resource_type *rtype)
 

Variables

const struct m0_rm_resource_type_ops rwlockable_type_ops
 
const struct m0_rm_resource_ops rwlockable_ops
 
const struct m0_rm_credit_ops rwlock_credit_ops
 
const struct m0_fid M0_RWLOCK_FID = M0_FID_TINIT('R', 'W', 'L')
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RM

Definition at line 23 of file rm_rwlock.c.