Motr
M0
m0ctl_main.c
Go to the documentation of this file.
1
/* -*- C -*- */
2
/*
3
* Copyright (c) 2011-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
24
#include <linux/module.h>
/* MODULE_XXX */
25
#include <linux/init.h>
/* module_init */
26
#include <linux/debugfs.h>
/* debugfs_create_dir */
27
#include <linux/kernel.h>
/* pr_err */
28
29
#include "
lib/thread.h
"
/* M0_THREAD_ENTER */
30
#include "
utils/linux_kernel/m0ctl_internal.h
"
31
#include "
utils/linux_kernel/finject_debugfs.h
"
/* fi_dfs_init */
32
#include "
utils/linux_kernel/trace_debugfs.h
"
/* trc_dfs_init */
33
#include "
utils/linux_kernel/core_debugfs.h
"
/* core_dfs_init */
34
48
#if 0
49
struct
dentry
*
dfs_root_dir
;
50
const
char
dfs_root_name
[] =
"motr"
;
51
52
int
dfs_init(
void
)
53
{
54
int
rc
;
55
56
pr_info(KBUILD_MODNAME
": init\n"
);
57
58
/* create motr's main debugfs directory */
59
dfs_root_dir
= debugfs_create_dir(
dfs_root_name
,
NULL
);
60
if
(
dfs_root_dir
==
NULL
) {
61
pr_err(KBUILD_MODNAME
": failed to create debugfs dir '%s'\n"
,
62
dfs_root_name
);
63
return
-EPERM;
64
}
65
66
rc
=
fi_dfs_init
();
67
if
(
rc
!= 0)
68
goto
err;
69
70
rc
=
trc_dfs_init
();
71
if
(
rc
!= 0)
72
goto
err;
73
74
rc
=
core_dfs_init
();
75
if
(
rc
!= 0)
76
goto
err;
77
78
return
0;
79
err:
80
debugfs_remove_recursive(
dfs_root_dir
);
81
dfs_root_dir
= 0;
82
return
rc
;
83
}
84
85
void
dfs_cleanup(
void
)
86
{
87
pr_info(KBUILD_MODNAME
": cleanup\n"
);
88
89
core_dfs_cleanup
();
90
trc_dfs_cleanup
();
91
fi_dfs_cleanup
();
92
93
/*
94
* remove all orphaned debugfs files (if any) and motr's debugfs root
95
* directroy itself
96
*/
97
if
(
dfs_root_dir
!= 0) {
98
debugfs_remove_recursive(
dfs_root_dir
);
99
dfs_root_dir
= 0;
100
}
101
}
102
103
int
__init
m0ctl_init
(
void
)
104
{
105
M0_THREAD_ENTER
;
106
return
dfs_init();
107
}
108
109
void
__exit
m0ctl_exit
(
void
)
110
{
111
M0_THREAD_ENTER
;
112
dfs_cleanup();
113
}
114
115
#endif
116
117
int
__init
m0ctl_init
(
void
)
118
{
119
return
0;
120
}
121
122
void
__exit
m0ctl_exit
(
void
)
123
{
124
}
125
126
module_init
(
m0ctl_init
);
127
module_exit
(
m0ctl_exit
);
128
129
/*
130
* Local variables:
131
* c-indentation-style: "K&R"
132
* c-basic-offset: 8
133
* tab-width: 8
134
* fill-column: 80
135
* scroll-step: 1
136
* End:
137
*/
NULL
#define NULL
Definition:
misc.h:38
dfs_root_dir
struct dentry * dfs_root_dir
trace_debugfs.h
trc_dfs_init
int trc_dfs_init(void)
m0ctl_init
int __init m0ctl_init(void)
Definition:
m0ctl_main.c:117
core_dfs_init
int core_dfs_init(void)
fi_dfs_cleanup
void fi_dfs_cleanup(void)
Definition:
finject_debugfs.c:423
finject_debugfs.h
thread.h
trc_dfs_cleanup
void trc_dfs_cleanup(void)
dentry
static int struct dentry * dentry
Definition:
dir.c:589
M0_THREAD_ENTER
M0_THREAD_ENTER
Definition:
dir.c:336
module_init
module_init(m0ctl_init)
fi_dfs_init
int fi_dfs_init(void)
Definition:
finject_debugfs.c:416
module_exit
module_exit(m0ctl_exit)
m0ctl_exit
void __exit m0ctl_exit(void)
Definition:
m0ctl_main.c:122
m0ctl_internal.h
dfs_root_name
const char dfs_root_name[]
core_dfs_cleanup
void core_dfs_cleanup(void)
core_debugfs.h
rc
int32_t rc
Definition:
trigger_fop.h:47
utils
linux_kernel
m0ctl_main.c
Generated on Thu Apr 14 2022 14:03:01 for Motr by
1.8.14