# HG changeset 141 patch # User kfraser@localhost.localdomain # Date 1184678500 -3600 # Node ID 5e294e29a43ee8a608d454353ee19b83f72d4757 # Parent 3ce2b9fc4900103af7b4f180ff6622b480d55c84 Subject: Xen frontend driver module autoloading. 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 Signed-off-by: Keir Fraser Acked-by: jbeulich@novell.com Index: head-2007-08-07/drivers/xen/blkfront/blkfront.c =================================================================== --- head-2007-08-07.orig/drivers/xen/blkfront/blkfront.c 2007-08-07 09:48:09.000000000 +0200 +++ head-2007-08-07/drivers/xen/blkfront/blkfront.c 2007-08-07 09:58:14.000000000 +0200 @@ -879,7 +879,7 @@ static struct xenbus_device_id blkfront_ { "vbd" }, { "" } }; - +MODULE_ALIAS("xen:vbd"); static struct xenbus_driver blkfront = { .name = "vbd", Index: head-2007-08-07/drivers/xen/fbfront/xenfb.c =================================================================== --- head-2007-08-07.orig/drivers/xen/fbfront/xenfb.c 2007-08-07 09:47:09.000000000 +0200 +++ head-2007-08-07/drivers/xen/fbfront/xenfb.c 2007-08-07 09:58:14.000000000 +0200 @@ -718,6 +718,7 @@ static struct xenbus_device_id xenfb_ids { "vfb" }, { "" } }; +MODULE_ALIAS("xen:vfb"); static struct xenbus_driver xenfb = { .name = "vfb", Index: head-2007-08-07/drivers/xen/fbfront/xenkbd.c =================================================================== --- head-2007-08-07.orig/drivers/xen/fbfront/xenkbd.c 2007-08-07 09:47:09.000000000 +0200 +++ head-2007-08-07/drivers/xen/fbfront/xenkbd.c 2007-08-07 09:58:14.000000000 +0200 @@ -299,6 +299,7 @@ static struct xenbus_device_id xenkbd_id { "vkbd" }, { "" } }; +MODULE_ALIAS("xen:vkbd"); static struct xenbus_driver xenkbd = { .name = "vkbd", Index: head-2007-08-07/drivers/xen/netfront/netfront.c =================================================================== --- head-2007-08-07.orig/drivers/xen/netfront/netfront.c 2007-08-07 09:58:05.000000000 +0200 +++ head-2007-08-07/drivers/xen/netfront/netfront.c 2007-08-07 09:58:14.000000000 +0200 @@ -2110,6 +2110,7 @@ static struct xenbus_device_id netfront_ { "vif" }, { "" } }; +MODULE_ALIAS("xen:vif"); static struct xenbus_driver netfront = { Index: head-2007-08-07/drivers/xen/pcifront/xenbus.c =================================================================== --- head-2007-08-07.orig/drivers/xen/pcifront/xenbus.c 2007-08-07 09:34:51.000000000 +0200 +++ head-2007-08-07/drivers/xen/pcifront/xenbus.c 2007-08-07 09:58:14.000000000 +0200 @@ -273,6 +273,7 @@ static struct xenbus_device_id xenpci_id {"pci"}, {{0}}, }; +MODULE_ALIAS("xen:pci"); static struct xenbus_driver xenbus_pcifront_driver = { .name = "pcifront", Index: head-2007-08-07/drivers/xen/xenbus/xenbus_probe.c =================================================================== --- head-2007-08-07.orig/drivers/xen/xenbus/xenbus_probe.c 2007-08-07 09:48:09.000000000 +0200 +++ head-2007-08-07/drivers/xen/xenbus/xenbus_probe.c 2007-08-07 09:58:14.000000000 +0200 @@ -165,6 +165,30 @@ static int read_backend_details(struct x 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 = { @@ -179,6 +203,7 @@ static struct xen_bus_type xenbus_fronte .probe = xenbus_dev_probe, .remove = xenbus_dev_remove, .shutdown = xenbus_dev_shutdown, + .uevent = xenbus_uevent_frontend, #endif }, .dev = {