From: Gerd Hoffmann <kraxel@redhat.com>
To: Xen Development Mailing List <xen-devel@lists.xensource.com>
Subject: [PATCH] xen frontend driver module autoloading
Date: Tue, 17 Jul 2007 15:16:44 +0200 [thread overview]
Message-ID: <469CC13C.70903@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Hi,
This patch (against 3.1-final) 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.
please apply,
Gerd
[-- Attachment #2: xenpv-autoload.diff --]
[-- Type: text/x-patch, Size: 4284 bytes --]
---
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c | 2 -
linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c | 1
linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c | 1
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 1
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c | 1
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 25 +++++++++++++++++
6 files changed, 30 insertions(+), 1 deletion(-)
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -874,7 +874,7 @@ static struct xenbus_device_id blkfront_
{ "vbd" },
{ "" }
};
-
+MODULE_ALIAS("xen:vbd");
static struct xenbus_driver blkfront = {
.name = "vbd",
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -2075,6 +2075,7 @@ static struct xenbus_device_id netfront_
{ "vif" },
{ "" }
};
+MODULE_ALIAS("xen:vif");
static struct xenbus_driver netfront = {
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
@@ -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 = {
@@ -180,6 +204,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 = {
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c
@@ -718,6 +718,7 @@ static struct xenbus_device_id xenfb_ids
{ "vfb" },
{ "" }
};
+MODULE_ALIAS("xen:vfb");
static struct xenbus_driver xenfb = {
.name = "vfb",
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/fbfront/xenkbd.c
@@ -299,6 +299,7 @@ static struct xenbus_device_id xenkbd_id
{ "vkbd" },
{ "" }
};
+MODULE_ALIAS("xen:vkbd");
static struct xenbus_driver xenkbd = {
.name = "vkbd",
Index: xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
===================================================================
--- xenpv-3.1_15042.orig/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
+++ xenpv-3.1_15042/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
@@ -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",
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2007-07-17 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 13:16 Gerd Hoffmann [this message]
2007-07-18 19:55 ` [PATCH] xen frontend driver module autoloading Jeremy Fitzhardinge
2007-07-19 11:10 ` Gerd Hoffmann
2007-07-19 14:39 ` Jeremy Fitzhardinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=469CC13C.70903@redhat.com \
--to=kraxel@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.