1 /* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
4 * Module initialization routines, discover timer
7 #include <linux/hdreg.h>
8 #include <linux/blkdev.h>
9 #include <linux/module.h>
10 #include <linux/skbuff.h>
13 MODULE_LICENSE("GPL");
14 MODULE_AUTHOR("Sam Hopkins <sah@coraid.com>");
15 MODULE_DESCRIPTION("AoE block/char driver for 2.6.2 and newer 2.6 kernels");
16 MODULE_VERSION(VERSION
);
18 static struct timer_list timer
;
19 struct workqueue_struct
*aoe_wq
;
21 static void discover_timer(struct timer_list
*t
)
23 mod_timer(t
, jiffies
+ HZ
* 60); /* one minute */
25 aoecmd_cfg(0xffff, 0xff);
31 del_timer_sync(&timer
);
34 unregister_blkdev(AOE_MAJOR
, DEVICE_NAME
);
38 aoeblk_exit(); /* free cache after de-allocating bufs */
39 destroy_workqueue(aoe_wq
);
47 aoe_wq
= alloc_workqueue("aoe_wq", 0, 0);
66 ret
= register_blkdev(AOE_MAJOR
, DEVICE_NAME
);
68 printk(KERN_ERR
"aoe: can't register major\n");
71 printk(KERN_INFO
"aoe: AoE v%s initialised.\n", VERSION
);
73 timer_setup(&timer
, discover_timer
, 0);
74 discover_timer(&timer
);
87 destroy_workqueue(aoe_wq
);
89 printk(KERN_INFO
"aoe: initialisation failure.\n");
93 module_init(aoe_init
);
94 module_exit(aoe_exit
);