blob: a0e7eda643ed415dd337eef0f2813cb1a46c5562 [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
Steven Whitehousee9fc2aa2006-09-01 11:05:15 -04007 * of the GNU General Public License version 2.
David Teigland869d81d2006-01-17 08:47:12 +00008 */
David Teigland29b79982006-01-16 16:52:38 +00009
10#include <linux/init.h>
11
12#include "lock_dlm.h"
13
David Teigland29b79982006-01-16 16:52:38 +000014extern struct lm_lockops gdlm_ops;
15
Adrian Bunk08bc2db2006-04-28 10:59:12 -040016static int __init init_lock_dlm(void)
David Teigland29b79982006-01-16 16:52:38 +000017{
18 int error;
19
David Teigland3120ec52006-08-04 13:14:50 -050020 error = gfs2_register_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000021 if (error) {
Steven Whitehousef3828942006-02-27 12:07:05 -050022 printk(KERN_WARNING "lock_dlm: can't register protocol: %d\n",
23 error);
David Teigland29b79982006-01-16 16:52:38 +000024 return error;
25 }
26
27 error = gdlm_sysfs_init();
28 if (error) {
David Teigland3120ec52006-08-04 13:14:50 -050029 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland869d81d2006-01-17 08:47:12 +000030 return error;
31 }
32
33 error = gdlm_plock_init();
34 if (error) {
35 gdlm_sysfs_exit();
David Teigland3120ec52006-08-04 13:14:50 -050036 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000037 return error;
38 }
39
Steven Whitehousef3828942006-02-27 12:07:05 -050040 printk(KERN_INFO
41 "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
David Teigland29b79982006-01-16 16:52:38 +000042 return 0;
43}
44
Adrian Bunk08bc2db2006-04-28 10:59:12 -040045static void __exit exit_lock_dlm(void)
David Teigland29b79982006-01-16 16:52:38 +000046{
David Teigland869d81d2006-01-17 08:47:12 +000047 gdlm_plock_exit();
David Teigland29b79982006-01-16 16:52:38 +000048 gdlm_sysfs_exit();
David Teigland3120ec52006-08-04 13:14:50 -050049 gfs2_unregister_lockproto(&gdlm_ops);
David Teigland29b79982006-01-16 16:52:38 +000050}
51
52module_init(init_lock_dlm);
53module_exit(exit_lock_dlm);
54
55MODULE_DESCRIPTION("GFS DLM Locking Module");
56MODULE_AUTHOR("Red Hat, Inc.");
57MODULE_LICENSE("GPL");
58