]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
Xen frontend driver module autoloading.
authorkfraser <kfraser@localhost.localdomain>
Tue, 17 Jul 2007 13:21:40 +0000 (14:21 +0100)
committerkfraser <kfraser@localhost.localdomain>
Tue, 17 Jul 2007 13:21:40 +0000 (14:21 +0100)
Implements module autoloading for the xen frontend drivers by adding a
uevent function for the frontend xenbus and some module aliases to the
individual drivers.

From: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
drivers/xen/blkfront/blkfront.c
drivers/xen/fbfront/xenfb.c
drivers/xen/fbfront/xenkbd.c
drivers/xen/netfront/netfront.c
drivers/xen/pcifront/xenbus.c
drivers/xen/xenbus/xenbus_probe.c

index 77862cf1de60f4f1e5e6c7006d83c4b5843da2f7..d13a63f6d5fcd36d032c6d8b055251f75f605000 100644 (file)
@@ -879,7 +879,7 @@ static struct xenbus_device_id blkfront_ids[] = {
        { "vbd" },
        { "" }
 };
-
+MODULE_ALIAS("xen:vbd");
 
 static struct xenbus_driver blkfront = {
        .name = "vbd",
index 712c928912c9379c17b1f0ab4b972c1a68bab302..3118233539b0d78251535b55f1e67962e13468a2 100644 (file)
@@ -718,6 +718,7 @@ static struct xenbus_device_id xenfb_ids[] = {
        { "vfb" },
        { "" }
 };
+MODULE_ALIAS("xen:vfb");
 
 static struct xenbus_driver xenfb = {
        .name = "vfb",
index a34beafcda6b06e5ac21603b329a052c487c9b53..9b5935f5a893587117e9d60904fa2633a792c495 100644 (file)
@@ -299,6 +299,7 @@ static struct xenbus_device_id xenkbd_ids[] = {
        { "vkbd" },
        { "" }
 };
+MODULE_ALIAS("xen:vkbd");
 
 static struct xenbus_driver xenkbd = {
        .name = "vkbd",
index a05b479569fa77bee65374755c91d0111679db8f..cb2eb0e7f844e6bbfda9d7ca5e4bbba83c18af5a 100644 (file)
@@ -2151,6 +2151,7 @@ static struct xenbus_device_id netfront_ids[] = {
        { "vif" },
        { "" }
 };
+MODULE_ALIAS("xen:vif");
 
 
 static struct xenbus_driver netfront = {
index c5fca76cf92b5ae670bf8d5aecc967923a2e1d97..538ca0db0c5921376bc601f7aa7026e43f6f34d2 100644 (file)
@@ -273,6 +273,7 @@ static struct xenbus_device_id xenpci_ids[] = {
        {"pci"},
        {{0}},
 };
+MODULE_ALIAS("xen:pci");
 
 static struct xenbus_driver xenbus_pcifront_driver = {
        .name                   = "pcifront",
index de9c39c313ffb29bdc6b6acf4821b9de15e08c16..daeb99943f67ad3ed8895ef72a76c76b9780faf5 100644 (file)
@@ -165,6 +165,30 @@ static int read_backend_details(struct xenbus_device *xendev)
        return read_otherend_details(xendev, "backend-id", "backend");
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+static int xenbus_uevent_frontend(struct device *dev, char **envp,
+                                 int num_envp, char *buffer, int buffer_size)
+{
+       struct xenbus_device *xdev;
+       int length = 0, i = 0;
+
+       if (dev == NULL)
+               return -ENODEV;
+       xdev = to_xenbus_device(dev);
+       if (xdev == NULL)
+               return -ENODEV;
+
+       /* stuff we want to pass to /sbin/hotplug */
+       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
+                      "XENBUS_TYPE=%s", xdev->devicetype);
+       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
+                      "XENBUS_PATH=%s", xdev->nodename);
+       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
+                      "MODALIAS=xen:%s", xdev->devicetype);
+
+       return 0;
+}
+#endif
 
 /* Bus type for frontend drivers. */
 static struct xen_bus_type xenbus_frontend = {
@@ -180,6 +204,7 @@ static struct xen_bus_type xenbus_frontend = {
                .probe    = xenbus_dev_probe,
                .remove   = xenbus_dev_remove,
                .shutdown = xenbus_dev_shutdown,
+               .uevent   = xenbus_uevent_frontend,
 #endif
        },
        .dev = {