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 enum { TINIT, TRUN, TKILL };
21 discover_timer(ulong vp)
23 static struct timer_list t;
24 static volatile ulong die;
25 static spinlock_t lock;
27 enum { DTIMERTICK = HZ * 60 }; /* one minute */
32 spin_lock_init(&lock);
34 t.function = discover_timer;
37 spin_lock_irqsave(&lock, flags);
39 t.expires = jiffies + DTIMERTICK;
42 spin_unlock_irqrestore(&lock, flags);
44 aoecmd_cfg(0xffff, 0xff);
47 spin_lock_irqsave(&lock, flags);
49 spin_unlock_irqrestore(&lock, flags);
60 discover_timer(TKILL);
63 unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
67 aoeblk_exit(); /* free cache after de-allocating bufs */
90 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
92 printk(KERN_ERR "aoe: can't register major\n");
95 printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
96 discover_timer(TINIT);
109 printk(KERN_INFO "aoe: initialisation failure.\n");
113 module_init(aoe_init);
114 module_exit(aoe_exit);