blob: afc66a1346d3d1622b973d9dc88caac55df7683e [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
Greg Kroah-Hartmana48f9722019-06-12 17:25:36 +020038 dlm_register_debugfs();
David Teiglande7fd4172006-01-18 09:30:29 +000039
David Teigland597d0ca2006-07-12 16:44:04 -050040 error = dlm_user_init();
41 if (error)
Patrick Caulfieldac33d072006-12-06 15:10:37 +000042 goto out_debug;
David Teigland597d0ca2006-07-12 16:44:04 -050043
David Teigland3ae1acf2007-05-18 08:59:31 -050044 error = dlm_netlink_init();
45 if (error)
46 goto out_user;
47
David Teigland24022112008-03-14 15:09:15 -050048 error = dlm_plock_init();
49 if (error)
50 goto out_netlink;
51
Michal Marek75ce4812011-04-01 12:41:20 +020052 printk("DLM installed\n");
David Teiglande7fd4172006-01-18 09:30:29 +000053
54 return 0;
55
David Teigland24022112008-03-14 15:09:15 -050056 out_netlink:
57 dlm_netlink_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050058 out_user:
59 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000060 out_debug:
61 dlm_unregister_debugfs();
David Teiglande7fd4172006-01-18 09:30:29 +000062 dlm_config_exit();
63 out_lockspace:
64 dlm_lockspace_exit();
65 out_mem:
66 dlm_memory_exit();
67 out:
68 return error;
69}
70
71static void __exit exit_dlm(void)
72{
David Teigland24022112008-03-14 15:09:15 -050073 dlm_plock_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050074 dlm_netlink_exit();
David Teigland597d0ca2006-07-12 16:44:04 -050075 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000076 dlm_config_exit();
77 dlm_memory_exit();
78 dlm_lockspace_exit();
David Teigland36b71a82012-07-26 12:44:30 -050079 dlm_lowcomms_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000080 dlm_unregister_debugfs();
81}
82
83module_init(init_dlm);
84module_exit(exit_dlm);
85
86MODULE_DESCRIPTION("Distributed Lock Manager");
87MODULE_AUTHOR("Red Hat, Inc.");
88MODULE_LICENSE("GPL");
89
90EXPORT_SYMBOL_GPL(dlm_new_lockspace);
91EXPORT_SYMBOL_GPL(dlm_release_lockspace);
92EXPORT_SYMBOL_GPL(dlm_lock);
93EXPORT_SYMBOL_GPL(dlm_unlock);
94