Motr
M0
module.h
Go to the documentation of this file.
1
/* -*- C -*- */
2
/*
3
* Copyright (c) 2014-2020 Seagate Technology LLC and/or its Affiliates
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
* For any questions about this software or licensing,
18
* please email opensource@seagate.com or cortx-questions@seagate.com.
19
*
20
*/
21
22
23
#pragma once
24
#ifndef __MOTR_MODULE_MODULE_H__
25
#define __MOTR_MODULE_MODULE_H__
26
27
struct
m0_module
;
28
106
enum
{
107
M0_MODLEV_NONE
= -1,
108
M0_MODLEV_MAX
= 64,
109
M0_MODDEP_MAX
= 128
110
};
111
113
struct
m0_modlev
{
114
const
char
*
ml_name
;
119
int
(*
ml_enter
)(
struct
m0_module
*module);
121
void (*
ml_leave
)(
struct
m0_module
*module);
122
};
123
131
struct
m0_moddep
{
132
struct
m0_module
*
md_other
;
133
int
md_src
;
134
int
md_dst
;
135
};
136
137
#define M0_MODDEP_INIT(other, src, dst) \
138
{ .md_other = (other), .md_src = (src), .md_dst = (dst) }
139
151
struct
m0_module
{
152
const
char
*
m_name
;
153
struct
m0
*
m_m0
;
160
int
m_cur
;
167
const
struct
m0_modlev
*
m_level
;
168
int
m_level_nr
;
174
unsigned
m_level_nrefs
[
M0_MODLEV_MAX
];
176
struct
m0_moddep
m_dep
[
M0_MODDEP_MAX
];
177
unsigned
m_dep_nr
;
179
struct
m0_moddep
m_inv
[
M0_MODDEP_MAX
];
180
unsigned
m_inv_nr
;
181
};
182
184
struct
m0_module_type
{
186
const
char
*
mt_name
;
199
struct
m0_module
*(*mt_create)(
struct
m0
*
instance
);
200
};
201
208
M0_INTERNAL
int
m0_module_init
(
struct
m0_module
*module,
int
level
);
209
211
M0_INTERNAL
void
m0_module_fini
(
struct
m0_module
*module,
int
level
);
212
214
M0_INTERNAL
void
m0_module_dep_add
(
struct
m0_module
*
m0
,
int
l0,
215
struct
m0_module
*m1,
int
l1);
216
218
M0_INTERNAL
void
m0_module_setup
(
struct
m0_module
*module,
const
char
*
name
,
219
const
struct
m0_modlev
*
level
,
int
level_nr,
220
struct
m0
*
instance
);
221
223
#endif
/* __MOTR_MODULE_MODULE_H__ */
224
225
/*
226
* Local variables:
227
* c-indentation-style: "K&R"
228
* c-basic-offset: 8
229
* tab-width: 8
230
* fill-column: 80
231
* scroll-step: 1
232
* End:
233
*/
234
/*
235
* vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
236
*/
m0_module_type
Definition:
module.h:184
error_injection.int
int
Definition:
error_injection.py:50
level
enum m0_trace_level level
Definition:
trace.c:111
m0_module::m_dep_nr
unsigned m_dep_nr
Definition:
module.h:177
M0_MODLEV_MAX
Definition:
module.h:108
m0_modlev
Definition:
module.h:113
m0_modlev::ml_name
const char * ml_name
Definition:
module.h:114
m0_modlev::ml_leave
void(* ml_leave)(struct m0_module *module)
Definition:
module.h:121
M0_MODDEP_MAX
Definition:
module.h:109
m0_module::m_inv
struct m0_moddep m_inv[M0_MODDEP_MAX]
Definition:
module.h:179
m0_module::m_m0
struct m0 * m_m0
Definition:
module.h:153
m0_module::m_name
const char * m_name
Definition:
module.h:152
m0_module::m_inv_nr
unsigned m_inv_nr
Definition:
module.h:180
name
const char * name
Definition:
trace.c:110
m0_moddep::md_other
struct m0_module * md_other
Definition:
module.h:132
m0_moddep::md_dst
int md_dst
Definition:
module.h:134
m0_module::m_level_nrefs
unsigned m_level_nrefs[M0_MODLEV_MAX]
Definition:
module.h:174
m0_module
Definition:
module.h:151
m0_modlev::ml_enter
int(* ml_enter)(struct m0_module *module)
Definition:
module.h:119
M0_MODLEV_NONE
Definition:
module.h:107
m0_module_setup
M0_INTERNAL void m0_module_setup(struct m0_module *module, const char *name, const struct m0_modlev *level, int level_nr, struct m0 *instance)
Definition:
module.c:193
m0
Definition:
instance.h:80
m0_moddep::md_src
int md_src
Definition:
module.h:133
m0_module::m_level_nr
int m_level_nr
Definition:
module.h:168
m0_module_dep_add
M0_INTERNAL void m0_module_dep_add(struct m0_module *m0, int l0, struct m0_module *m1, int l1)
Definition:
module.c:168
m0_module::m_cur
int m_cur
Definition:
module.h:160
m0_module_type::mt_name
const char * mt_name
Definition:
module.h:186
instance
static struct m0 instance
Definition:
main.c:78
m0_moddep
Definition:
module.h:131
m0_module_fini
M0_INTERNAL void m0_module_fini(struct m0_module *module, int level)
Definition:
module.c:142
m0_module::m_level
const struct m0_modlev * m_level
Definition:
module.h:167
m0_module::m_dep
struct m0_moddep m_dep[M0_MODDEP_MAX]
Definition:
module.h:176
m0_module_init
M0_INTERNAL int m0_module_init(struct m0_module *module, int level)
Definition:
module.c:131
module
module.h
Generated on Thu Apr 14 2022 14:02:54 for Motr by
1.8.14