WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Update kernel watch API to pass the array of watch argum

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Update kernel watch API to pass the array of watch arguments to the callback
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Oct 2005 16:02:11 +0000
Delivery-date: Fri, 07 Oct 2005 15:59:44 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID c45c3d6b1a601689a43c4ec5fb141bb70bace6b8
# Parent  402b5eb859058d213dc2f253863e5e2a233a5e11
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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c        Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c        Fri Oct  7 
14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Oct  7 14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Oct  7 14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Oct  7 
14:52:43 2005
@@ -442,12 +442,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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Fri Oct  7 14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Fri Oct  7 14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Oct  7 14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Oct  7 14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Oct  7 
14:52:43 2005
@@ -963,7 +963,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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Fri Oct  7 14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Fri Oct  7 14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Fri Oct  7 
14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Oct  7 
14:52:43 2005
@@ -562,14 +562,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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Fri Oct  7 
14:51:53 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Fri Oct  7 
14:52:43 2005
@@ -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 402b5eb85905 -r c45c3d6b1a60 
linux-2.6-xen-sparse/include/asm-xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Fri Oct  7 14:51:53 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Fri Oct  7 14:52:43 2005
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Update kernel watch API to pass the array of watch arguments to the callback, Xen patchbot -unstable <=