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] Added a 'state' field to the xenbus_device structure, wh

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Added a 'state' field to the xenbus_device structure, which caches the state
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 04 Mar 2006 19:32:06 +0000
Delivery-date: Sat, 04 Mar 2006 19:32:39 +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 emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 8853631252d828c0205e4e89c2bc521aa1f34934
# Parent  d088ce2d3528e4014c5f8aca8a261229f2d5465c
Added a 'state' field to the xenbus_device structure, which caches the state
at the local end of the xenbus connection (i.e. that value that is passed
through xenbus_switch_state).  This means that xenbus_probe can wait for all
the boot devices to become ready without having to hurt the store.

Also, fix this probing -- previously, the wrong value was being returned by 
all_devices_ready_, so this polling would only have waited for one device. 

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r d088ce2d3528 -r 8853631252d8 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Fri Mar  3 
14:56:34 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Sat Mar  4 
18:10:56 2006
@@ -95,18 +95,25 @@
         */
 
        int current_state;
-
-       int err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
+       int err;
+
+       if (state == dev->state)
+               return 0;
+
+       err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
                               &current_state);
-       if ((err == 1 && (XenbusState)current_state == state) ||
-           err == -ENOENT)
+       if (err != 1)
                return 0;
 
        err = xenbus_printf(xbt, dev->nodename, "state", "%d", state);
        if (err) {
-               xenbus_dev_fatal(dev, err, "writing new state");
+               if (state != XenbusStateClosing) /* Avoid looping */
+                       xenbus_dev_fatal(dev, err, "writing new state");
                return err;
        }
+
+       dev->state = state;
+
        return 0;
 }
 EXPORT_SYMBOL(xenbus_switch_state);
@@ -138,7 +145,6 @@
        ret = vsnprintf(printf_buffer+len, PRINTF_BUFFER_SIZE-len, fmt, ap);
 
        BUG_ON(len + ret > PRINTF_BUFFER_SIZE-1);
-       dev->has_error = 1;
 
        dev_err(&dev->dev, "%s\n", printf_buffer);
 
diff -r d088ce2d3528 -r 8853631252d8 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Mar  3 
14:56:34 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Sat Mar  4 
18:10:56 2006
@@ -888,16 +888,13 @@
 {
        struct xenbus_device *xendev = to_xenbus_device(dev);
        int *result = data;
-       int state;
-
-       int err = xenbus_scanf(XBT_NULL, xendev->nodename, "state", "%d",
-                              &state);
-       if (err != 1 || state != XenbusStateConnected) {
+
+       if (xendev->state != XenbusStateConnected) {
                result = 0;
                return 1;
        }
 
-       return 1;
+       return 0;
 }
 
 
diff -r d088ce2d3528 -r 8853631252d8 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Mar  3 14:56:34 2006
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Sat Mar  4 18:10:56 2006
@@ -63,7 +63,7 @@
        int otherend_id;
        struct xenbus_watch otherend_watch;
        struct device dev;
-       int has_error;
+       XenbusState state;
        void *data;
 };
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Added a 'state' field to the xenbus_device structure, which caches the state, Xen patchbot -unstable <=