Motr  M0
rings.c File Reference
#include "lib/finject.h"
#include "lib/mutex.h"
#include "lib/list.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "lib/misc.h"
#include "lib/chan.h"
#include "lib/vec.h"
#include "fid/fid.h"
#include "xcode/xcode.h"
#include "ut/ut.h"
#include "rm/rm.h"
#include "rm/ut/rings.h"
Include dependency graph for rings.c:

Go to the source code of this file.

Functions

static void rings_policy (struct m0_rm_resource *resource, struct m0_rm_incoming *in)
 
static void rings_credit_init (struct m0_rm_resource *resource, struct m0_rm_credit *credit)
 
void rings_resource_free (struct m0_rm_resource *resource)
 
static bool rings_resources_are_equal (const struct m0_rm_resource *c0, const struct m0_rm_resource *c1)
 
static bool rings_resource_is (const struct m0_rm_resource *res, uint64_t res_id)
 
static m0_bcount_t rings_resource_len (const struct m0_rm_resource *resource)
 
static int rings_resource_encode (struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource)
 
static int rings_resource_decode (struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource)
 
static bool rings_credit_intersects (const struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static int rings_credit_join (struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static int rings_credit_diff (struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static void rings_credit_free (struct m0_rm_credit *credit)
 
static int rings_credit_encdec (struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
 
static int rings_credit_encode (struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur)
 
static int rings_credit_decode (struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur)
 
static int rings_credit_copy (struct m0_rm_credit *dest, const struct m0_rm_credit *src)
 
static void rings_initial_capital (struct m0_rm_credit *self)
 
static m0_bcount_t rings_credit_len (const struct m0_rm_credit *credit)
 
static bool rings_is_subset (const struct m0_rm_credit *src, const struct m0_rm_credit *dest)
 
static int rings_disjoin (struct m0_rm_credit *src, const struct m0_rm_credit *dest, struct m0_rm_credit *intersection)
 
static bool rings_conflicts (const struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static void rings_incoming_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void rings_incoming_conflict (struct m0_rm_incoming *in)
 
static void rings_rtype_set (struct rm_ut_data *self)
 
static void rings_rtype_unset (struct rm_ut_data *self)
 
static void rings_res_set (struct rm_ut_data *self)
 
static void rings_res_unset (struct rm_ut_data *self)
 
static void rings_owner_set (struct rm_ut_data *self)
 
static void rings_owner_unset (struct rm_ut_data *self)
 
static void rings_datum_set (struct rm_ut_data *self)
 
void rings_utdata_ops_set (struct rm_ut_data *data)
 

Variables

struct m0_rm_resource_type rings_resource_type
 
const struct m0_rm_resource_ops rings_ops
 
const struct m0_rm_resource_type_ops rings_rtype_ops
 
const struct m0_rm_credit_ops rings_credit_ops
 
const struct m0_rm_incoming_ops rings_incoming_ops
 
static const struct rm_ut_data_ops rings_ut_data_ops
 

Function Documentation

◆ rings_conflicts()

static bool rings_conflicts ( const struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 259 of file rings.c.

◆ rings_credit_copy()

static int rings_credit_copy ( struct m0_rm_credit dest,
const struct m0_rm_credit src 
)
static

Definition at line 210 of file rings.c.

◆ rings_credit_decode()

static int rings_credit_decode ( struct m0_rm_credit credit,
struct m0_bufvec_cursor cur 
)
static

Definition at line 204 of file rings.c.

Here is the call graph for this function:

◆ rings_credit_diff()

static int rings_credit_diff ( struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 173 of file rings.c.

◆ rings_credit_encdec()

static int rings_credit_encdec ( struct m0_rm_credit credit,
struct m0_bufvec_cursor cur,
enum m0_xcode_what  what 
)
static

Definition at line 190 of file rings.c.

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

◆ rings_credit_encode()

static int rings_credit_encode ( struct m0_rm_credit credit,
struct m0_bufvec_cursor cur 
)
static

Definition at line 198 of file rings.c.

Here is the call graph for this function:

◆ rings_credit_free()

static void rings_credit_free ( struct m0_rm_credit credit)
static

Definition at line 185 of file rings.c.

◆ rings_credit_init()

static void rings_credit_init ( struct m0_rm_resource resource,
struct m0_rm_credit credit 
)
static

Definition at line 72 of file rings.c.

◆ rings_credit_intersects()

static bool rings_credit_intersects ( const struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 157 of file rings.c.

◆ rings_credit_join()

static int rings_credit_join ( struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 165 of file rings.c.

◆ rings_credit_len()

static m0_bcount_t rings_credit_len ( const struct m0_rm_credit credit)
static

Definition at line 228 of file rings.c.

Here is the call graph for this function:

◆ rings_datum_set()

static void rings_datum_set ( struct rm_ut_data self)
static

Definition at line 360 of file rings.c.

◆ rings_disjoin()

static int rings_disjoin ( struct m0_rm_credit src,
const struct m0_rm_credit dest,
struct m0_rm_credit intersection 
)
static

Definition at line 248 of file rings.c.

◆ rings_incoming_complete()

static void rings_incoming_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 287 of file rings.c.

◆ rings_incoming_conflict()

static void rings_incoming_conflict ( struct m0_rm_incoming in)
static

Definition at line 292 of file rings.c.

◆ rings_initial_capital()

static void rings_initial_capital ( struct m0_rm_credit self)
static

Definition at line 222 of file rings.c.

◆ rings_is_subset()

static bool rings_is_subset ( const struct m0_rm_credit src,
const struct m0_rm_credit dest 
)
static

Definition at line 239 of file rings.c.

◆ rings_owner_set()

static void rings_owner_set ( struct rm_ut_data self)
static

Definition at line 342 of file rings.c.

Here is the call graph for this function:

◆ rings_owner_unset()

static void rings_owner_unset ( struct rm_ut_data self)
static

Definition at line 354 of file rings.c.

Here is the call graph for this function:

◆ rings_policy()

static void rings_policy ( struct m0_rm_resource resource,
struct m0_rm_incoming in 
)
static

Definition at line 42 of file rings.c.

◆ rings_res_set()

static void rings_res_set ( struct rm_ut_data self)
static

Definition at line 321 of file rings.c.

Here is the call graph for this function:

◆ rings_res_unset()

static void rings_res_unset ( struct rm_ut_data self)
static

Definition at line 332 of file rings.c.

Here is the call graph for this function:

◆ rings_resource_decode()

static int rings_resource_decode ( struct m0_bufvec_cursor cur,
struct m0_rm_resource **  resource 
)
static

Definition at line 128 of file rings.c.

Here is the call graph for this function:

◆ rings_resource_encode()

static int rings_resource_encode ( struct m0_bufvec_cursor cur,
const struct m0_rm_resource resource 
)
static

Definition at line 115 of file rings.c.

Here is the call graph for this function:

◆ rings_resource_free()

void rings_resource_free ( struct m0_rm_resource resource)

Definition at line 79 of file rings.c.

Here is the call graph for this function:

◆ rings_resource_is()

static bool rings_resource_is ( const struct m0_rm_resource res,
uint64_t  res_id 
)
static

Definition at line 100 of file rings.c.

◆ rings_resource_len()

static m0_bcount_t rings_resource_len ( const struct m0_rm_resource resource)
static

Definition at line 109 of file rings.c.

◆ rings_resources_are_equal()

static bool rings_resources_are_equal ( const struct m0_rm_resource c0,
const struct m0_rm_resource c1 
)
static

Definition at line 94 of file rings.c.

◆ rings_rtype_set()

static void rings_rtype_set ( struct rm_ut_data self)
static

Definition at line 301 of file rings.c.

Here is the call graph for this function:

◆ rings_rtype_unset()

static void rings_rtype_unset ( struct rm_ut_data self)
static

Definition at line 315 of file rings.c.

Here is the call graph for this function:

◆ rings_utdata_ops_set()

void rings_utdata_ops_set ( struct rm_ut_data data)

Definition at line 375 of file rings.c.

Here is the caller graph for this function:

Variable Documentation

◆ rings_credit_ops

const struct m0_rm_credit_ops rings_credit_ops
Initial value:
= {
.cro_intersects = rings_credit_intersects,
.cro_join = rings_credit_join,
.cro_diff = rings_credit_diff,
.cro_copy = rings_credit_copy,
.cro_free = rings_credit_free,
.cro_encode = rings_credit_encode,
.cro_decode = rings_credit_decode,
.cro_len = rings_credit_len,
.cro_is_subset = rings_is_subset,
.cro_disjoin = rings_disjoin,
.cro_conflicts = rings_conflicts,
.cro_initial_capital = rings_initial_capital,
}
static int rings_credit_decode(struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur)
Definition: rings.c:204
static bool rings_conflicts(const struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
Definition: rings.c:259
static int rings_credit_join(struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
Definition: rings.c:165
static int rings_credit_diff(struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
Definition: rings.c:173
static void rings_initial_capital(struct m0_rm_credit *self)
Definition: rings.c:222
static bool rings_credit_intersects(const struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
Definition: rings.c:157
static m0_bcount_t rings_credit_len(const struct m0_rm_credit *credit)
Definition: rings.c:228
static int rings_credit_encode(struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur)
Definition: rings.c:198
static void rings_credit_free(struct m0_rm_credit *credit)
Definition: rings.c:185
static int rings_disjoin(struct m0_rm_credit *src, const struct m0_rm_credit *dest, struct m0_rm_credit *intersection)
Definition: rings.c:248
static bool rings_is_subset(const struct m0_rm_credit *src, const struct m0_rm_credit *dest)
Definition: rings.c:239
static int rings_credit_copy(struct m0_rm_credit *dest, const struct m0_rm_credit *src)
Definition: rings.c:210

Definition at line 272 of file rings.c.

◆ rings_incoming_ops

const struct m0_rm_incoming_ops rings_incoming_ops
Initial value:
= {
.rio_complete = rings_incoming_complete,
.rio_conflict = rings_incoming_conflict
}
static void rings_incoming_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rings.c:287
static void rings_incoming_conflict(struct m0_rm_incoming *in)
Definition: rings.c:292

Definition at line 296 of file rings.c.

◆ rings_ops

const struct m0_rm_resource_ops rings_ops
Initial value:
= {
.rop_credit_decode = NULL,
.rop_policy = rings_policy,
.rop_credit_init = rings_credit_init,
.rop_resource_free = rings_resource_free,
}
#define NULL
Definition: misc.h:38
static void rings_policy(struct m0_rm_resource *resource, struct m0_rm_incoming *in)
Definition: rings.c:42
static void rings_credit_init(struct m0_rm_resource *resource, struct m0_rm_credit *credit)
Definition: rings.c:72
void rings_resource_free(struct m0_rm_resource *resource)
Definition: rings.c:79

Definition at line 87 of file rings.c.

◆ rings_resource_type

struct m0_rm_resource_type rings_resource_type
Initial value:
= {
.rt_name = "Rings of Power",
}

Definition at line 37 of file rings.c.

◆ rings_rtype_ops

const struct m0_rm_resource_type_ops rings_rtype_ops
Initial value:
= {
.rto_is = rings_resource_is,
.rto_len = rings_resource_len,
.rto_encode = rings_resource_encode,
.rto_decode = rings_resource_decode
}
static bool rings_resources_are_equal(const struct m0_rm_resource *c0, const struct m0_rm_resource *c1)
Definition: rings.c:94
static m0_bcount_t rings_resource_len(const struct m0_rm_resource *resource)
Definition: rings.c:109
static bool rings_resource_is(const struct m0_rm_resource *res, uint64_t res_id)
Definition: rings.c:100
static int rings_resource_encode(struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource)
Definition: rings.c:115
static int rings_resource_decode(struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource)
Definition: rings.c:128

Definition at line 149 of file rings.c.

◆ rings_ut_data_ops

const struct rm_ut_data_ops rings_ut_data_ops
static
Initial value:
= {
.rtype_set = rings_rtype_set,
.rtype_unset = rings_rtype_unset,
.resource_set = rings_res_set,
.resource_unset = rings_res_unset,
.owner_set = rings_owner_set,
.owner_unset = rings_owner_unset,
.credit_datum_set = rings_datum_set
}
static void rings_owner_set(struct rm_ut_data *self)
Definition: rings.c:342
static void rings_datum_set(struct rm_ut_data *self)
Definition: rings.c:360
static void rings_owner_unset(struct rm_ut_data *self)
Definition: rings.c:354
static void rings_res_unset(struct rm_ut_data *self)
Definition: rings.c:332
static void rings_rtype_set(struct rm_ut_data *self)
Definition: rings.c:301
static void rings_rtype_unset(struct rm_ut_data *self)
Definition: rings.c:315
static void rings_res_set(struct rm_ut_data *self)
Definition: rings.c:321

Definition at line 365 of file rings.c.