blob: 870a1cd99f5781556822c2dfc24929b4bf1c5778 [file] [log] [blame]
David Teigland869d81d2006-01-17 08:47:12 +00001/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License v.2.
8 */
David Teigland29b79982006-01-16 16:52:38 +00009
10#include <linux/init.h>
11
12#include "lock_dlm.h"
13
14extern int gdlm_drop_count;
15extern int gdlm_drop_period;
16
17extern struct lm_lockops gdlm_ops;
18
Adrian Bunk08bc2db2006-04-28 10:59:12 -040019static int __init init_lock_dlm(void)
David Teigland29b79982006-01-16 16:52:38 +000020{
21 int error;
22
David Teigland3120ec52006-08-04 13:14:50 -050023 error = gfs2_register_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000024 if (error) {
Steven Whitehousef3828942006-02-27 12:07:05 -050025 printk(KERN_WARNING "lock_dlm: can't register protocol: %d\n",
26 error);
David Teigland29b79982006-01-16 16:52:38 +000027 return error;
28 }
29
30 error = gdlm_sysfs_init();
31 if (error) {
David Teigland3120ec52006-08-04 13:14:50 -050032 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland869d81d2006-01-17 08:47:12 +000033 return error;
34 }
35
36 error = gdlm_plock_init();
37 if (error) {
38 gdlm_sysfs_exit();
David Teigland3120ec52006-08-04 13:14:50 -050039 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000040 return error;
41 }
42
43 gdlm_drop_count = GDLM_DROP_COUNT;
44 gdlm_drop_period = GDLM_DROP_PERIOD;
45
Steven Whitehousef3828942006-02-27 12:07:05 -050046 printk(KERN_INFO
47 "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
David Teigland29b79982006-01-16 16:52:38 +000048 return 0;
49}
50
Adrian Bunk08bc2db2006-04-28 10:59:12 -040051static void __exit exit_lock_dlm(void)
David Teigland29b79982006-01-16 16:52:38 +000052{
David Teigland869d81d2006-01-17 08:47:12 +000053 gdlm_plock_exit();
David Teigland29b79982006-01-16 16:52:38 +000054 gdlm_sysfs_exit();
David Teigland3120ec52006-08-04 13:14:50 -050055 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000056}
57
58module_init(init_lock_dlm);
59module_exit(exit_lock_dlm);
60
61MODULE_DESCRIPTION("GFS DLM Locking Module");
62MODULE_AUTHOR("Red Hat, Inc.");
63MODULE_LICENSE("GPL");
64