blob: 8e1b618891bee6c997c2d9ebb8149c50db19b863 [file] [log] [blame]
David Teiglande7fd4172006-01-18 09:30:29 +00001/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
David Teigland3ae1acf2007-05-18 08:59:31 -05005** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
David Teiglande7fd4172006-01-18 09:30:29 +00006**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
Paul Gortmaker7963b8a2016-09-19 16:44:50 -040014#include <linux/module.h>
15
David Teiglande7fd4172006-01-18 09:30:29 +000016#include "dlm_internal.h"
17#include "lockspace.h"
18#include "lock.h"
David Teigland597d0ca2006-07-12 16:44:04 -050019#include "user.h"
David Teiglande7fd4172006-01-18 09:30:29 +000020#include "memory.h"
David Teiglande7fd4172006-01-18 09:30:29 +000021#include "config.h"
David Teigland36b71a82012-07-26 12:44:30 -050022#include "lowcomms.h"
David Teiglande7fd4172006-01-18 09:30:29 +000023
David Teiglande7fd4172006-01-18 09:30:29 +000024static int __init init_dlm(void)
25{
26 int error;
27
28 error = dlm_memory_init();
29 if (error)
30 goto out;
31
32 error = dlm_lockspace_init();
33 if (error)
34 goto out_mem;
35
36 error = dlm_config_init();
37 if (error)
38 goto out_lockspace;
39
40 error = dlm_register_debugfs();
41 if (error)
42 goto out_config;
43
David Teigland597d0ca2006-07-12 16:44:04 -050044 error = dlm_user_init();
45 if (error)
Patrick Caulfieldac33d072006-12-06 15:10:37 +000046 goto out_debug;
David Teigland597d0ca2006-07-12 16:44:04 -050047
David Teigland3ae1acf2007-05-18 08:59:31 -050048 error = dlm_netlink_init();
49 if (error)
50 goto out_user;
51
David Teigland24022112008-03-14 15:09:15 -050052 error = dlm_plock_init();
53 if (error)
54 goto out_netlink;
55
Michal Marek75ce4812011-04-01 12:41:20 +020056 printk("DLM installed\n");
David Teiglande7fd4172006-01-18 09:30:29 +000057
58 return 0;
59
David Teigland24022112008-03-14 15:09:15 -050060 out_netlink:
61 dlm_netlink_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050062 out_user:
63 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000064 out_debug:
65 dlm_unregister_debugfs();
66 out_config:
67 dlm_config_exit();
68 out_lockspace:
69 dlm_lockspace_exit();
70 out_mem:
71 dlm_memory_exit();
72 out:
73 return error;
74}
75
76static void __exit exit_dlm(void)
77{
David Teigland24022112008-03-14 15:09:15 -050078 dlm_plock_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050079 dlm_netlink_exit();
David Teigland597d0ca2006-07-12 16:44:04 -050080 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000081 dlm_config_exit();
82 dlm_memory_exit();
83 dlm_lockspace_exit();
David Teigland36b71a82012-07-26 12:44:30 -050084 dlm_lowcomms_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000085 dlm_unregister_debugfs();
86}
87
88module_init(init_dlm);
89module_exit(exit_dlm);
90
91MODULE_DESCRIPTION("Distributed Lock Manager");
92MODULE_AUTHOR("Red Hat, Inc.");
93MODULE_LICENSE("GPL");
94
95EXPORT_SYMBOL_GPL(dlm_new_lockspace);
96EXPORT_SYMBOL_GPL(dlm_release_lockspace);
97EXPORT_SYMBOL_GPL(dlm_lock);
98EXPORT_SYMBOL_GPL(dlm_unlock);
99