[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XENBUS] Allow user of xenbus_read_driver_state() to distinguish



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 26576f1dbadb4ab6b6266afb7c6984573929547f
# Parent  bb52372aa17ffdcee53ed57907b8c56ba17b49b2
[XENBUS] Allow user of xenbus_read_driver_state() to distinguish
absence of state field in xenstore by returning XenbusStateUnknown
rather than XenbusStateClosed.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c         |    5 ++---
 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c       |    3 +--
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c    |    2 +-
 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c        |    3 +--
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c       |    3 +--
 linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c       |    1 +
 linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c      |    1 +
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c       |    6 +-----
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c |    2 +-
 linux-2.6-xen-sparse/include/xen/xenbus.h               |    2 +-
 10 files changed, 11 insertions(+), 17 deletions(-)

diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Sat Aug 19 14:28:10 
2006 +0100
@@ -343,7 +343,6 @@ static void backend_changed(struct xenbu
        case XenbusStateInitialising:
        case XenbusStateInitWait:
        case XenbusStateInitialised:
-       case XenbusStateUnknown:
                break;
 
        case XenbusStateConnected:
@@ -354,10 +353,10 @@ static void backend_changed(struct xenbu
                tpmif_set_connected_state(tp, 0);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
-               if (tp->is_suspended == 0) {
+               if (tp->is_suspended == 0)
                        device_unregister(&dev->dev);
-               }
                xenbus_switch_state(dev, XenbusStateClosed);
                break;
        }
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Aug 19 14:28:10 
2006 +0100
@@ -331,12 +331,11 @@ static void frontend_changed(struct xenb
                xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Sat Aug 19 
12:08:12 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Sat Aug 19 
14:28:10 2006 +0100
@@ -256,10 +256,10 @@ static void backend_changed(struct xenbu
        DPRINTK("blkfront:backend_changed.\n");
 
        switch (backend_state) {
-       case XenbusStateUnknown:
        case XenbusStateInitialising:
        case XenbusStateInitWait:
        case XenbusStateInitialised:
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                break;
 
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Sat Aug 19 14:28:10 
2006 +0100
@@ -267,12 +267,11 @@ static void tap_frontend_changed(struct 
                xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Aug 19 14:28:10 
2006 +0100
@@ -260,14 +260,13 @@ static void frontend_changed(struct xenb
                xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                if (be->netif != NULL)
                        kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Sat Aug 19 14:28:10 
2006 +0100
@@ -181,6 +181,7 @@ static void pciback_frontend_changed(str
                xenbus_switch_state(xdev, XenbusStateClosing);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                dev_dbg(&xdev->dev, "frontend is gone! unregister device\n");
                device_unregister(&xdev->dev);
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Sat Aug 19 
12:08:12 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Sat Aug 19 
14:28:10 2006 +0100
@@ -225,6 +225,7 @@ static void pcifront_backend_changed(str
                pcifront_try_disconnect(pdev);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                dev_warn(&xdev->dev, "backend went away!\n");
                pcifront_try_disconnect(pdev);
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Aug 19 12:08:12 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Aug 19 14:28:10 
2006 +0100
@@ -34,7 +34,6 @@ struct backend_info
 
        /* watch front end for changes */
        struct xenbus_watch backend_watch;
-       enum xenbus_state frontend_state;
 };
 
 static void maybe_connect(struct backend_info *be);
@@ -143,8 +142,6 @@ static void frontend_changed(struct xenb
        struct backend_info *be = dev->dev.driver_data;
        int err;
 
-       be->frontend_state = frontend_state;
-
        switch (frontend_state) {
        case XenbusStateInitialising:
        case XenbusStateInitialised:
@@ -162,13 +159,12 @@ static void frontend_changed(struct xenb
                be->instance = -1;
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                device_unregister(&be->dev->dev);
                tpmback_remove(dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL,
                                 "saw state %d at frontend",
diff -r bb52372aa17f -r 26576f1dbadb 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Sat Aug 19 
12:08:12 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Sat Aug 19 
14:28:10 2006 +0100
@@ -274,7 +274,7 @@ enum xenbus_state xenbus_read_driver_sta
        enum xenbus_state result;
        int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL);
        if (err)
-               result = XenbusStateClosed;
+               result = XenbusStateUnknown;
 
        return result;
 }
diff -r bb52372aa17f -r 26576f1dbadb linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Sat Aug 19 12:08:12 2006 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Sat Aug 19 14:28:10 2006 +0100
@@ -274,7 +274,7 @@ int xenbus_free_evtchn(struct xenbus_dev
 
 /**
  * Return the state of the driver rooted at the given store path, or
- * XenbusStateClosed if no state can be read.
+ * XenbusStateUnknown if no state can be read.
  */
 enum xenbus_state xenbus_read_driver_state(const char *path);
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.