xref: /openbmc/linux/fs/dlm/main.c (revision f052febd)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /******************************************************************************
3 *******************************************************************************
4 **
5 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
6 **  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
7 **
8 **
9 *******************************************************************************
10 ******************************************************************************/
11 
12 #include <linux/module.h>
13 
14 #include "dlm_internal.h"
15 #include "lockspace.h"
16 #include "lock.h"
17 #include "user.h"
18 #include "memory.h"
19 #include "config.h"
20 #include "lowcomms.h"
21 
22 #define CREATE_TRACE_POINTS
23 #include <trace/events/dlm.h>
24 
25 static int __init init_dlm(void)
26 {
27 	int error;
28 
29 	error = dlm_memory_init();
30 	if (error)
31 		goto out;
32 
33 	error = dlm_lockspace_init();
34 	if (error)
35 		goto out_mem;
36 
37 	error = dlm_config_init();
38 	if (error)
39 		goto out_lockspace;
40 
41 	dlm_register_debugfs();
42 
43 	error = dlm_user_init();
44 	if (error)
45 		goto out_debug;
46 
47 	error = dlm_netlink_init();
48 	if (error)
49 		goto out_user;
50 
51 	error = dlm_plock_init();
52 	if (error)
53 		goto out_netlink;
54 
55 	printk("DLM installed\n");
56 
57 	return 0;
58 
59  out_netlink:
60 	dlm_netlink_exit();
61  out_user:
62 	dlm_user_exit();
63  out_debug:
64 	dlm_unregister_debugfs();
65 	dlm_config_exit();
66  out_lockspace:
67 	dlm_lockspace_exit();
68  out_mem:
69 	dlm_memory_exit();
70  out:
71 	return error;
72 }
73 
74 static void __exit exit_dlm(void)
75 {
76 	dlm_plock_exit();
77 	dlm_netlink_exit();
78 	dlm_user_exit();
79 	dlm_config_exit();
80 	dlm_memory_exit();
81 	dlm_lockspace_exit();
82 	dlm_lowcomms_exit();
83 	dlm_unregister_debugfs();
84 }
85 
86 module_init(init_dlm);
87 module_exit(exit_dlm);
88 
89 MODULE_DESCRIPTION("Distributed Lock Manager");
90 MODULE_AUTHOR("Red Hat, Inc.");
91 MODULE_LICENSE("GPL");
92 
93 EXPORT_SYMBOL_GPL(dlm_new_lockspace);
94 EXPORT_SYMBOL_GPL(dlm_release_lockspace);
95 EXPORT_SYMBOL_GPL(dlm_lock);
96 EXPORT_SYMBOL_GPL(dlm_unlock);
97 
98