Skip to contentSkip to conversation

linux: allow blkback to be a module

PATCH New Jan Beulich 1 participant 1 message Feb 28, 2006 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: allow blkback to be a module

While the Kconfig changes also touch BLKDEV_TAP, these haven't been tested (as I found that many of the options that are disabled by default don't even build at present).

Jan

drivers/xen/Kconfig +3 -3
Index: head-2006-02-23/drivers/xen/Kconfig
===================================================================
@@ -68,7 +68,7 @@ config XEN_UNPRIVILEGED_GUEST
 	default n
 
 config XEN_BLKDEV_BACKEND
-	bool "Block-device backend driver"
+	tristate "Block-device backend driver"
 	default y
 	help
 	  The block-device backend driver allows the kernel to export its
@@ -76,7 +76,7 @@ config XEN_BLKDEV_BACKEND
 	  interface.
 
 config XEN_BLKDEV_TAP_BE
-        bool "Block Tap support for backend driver (DANGEROUS)"
+        tristate "Block Tap support for backend driver (DANGEROUS)"
         depends on XEN_BLKDEV_BACKEND
         default n
         help
@@ -145,7 +145,7 @@ config XEN_NETDEV_FRONTEND
 	  (domain 0), then you almost certainly want to say Y here.
 
 config XEN_BLKDEV_TAP
-	bool "Block device tap driver"
+	tristate "Block device tap driver"
 	default n
 	help
 	  This driver allows a VM to interact on block device channels
drivers/xen/blkback/Makefile +2 -1
Index: head-2006-02-23/drivers/xen/blkback/Makefile
===================================================================
@@ -1,2 +1,3 @@
+obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
 
-obj-y	:= blkback.o xenbus.o interface.o vbd.o
+blkbk-y	:= blkback.o xenbus.o interface.o vbd.o
drivers/xen/blkback/blkback.c +14 -8
Index: head-2006-02-23/drivers/xen/blkback/blkback.c
===================================================================
@@ -29,14 +29,10 @@
  * 64 should be enough to keep us competitive with Linux.
  */
 static int blkif_reqs = 64;
-static int mmap_pages;
+module_param_named(reqs, blkif_reqs, int, 0);
+MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate");
 
-static int __init set_blkif_reqs(char *str)
-{
-	get_option(&str, &blkif_reqs);
-	return 1;
-}
-__setup("blkif_reqs=", set_blkif_reqs);
+static int mmap_pages;
 
 /* Run-time switchable: /sys/module/blkback/parameters/ */
 static unsigned int log_stats = 0;
@@ -574,10 +570,20 @@ static int __init blkif_init(void)
 		list_add_tail(&pending_reqs[i].free_list, &pending_free);
     
 	blkif_xenbus_init();
+	__unsafe(THIS_MODULE);
 	return 0;
 }
 
-__initcall(blkif_init);
+module_init(blkif_init);
+
+static void blkif_exit(void)
+{
+	BUG();
+}
+
+module_exit(blkif_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
 
 /*
  * Local variables:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel