Motr
M0
m0tr_main.c
Go to the documentation of this file.
1
/* -*- C -*- */
2
/*
3
* Copyright (c) 2012-2021 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
#include <linux/kernel.h>
/* printk */
24
#include <linux/module.h>
/* THIS_MODULE */
25
#include <linux/init.h>
/* module_init */
26
#include <linux/version.h>
27
28
#include "
lib/list.h
"
29
#include "
lib/thread.h
"
30
#include "
lib/linux_kernel/aarch64_cycle_counter.h
"
31
#include "
motr/init.h
"
32
#include "
motr/version.h
"
33
#include "
motr/linux_kernel/module.h
"
34
#include "
module/instance.h
"
/* m0 */
35
36
M0_INTERNAL
int
__init
motr_init
(
void
)
37
{
38
static
struct
m0
instance
;
39
const
struct
module *
m
;
40
M0_THREAD_ENTER
;
41
42
#ifdef CONFIG_AARCH64
43
start_cycle_counter
();
/* start reading the cycle counter */
44
#endif
45
m
=
m0_motr_ko_get_module
();
46
pr_info(
"motr: init\n"
);
47
m0_build_info_print
();
48
pr_info(
"motr: module address: 0x%p\n"
,
m
);
49
pr_info(
"motr: module core address: 0x%p\n"
,
M0_MOTR_KO_BASE
(
m
));
50
pr_info(
"motr: module core size: %u\n"
,
M0_MOTR_KO_SIZE
(
m
));
51
52
return
m0_init
(&
instance
);
53
}
54
55
M0_INTERNAL
void
__exit
motr_exit
(
void
)
56
{
57
M0_THREAD_ENTER
;
58
pr_info(
"motr: cleanup\n"
);
59
#ifdef CONFIG_AARCH64
60
finish_cycle_counter
();
/* stop reading the cycle counter */
61
#endif
62
m0_fini
();
63
}
64
65
module_init
(
motr_init
);
66
module_exit
(
motr_exit
);
67
68
/*
69
* We are using Apache license for complete motr code but for MODULE_LICENSE
70
* marker there is no provision to mention Apache for this marker. But as this
71
* marker is necessary to remove the warnings, keeping this blank to make
72
* compiler happy.
73
*/
74
MODULE_LICENSE
();
75
76
/*
77
* Local variables:
78
* c-indentation-style: "K&R"
79
* c-basic-offset: 8
80
* tab-width: 8
81
* fill-column: 80
82
* scroll-step: 1
83
* End:
84
*/
85
/*
86
* vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
87
*/
m
static struct m0_addb2_mach * m
Definition:
consumer.c:38
m0_fini
void m0_fini(void)
Definition:
init.c:318
M0_MOTR_KO_SIZE
#define M0_MOTR_KO_SIZE(module)
Definition:
module.h:34
m0_init
int m0_init(struct m0 *instance)
Definition:
init.c:310
init.h
motr_exit
M0_INTERNAL void __exit motr_exit(void)
Definition:
m0tr_main.c:55
m0_motr_ko_get_module
M0_INTERNAL const struct module * m0_motr_ko_get_module(void)
Definition:
module.c:28
m0_build_info_print
void m0_build_info_print(void)
Definition:
version.c:66
thread.h
list.h
module_init
module_init(motr_init)
M0_THREAD_ENTER
M0_THREAD_ENTER
Definition:
dir.c:336
m0
Definition:
instance.h:80
aarch64_cycle_counter.h
instance.h
module_exit
module_exit(motr_exit)
version.h
M0_MOTR_KO_BASE
#define M0_MOTR_KO_BASE(module)
Definition:
module.h:33
MODULE_LICENSE
MODULE_LICENSE()
start_cycle_counter
int start_cycle_counter(void)
module.h
motr_init
M0_INTERNAL int __init motr_init(void)
Definition:
m0tr_main.c:36
instance
static struct m0 instance
Definition:
main.c:78
finish_cycle_counter
void finish_cycle_counter(void)
motr
linux_kernel
m0tr_main.c
Generated on Thu Apr 14 2022 14:02:57 for Motr by
1.8.14