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"
31 #include "motr/init.h"
32 #include "motr/version.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;
41 
42 #ifdef CONFIG_AARCH64
43  start_cycle_counter(); /* start reading the cycle counter */
44 #endif
46  pr_info("motr: init\n");
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 {
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 
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  */
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  */
static struct m0_addb2_mach * m
Definition: consumer.c:38
void m0_fini(void)
Definition: init.c:318
#define M0_MOTR_KO_SIZE(module)
Definition: module.h:34
int m0_init(struct m0 *instance)
Definition: init.c:310
M0_INTERNAL void __exit motr_exit(void)
Definition: m0tr_main.c:55
M0_INTERNAL const struct module * m0_motr_ko_get_module(void)
Definition: module.c:28
void m0_build_info_print(void)
Definition: version.c:66
module_init(motr_init)
M0_THREAD_ENTER
Definition: dir.c:336
Definition: instance.h:80
module_exit(motr_exit)
#define M0_MOTR_KO_BASE(module)
Definition: module.h:33
MODULE_LICENSE()
int start_cycle_counter(void)
M0_INTERNAL int __init motr_init(void)
Definition: m0tr_main.c:36
static struct m0 instance
Definition: main.c:78
void finish_cycle_counter(void)