Motr  M0
module.c File Reference
#include "module/instance.h"
#include "module/param.h"
#include "lib/string.h"
#include "lib/thread.h"
#include "ut/ut.h"
Include dependency graph for module.c:

Go to the source code of this file.

Data Structures

struct  amb
 

Macros

#define ARR_INIT(name)   name, ARRAY_SIZE(name)
 
#define MOD_REC(name, nr_levels)   { (nr_levels), ARR_INIT(dep_ ## name), ARR_INIT(inv_ ## name) }
 

Enumerations

enum  module_id {
  A, B, C, D,
  E, F, G, H,
  I
}
 

Functions

static void _log (char c1, char c2)
 
static int modlev_enter (struct m0_module *module)
 
static void modlev_leave (struct m0_module *module)
 
static void _reset (void)
 
static int cur (enum module_id id)
 
static void _test_module_init (void)
 
static void _test_module_fini (void)
 
static int modlev_a2_enter (struct m0_module *module)
 
static void _test_module_dep_add (void)
 
static void _test_module_fini_all (void)
 
static void foobar_setup (struct m0_module *self, const char *name, struct m0_module *other, bool source)
 
static void amb_setup (struct amb *amb, struct m0_module *bar)
 
static void _test_module_alt_init (void)
 
static void test_module (void)
 
static void inherit (int _)
 
static void test_instance (void)
 
static const char * kv_get (const struct m0_param_source *_, const char *key)
 
static void test_param (void)
 

Variables

static char g_log [32] = ""
 
static struct m0g_instance
 
static struct m0_module modules []
 
static const struct m0_modlev levels []
 
static struct m0_moddep dep_a [] = { }
 
static struct m0_moddep inv_a [] = { M0_MODDEP_INIT(&modules[B], 0, 1) }
 
static struct m0_moddep dep_b []
 
static struct m0_moddep inv_b [] = { M0_MODDEP_INIT(&modules[D], 1, 2) }
 
static struct m0_moddep dep_c [] = { M0_MODDEP_INIT(&modules[D], 0, 2) }
 
static struct m0_moddep inv_c [] = { M0_MODDEP_INIT(&modules[B], 3, 0) }
 
static struct m0_moddep dep_d [] = { M0_MODDEP_INIT(&modules[B], 1, 2) }
 
static struct m0_moddep inv_d [] = { M0_MODDEP_INIT(&modules[C], 0, 2) }
 
static struct m0_moddep dep_e [] = { M0_MODDEP_INIT(&modules[F], 0, 1) }
 
static struct m0_moddep inv_e [0]
 
static struct m0_moddep dep_f []
 
static struct m0_moddep inv_f [] = { M0_MODDEP_INIT(&modules[E], 0, 1) }
 
static struct m0_moddep dep_g [] = { M0_MODDEP_INIT(&modules[H], 0, 0) }
 
static struct m0_moddep inv_g []
 
static struct m0_moddep dep_h [0]
 
static struct m0_moddep inv_h []
 
static struct m0_moddep dep_i []
 
static struct m0_moddep inv_i [] = { M0_MODDEP_INIT(&modules[F], 3, 0) }
 
struct m0_ut_suite module_ut
 

Macro Definition Documentation

◆ ARR_INIT

#define ARR_INIT (   name)    name, ARRAY_SIZE(name)

◆ MOD_REC

#define MOD_REC (   name,
  nr_levels 
)    { (nr_levels), ARR_INIT(dep_ ## name), ARR_INIT(inv_ ## name) }

Enumeration Type Documentation

◆ module_id

enum module_id
Enumerator

Definition at line 67 of file module.c.

Function Documentation

◆ _log()

static void _log ( char  c1,
char  c2 
)
static

Definition at line 32 of file module.c.

Here is the caller graph for this function:

◆ _reset()

static void _reset ( void  )
static

Definition at line 147 of file module.c.

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

◆ _test_module_alt_init()

static void _test_module_alt_init ( void  )
static

Definition at line 368 of file module.c.

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

◆ _test_module_dep_add()

static void _test_module_dep_add ( void  )
static

Definition at line 244 of file module.c.

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

◆ _test_module_fini()

static void _test_module_fini ( void  )
static

Definition at line 222 of file module.c.

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

◆ _test_module_fini_all()

static void _test_module_fini_all ( void  )
static

Definition at line 273 of file module.c.

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

◆ _test_module_init()

static void _test_module_init ( void  )
static

Definition at line 197 of file module.c.

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

◆ amb_setup()

static void amb_setup ( struct amb amb,
struct m0_module bar 
)
static

Definition at line 354 of file module.c.

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

◆ cur()

static int cur ( enum module_id  id)
static

Definition at line 191 of file module.c.

Here is the caller graph for this function:

◆ foobar_setup()

static void foobar_setup ( struct m0_module self,
const char *  name,
struct m0_module other,
bool  source 
)
static

Definition at line 329 of file module.c.

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

◆ inherit()

static void inherit ( int  _)
static

Definition at line 395 of file module.c.

Here is the caller graph for this function:

◆ kv_get()

static const char* kv_get ( const struct m0_param_source _,
const char *  key 
)
static

Definition at line 433 of file module.c.

Here is the caller graph for this function:

◆ modlev_a2_enter()

static int modlev_a2_enter ( struct m0_module module)
static

Definition at line 236 of file module.c.

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

◆ modlev_enter()

static int modlev_enter ( struct m0_module module)
static

Definition at line 43 of file module.c.

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

◆ modlev_leave()

static void modlev_leave ( struct m0_module module)
static

Definition at line 50 of file module.c.

Here is the call graph for this function:

◆ test_instance()

static void test_instance ( void  )
static

Definition at line 415 of file module.c.

Here is the call graph for this function:

◆ test_module()

static void test_module ( void  )
static

Definition at line 386 of file module.c.

Here is the call graph for this function:

◆ test_param()

static void test_param ( void  )
static

Definition at line 451 of file module.c.

Here is the call graph for this function:

Variable Documentation

◆ dep_a

struct m0_moddep dep_a[] = { }
static

Definition at line 93 of file module.c.

◆ dep_b

struct m0_moddep dep_b[]
static
Initial value:
= {
}
static struct m0_module modules[]
Definition: module.c:56
#define M0_MODDEP_INIT(other, src, dst)
Definition: module.h:137
Definition: module.c:67

Definition at line 96 of file module.c.

◆ dep_c

struct m0_moddep dep_c[] = { M0_MODDEP_INIT(&modules[D], 0, 2) }
static

Definition at line 102 of file module.c.

◆ dep_d

struct m0_moddep dep_d[] = { M0_MODDEP_INIT(&modules[B], 1, 2) }
static

Definition at line 105 of file module.c.

◆ dep_e

struct m0_moddep dep_e[] = { M0_MODDEP_INIT(&modules[F], 0, 1) }
static

Definition at line 120 of file module.c.

◆ dep_f

struct m0_moddep dep_f[]
static
Initial value:
= {
}
static struct m0_module modules[]
Definition: module.c:56
#define M0_MODDEP_INIT(other, src, dst)
Definition: module.h:137
Definition: module.c:67

Definition at line 123 of file module.c.

◆ dep_g

struct m0_moddep dep_g[] = { M0_MODDEP_INIT(&modules[H], 0, 0) }
static

Definition at line 129 of file module.c.

◆ dep_h

struct m0_moddep dep_h[0]
static

Definition at line 135 of file module.c.

◆ dep_i

struct m0_moddep dep_i[]
static
Initial value:
= {
}
static struct m0_module modules[]
Definition: module.c:56
#define M0_MODDEP_INIT(other, src, dst)
Definition: module.h:137
Definition: module.c:67

Definition at line 141 of file module.c.

◆ g_instance

struct m0* g_instance
static

Definition at line 30 of file module.c.

◆ g_log

char g_log[32] = ""
static

Definition at line 29 of file module.c.

◆ inv_a

struct m0_moddep inv_a[] = { M0_MODDEP_INIT(&modules[B], 0, 1) }
static

Definition at line 94 of file module.c.

◆ inv_b

struct m0_moddep inv_b[] = { M0_MODDEP_INIT(&modules[D], 1, 2) }
static

Definition at line 100 of file module.c.

◆ inv_c

struct m0_moddep inv_c[] = { M0_MODDEP_INIT(&modules[B], 3, 0) }
static

Definition at line 103 of file module.c.

◆ inv_d

struct m0_moddep inv_d[] = { M0_MODDEP_INIT(&modules[C], 0, 2) }
static

Definition at line 106 of file module.c.

◆ inv_e

struct m0_moddep inv_e[0]
static

Definition at line 121 of file module.c.

◆ inv_f

struct m0_moddep inv_f[] = { M0_MODDEP_INIT(&modules[E], 0, 1) }
static

Definition at line 127 of file module.c.

◆ inv_g

struct m0_moddep inv_g[]
static
Initial value:
= {
}
static struct m0_module modules[]
Definition: module.c:56
#define M0_MODDEP_INIT(other, src, dst)
Definition: module.h:137
Definition: module.c:67

Definition at line 130 of file module.c.

◆ inv_h

struct m0_moddep inv_h[]
static
Initial value:
= {
}
static struct m0_module modules[]
Definition: module.c:56
#define M0_MODDEP_INIT(other, src, dst)
Definition: module.h:137
Definition: module.c:67

Definition at line 136 of file module.c.

◆ inv_i

struct m0_moddep inv_i[] = { M0_MODDEP_INIT(&modules[F], 3, 0) }
static

Definition at line 145 of file module.c.

◆ levels

const struct m0_modlev levels[]
static
Initial value:
= {
{ .ml_enter = modlev_enter, .ml_leave = modlev_leave },
{ .ml_enter = modlev_enter, .ml_leave = modlev_leave },
{ .ml_enter = modlev_enter, .ml_leave = modlev_leave },
{ .ml_enter = modlev_enter, .ml_leave = modlev_leave }
}
static int modlev_enter(struct m0_module *module)
Definition: module.c:43
static void modlev_leave(struct m0_module *module)
Definition: module.c:50

Definition at line 86 of file module.c.

◆ module_ut

struct m0_ut_suite module_ut
Initial value:
= {
.ts_name = "module-ut",
.ts_tests = {
{ "module", test_module },
{ "instance", test_instance },
{ "param", test_param },
{ NULL, NULL }
}
}
#define NULL
Definition: misc.h:38
static void test_param(void)
Definition: module.c:451
static void test_instance(void)
Definition: module.c:415
static void test_module(void)
Definition: module.c:386

Definition at line 467 of file module.c.

◆ modules

struct m0_module modules[]
static
Initial value:
= {
{ .m_name = "a" },
{ .m_name = "b" },
{ .m_name = "c" },
{ .m_name = "d" },
{ .m_name = "e" },
{ .m_name = "f" },
{ .m_name = "g" },
{ .m_name = "h" },
{ .m_name = "i" }
}

Definition at line 56 of file module.c.