[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] Update kernel watch API to pass the array of watch arguments to the callback instead of just passing the node.
Update kernel watch API to pass the array of watch arguments to the callback instead of just passing the node. This allows us to extend watches to have additional arguments (like domids). Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx> # HG changeset patch # User anthony@xxxxxxxxxxxxxxxxxxxxx # Node ID 59fc241f36e5679ac52eec2c01c8f82a736c1567 # Parent 355bc8009bb6cf6be5b0474b84984acf1dda23fb Update kernel watch API to pass the array of watch arguments to the callback instead of just passing the node. This allows us to extend watches to have additional arguments (like domids). Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx> diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Oct 3 23:38:00 2005 -0500 @@ -351,7 +351,8 @@ }; /* React to a change in the target key */ -static void watch_target(struct xenbus_watch *watch, const char *node) +static void watch_target(struct xenbus_watch *watch, + const char **vec, unsigned int len) { unsigned long long new_target; int err; diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Oct 3 23:38:00 2005 -0500 @@ -55,7 +55,8 @@ } /* Front end tells us frame. */ -static void frontend_changed(struct xenbus_watch *watch, const char *node) +static void frontend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { unsigned long ring_ref; unsigned int evtchn; @@ -64,7 +65,7 @@ = container_of(watch, struct backend_info, watch); /* If other end is gone, delete ourself. */ - if (node && !xenbus_exists(be->frontpath, "")) { + if (vec && !xenbus_exists(be->frontpath, "")) { device_unregister(&be->dev->dev); return; } @@ -143,7 +144,8 @@ We provide event channel and device details to front end. Frontend supplies shared frame and event channel. */ -static void backend_changed(struct xenbus_watch *watch, const char *node) +static void backend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { int err; char *p; @@ -195,7 +197,7 @@ } /* Pass in NULL node to skip exist test. */ - frontend_changed(&be->watch, NULL); + frontend_changed(&be->watch, NULL, 0); } } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Mon Oct 3 23:38:00 2005 -0500 @@ -444,12 +444,16 @@ { "" } }; -static void watch_for_status(struct xenbus_watch *watch, const char *node) +static void watch_for_status(struct xenbus_watch *watch, + const char **vec, unsigned int len) { struct blkfront_info *info; unsigned int binfo; unsigned long sectors, sector_size; int err; + const char *node; + + node = vec[XS_WATCH_PATH]; info = container_of(watch, struct blkfront_info, watch); node += strlen(watch->node); @@ -652,8 +656,17 @@ return err; } - /* Call once in case entries already there. */ - watch_for_status(&info->watch, info->watch.node); + { + unsigned int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1; + const char *vec[len]; + + vec[XS_WATCH_PATH] = info->watch.node; + vec[XS_WATCH_TOKEN] = NULL; + + /* Call once in case entries already there. */ + watch_for_status(&info->watch, vec, len); + } + return 0; } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Mon Oct 3 23:38:00 2005 -0500 @@ -59,7 +59,8 @@ } /* Front end tells us frame. */ -static void frontend_changed(struct xenbus_watch *watch, const char *node) +static void frontend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { unsigned long ring_ref; unsigned int evtchn; @@ -68,7 +69,7 @@ = container_of(watch, struct backend_info, watch); /* If other end is gone, delete ourself. */ - if (node && !xenbus_exists(be->frontpath, "")) { + if (vec && !xenbus_exists(be->frontpath, "")) { xenbus_rm(be->dev->nodename, ""); device_unregister(&be->dev->dev); return; @@ -106,7 +107,8 @@ We provide event channel and device details to front end. Frontend supplies shared frame and event channel. */ -static void backend_changed(struct xenbus_watch *watch, const char *node) +static void backend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { int err; char *p; @@ -129,7 +131,7 @@ } /* Pass in NULL node to skip exist test. */ - frontend_changed(&be->watch, NULL); + frontend_changed(&be->watch, NULL, 0); } } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Oct 3 23:38:00 2005 -0500 @@ -57,7 +57,8 @@ } /* Front end tells us frame. */ -static void frontend_changed(struct xenbus_watch *watch, const char *node) +static void frontend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { unsigned long tx_ring_ref, rx_ring_ref; unsigned int evtchn; @@ -68,7 +69,7 @@ int i; /* If other end is gone, delete ourself. */ - if (node && !xenbus_exists(be->frontpath, "")) { + if (vec && !xenbus_exists(be->frontpath, "")) { xenbus_rm(be->dev->nodename, ""); device_unregister(&be->dev->dev); return; @@ -126,7 +127,8 @@ We provide event channel and device details to front end. Frontend supplies shared frame and event channel. */ -static void backend_changed(struct xenbus_watch *watch, const char *node) +static void backend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { int err; long int handle; @@ -163,7 +165,7 @@ kobject_hotplug(&dev->dev.kobj, KOBJ_ONLINE); /* Pass in NULL node to skip exist test. */ - frontend_changed(&be->watch, NULL); + frontend_changed(&be->watch, NULL, 0); } } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Oct 3 23:38:00 2005 -0500 @@ -966,7 +966,8 @@ { "" } }; -static void watch_for_status(struct xenbus_watch *watch, const char *node) +static void watch_for_status(struct xenbus_watch *watch, + const char **vec, unsigned int len) { } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Mon Oct 3 23:38:00 2005 -0500 @@ -59,7 +59,8 @@ } -static void frontend_changed(struct xenbus_watch *watch, const char *node) +static void frontend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { unsigned long ringref; unsigned int evtchn; @@ -69,7 +70,7 @@ = container_of(watch, struct backend_info, watch); /* If other end is gone, delete ourself. */ - if (node && !xenbus_exists(be->frontpath, "")) { + if (vec && !xenbus_exists(be->frontpath, "")) { xenbus_rm(be->dev->nodename, ""); device_unregister(&be->dev->dev); return; @@ -142,7 +143,8 @@ } -static void backend_changed(struct xenbus_watch *watch, const char *node) +static void backend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) { int err; long int instance; @@ -166,6 +168,9 @@ be->instance = instance; if (be->tpmif == NULL) { + unsigned int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1; + const char *vec[len]; + be->tpmif = tpmif_find(be->frontend_id, instance); if (IS_ERR(be->tpmif)) { @@ -175,8 +180,11 @@ return; } + vec[XS_WATCH_PATH] = be->frontpath; + vec[XS_WATCH_TOKEN] = NULL; + /* Pass in NULL node to skip exist test. */ - frontend_changed(&be->watch, be->frontpath); + frontend_changed(&be->watch, vec, len); } } diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Mon Oct 3 23:38:00 2005 -0500 @@ -211,12 +211,14 @@ XENBUS support code **************************************************************/ -static void watch_for_status(struct xenbus_watch *watch, const char *node) +static void watch_for_status(struct xenbus_watch *watch, + const char **vec, unsigned int len) { struct tpmfront_info *info; int err; unsigned long ready; struct tpm_private *tp = &my_private; + const char *node = vec[XS_WATCH_PATH]; info = container_of(watch, struct tpmfront_info, watch); node += strlen(watch->node); diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Oct 3 23:38:00 2005 -0500 @@ -546,14 +546,16 @@ kfree(root); } -static void frontend_changed(struct xenbus_watch *watch, const char *node) -{ - dev_changed(node, &xenbus_frontend); -} - -static void backend_changed(struct xenbus_watch *watch, const char *node) -{ - dev_changed(node, &xenbus_backend); +static void frontend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) +{ + dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend); +} + +static void backend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len) +{ + dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); } /* We watch for devices appearing and vanishing. */ diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Oct 3 23:38:00 2005 -0500 @@ -551,7 +551,7 @@ vec[XS_WATCH_TOKEN], err); w = find_watch(vec[XS_WATCH_TOKEN]); BUG_ON(!w); - w->callback(w, vec[XS_WATCH_PATH]); + w->callback(w, (const char **)vec, num); kfree(vec); } else if (vec) printk(KERN_WARNING "XENBUS xs_read_watch: %li\n", diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/include/asm-xen/xenbus.h --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h Mon Oct 3 23:37:48 2005 -0500 +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h Mon Oct 3 23:38:00 2005 -0500 @@ -33,6 +33,9 @@ #include <linux/device.h> #include <linux/notifier.h> #include <asm/semaphore.h> + +/* FIXME there's got to be a better way to get at the XS_WATCH macros */ +#include <asm-xen/linux-public/xenstored.h> /* A xenbus device. */ struct xenbus_device { @@ -113,7 +116,8 @@ { struct list_head list; char *node; - void (*callback)(struct xenbus_watch *, const char *node); + void (*callback)(struct xenbus_watch *, + const char **vec, unsigned int len); }; /* notifer routines for when the xenstore comes up */ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |