blob: 39579927ed84b5185e5ae0d87df433722e863a91 [file] [log] [blame]
Thomas Gleixner2522fe42019-05-28 09:57:20 -07001// SPDX-License-Identifier: GPL-2.0-only
David Teiglande7fd4172006-01-18 09:30:29 +00002/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
David Teigland3ae1acf2007-05-18 08:59:31 -05006** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
David Teiglande7fd4172006-01-18 09:30:29 +00007**
David Teiglande7fd4172006-01-18 09:30:29 +00008**
9*******************************************************************************
10******************************************************************************/
11
Paul Gortmaker7963b8a2016-09-19 16:44:50 -040012#include <linux/module.h>
13
David Teiglande7fd4172006-01-18 09:30:29 +000014#include "dlm_internal.h"
15#include "lockspace.h"
16#include "lock.h"
David Teigland597d0ca2006-07-12 16:44:04 -050017#include "user.h"
David Teiglande7fd4172006-01-18 09:30:29 +000018#include "memory.h"
David Teiglande7fd4172006-01-18 09:30:29 +000019#include "config.h"
David Teigland36b71a82012-07-26 12:44:30 -050020#include "lowcomms.h"
David Teiglande7fd4172006-01-18 09:30:29 +000021
David Teiglande7fd4172006-01-18 09:30:29 +000022static int __init init_dlm(void)
23{
24 int error;
25
26 error = dlm_memory_init();
27 if (error)
28 goto out;
29
30 error = dlm_lockspace_init();
31 if (error)
32 goto out_mem;
33
34 error = dlm_config_init();
35 if (error)
36 goto out_lockspace;
37
38 error = dlm_register_debugfs();
39 if (error)
40 goto out_config;
41
David Teigland597d0ca2006-07-12 16:44:04 -050042 error = dlm_user_init();
43 if (error)
Patrick Caulfieldac33d072006-12-06 15:10:37 +000044 goto out_debug;
David Teigland597d0ca2006-07-12 16:44:04 -050045
David Teigland3ae1acf2007-05-18 08:59:31 -050046 error = dlm_netlink_init();
47 if (error)
48 goto out_user;
49
David Teigland24022112008-03-14 15:09:15 -050050 error = dlm_plock_init();
51 if (error)
52 goto out_netlink;
53
Michal Marek75ce4812011-04-01 12:41:20 +020054 printk("DLM installed\n");
David Teiglande7fd4172006-01-18 09:30:29 +000055
56 return 0;
57
David Teigland24022112008-03-14 15:09:15 -050058 out_netlink:
59 dlm_netlink_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050060 out_user:
61 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000062 out_debug:
63 dlm_unregister_debugfs();
64 out_config:
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
74static void __exit exit_dlm(void)
75{
David Teigland24022112008-03-14 15:09:15 -050076 dlm_plock_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050077 dlm_netlink_exit();
David Teigland597d0ca2006-07-12 16:44:04 -050078 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000079 dlm_config_exit();
80 dlm_memory_exit();
81 dlm_lockspace_exit();
David Teigland36b71a82012-07-26 12:44:30 -050082 dlm_lowcomms_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000083 dlm_unregister_debugfs();
84}
85
86module_init(init_dlm);
87module_exit(exit_dlm);
88
89MODULE_DESCRIPTION("Distributed Lock Manager");
90MODULE_AUTHOR("Red Hat, Inc.");
91MODULE_LICENSE("GPL");
92
93EXPORT_SYMBOL_GPL(dlm_new_lockspace);
94EXPORT_SYMBOL_GPL(dlm_release_lockspace);
95EXPORT_SYMBOL_GPL(dlm_lock);
96EXPORT_SYMBOL_GPL(dlm_unlock);
97