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-devel

[Xen-devel] xenbus: separate typedef from enum definition

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] xenbus: separate typedef from enum definition
From: Chris Wright <chrisw@xxxxxxxxxxxx>
Date: Wed, 24 May 2006 16:55:32 -0700
Cc: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Delivery-date: Wed, 24 May 2006 16:52:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
in linux sparse tree, directly use enum rather than typedef

Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c         |    2 
 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c       |    2 
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c    |    4 -
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c       |    4 -
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c    |    2 
 linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c       |    2 
 linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c      |    4 -
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c       |    6 +-
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c |    6 +-
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c  |    4 -
 linux-2.6-xen-sparse/include/xen/xenbus.h               |    8 +--
 xen/include/public/io/xenbus.h                          |   39 +++++-----------
 12 files changed, 36 insertions(+), 47 deletions(-)

--- xen-unstable.orig/xen/include/public/io/xenbus.h
+++ xen-unstable/xen/include/public/io/xenbus.h
@@ -13,30 +13,19 @@
    status of initialisation across the bus.  States here imply nothing about
    the state of the connection between the driver and the kernel's device
    layers.  */
-typedef enum
-{
-  XenbusStateUnknown      = 0,
-  XenbusStateInitialising = 1,
-  XenbusStateInitWait     = 2,  /* Finished early initialisation, but waiting
-                                   for information from the peer or hotplug
-                                  scripts. */
-  XenbusStateInitialised  = 3,  /* Initialised and waiting for a connection
-                                  from the peer. */
-  XenbusStateConnected    = 4,
-  XenbusStateClosing      = 5,  /* The device is being closed due to an error
-                                  or an unplug event. */
-  XenbusStateClosed       = 6
-
-} XenbusState;
+enum xenbus_state {
+       XenbusStateUnknown      = 0,
+       XenbusStateInitialising = 1,
+       XenbusStateInitWait     = 2, /* Finished early initialisation, but
+                                       waiting for information from the peer
+                                       or hotplug scripts. */
+       XenbusStateInitialised  = 3, /* Initialised and waiting for a connection
+                                       from the peer. */
+       XenbusStateConnected    = 4,
+       XenbusStateClosing      = 5, /* The device is being closed due to an
+                                       error or an unplug event. */
+       XenbusStateClosed       = 6
+};
+typedef enum xenbus_state XenbusState;
 
 #endif /* _XEN_PUBLIC_IO_XENBUS_H */
-
-/*
- * Local variables:
- *  c-file-style: "linux"
- *  indent-tabs-mode: t
- *  c-indent-level: 8
- *  c-basic-offset: 8
- *  tab-width: 8
- * End:
- */
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
@@ -247,7 +247,7 @@ static void backend_changed(struct xenbu
  * Callback received when the frontend's state changes.
  */
 static void frontend_changed(struct xenbus_device *dev,
-                            XenbusState frontend_state)
+                            enum xenbus_state frontend_state)
 {
        struct backend_info *be = dev->data;
        int err;
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -247,7 +247,7 @@ fail:
  * Callback received when the backend's state changes.
  */
 static void backend_changed(struct xenbus_device *dev,
-                           XenbusState backend_state)
+                           enum xenbus_state backend_state)
 {
        struct blkfront_info *info = dev->data;
        struct block_device *bd;
@@ -434,7 +434,7 @@ int blkif_release(struct inode *inode, s
                   have ignored this request initially, as the device was
                   still mounted. */
                struct xenbus_device * dev = info->xbdev;
-               XenbusState state = xenbus_read_driver_state(dev->otherend);
+               enum xenbus_state state = 
xenbus_read_driver_state(dev->otherend);
 
                if (state == XenbusStateClosing)
                        blkfront_closing(dev);
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
@@ -37,7 +37,7 @@ struct backend_info
        struct xenbus_device *dev;
        netif_t *netif;
        struct xenbus_watch backend_watch;
-       XenbusState frontend_state;
+       enum xenbus_state frontend_state;
 };
 
 
@@ -191,7 +191,7 @@ static void backend_changed(struct xenbu
  * Callback received when the frontend's state changes.
  */
 static void frontend_changed(struct xenbus_device *dev,
-                            XenbusState frontend_state)
+                            enum xenbus_state frontend_state)
 {
        struct backend_info *be = dev->data;
 
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -384,7 +384,7 @@ static int setup_device(struct xenbus_de
  * Callback received when the backend's state changes.
  */
 static void backend_changed(struct xenbus_device *dev,
-                           XenbusState backend_state)
+                           enum xenbus_state backend_state)
 {
        DPRINTK("\n");
 
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
@@ -166,7 +166,7 @@ static int pciback_attach(struct pciback
 }
 
 static void pciback_frontend_changed(struct xenbus_device *xdev,
-                                    XenbusState fe_state)
+                                    enum xenbus_state fe_state)
 {
        struct pciback_device *pdev = xdev->data;
 
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
@@ -196,7 +196,7 @@ static int pcifront_try_connect(struct p
 static int pcifront_try_disconnect(struct pcifront_device *pdev)
 {
        int err = 0;
-       XenbusState prev_state;
+       enum xenbus_state prev_state;
 
        spin_lock(&pdev->dev_lock);
 
@@ -214,7 +214,7 @@ static int pcifront_try_disconnect(struc
 }
 
 static void pcifront_backend_changed(struct xenbus_device *xdev,
-                                    XenbusState be_state)
+                                    enum xenbus_state be_state)
 {
        struct pcifront_device *pdev = xdev->data;
 
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
@@ -84,7 +84,7 @@ int xenbus_watch_path2(struct xenbus_dev
 EXPORT_SYMBOL_GPL(xenbus_watch_path2);
 
 
-int xenbus_switch_state(struct xenbus_device *dev, XenbusState state)
+int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
 {
        /* We check whether the state is currently set to the given value, and
           if not, then the state is set.  We don't want to unconditionally
@@ -269,9 +269,9 @@ int xenbus_free_evtchn(struct xenbus_dev
 }
 
 
-XenbusState xenbus_read_driver_state(const char *path)
+enum xenbus_state xenbus_read_driver_state(const char *path)
 {
-       XenbusState result;
+       enum xenbus_state result;
        int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
        if (err)
                result = XenbusStateClosed;
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
@@ -284,7 +284,7 @@ static void otherend_changed(struct xenb
        struct xenbus_device *dev =
                container_of(watch, struct xenbus_device, otherend_watch);
        struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver);
-       XenbusState state;
+       enum xenbus_state state;
 
        /* Protect us against watches firing on old details when the otherend
           details change, say immediately after a resume. */
@@ -539,7 +539,7 @@ static int xenbus_probe_node(struct xen_
        size_t stringlen;
        char *tmpstring;
 
-       XenbusState state = xenbus_read_driver_state(nodename);
+       enum xenbus_state state = xenbus_read_driver_state(nodename);
 
        if (state != XenbusStateInitialising) {
                /* Device is not new, so ignore it.  This can happen if a
--- xen-unstable.orig/linux-2.6-xen-sparse/include/xen/xenbus.h
+++ xen-unstable/linux-2.6-xen-sparse/include/xen/xenbus.h
@@ -75,7 +75,7 @@ struct xenbus_device {
        int otherend_id;
        struct xenbus_watch otherend_watch;
        struct device dev;
-       XenbusState state;
+       enum xenbus_state state;
        void *data;
 };
 
@@ -98,7 +98,7 @@ struct xenbus_driver {
        int (*probe)(struct xenbus_device *dev,
                     const struct xenbus_device_id *id);
        void (*otherend_changed)(struct xenbus_device *dev,
-                                XenbusState backend_state);
+                                enum xenbus_state backend_state);
        int (*remove)(struct xenbus_device *dev);
        int (*suspend)(struct xenbus_device *dev);
        int (*resume)(struct xenbus_device *dev);
@@ -207,7 +207,7 @@ int xenbus_watch_path2(struct xenbus_dev
  * Return 0 on success, or -errno on error.  On error, the device will switch
  * to XenbusStateClosing, and the error will be saved in the store.
  */
-int xenbus_switch_state(struct xenbus_device *dev, XenbusState new_state);
+int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state 
new_state);
 
 
 /**
@@ -273,7 +273,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.
  */
-XenbusState xenbus_read_driver_state(const char *path);
+enum xenbus_state xenbus_read_driver_state(const char *path);
 
 
 /***
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
@@ -329,7 +329,7 @@ out:
  * Callback received when the backend's state changes.
  */
 static void backend_changed(struct xenbus_device *dev,
-                           XenbusState backend_state)
+                           enum xenbus_state backend_state)
 {
        struct tpm_private *tp = dev->data;
        DPRINTK("\n");
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
@@ -34,7 +34,7 @@ struct backend_info
 
        /* watch front end for changes */
        struct xenbus_watch backend_watch;
-       XenbusState frontend_state;
+       enum xenbus_state frontend_state;
 };
 
 static void maybe_connect(struct backend_info *be);
@@ -43,7 +43,7 @@ static int connect_ring(struct backend_i
 static void backend_changed(struct xenbus_watch *watch,
                             const char **vec, unsigned int len);
 static void frontend_changed(struct xenbus_device *dev,
-                             XenbusState frontend_state);
+                             enum xenbus_state frontend_state);
 
 static int tpmback_remove(struct xenbus_device *dev)
 {
@@ -129,7 +129,7 @@ static void backend_changed(struct xenbu
 
 
 static void frontend_changed(struct xenbus_device *dev,
-                             XenbusState frontend_state)
+                             enum xenbus_state frontend_state)
 {
        struct backend_info *be = dev->data;
        int err;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] xenbus: separate typedef from enum definition, Chris Wright <=