# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e0bbba2b9850f258197ea5df59d6e7c53cbb0398
# Parent ad33b3882867f6ab4466383129aa3827c64508d3
Separate xenbusstate enumeration from typedef. Avoid using the typedef
in Linux coe as it is consider bad coding style.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
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 | 8 +-
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 | 59 ++++++++--------
12 files changed, 54 insertions(+), 51 deletions(-)
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c Wed May 24 19:41:47
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c Thu May 25 14:15:49
2006 +0100
@@ -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");
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed May 24 19:41:47
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu May 25 14:15:49
2006 +0100
@@ -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;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Wed May 24
19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Thu May 25
14:15:49 2006 +0100
@@ -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);
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Wed May 24 19:41:47
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu May 25 14:15:49
2006 +0100
@@ -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;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed May 24
19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu May 25
14:15:49 2006 +0100
@@ -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");
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Wed May 24 19:41:47
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Thu May 25 14:15:49
2006 +0100
@@ -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;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Wed May 24
19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Thu May 25
14:15:49 2006 +0100
@@ -196,7 +196,7 @@ static int pcifront_try_disconnect(struc
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;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Wed May 24 19:41:47
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Thu May 25 14:15:49
2006 +0100
@@ -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 void backend_changed(struct xenbu
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;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Wed May 24
19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Thu May 25
14:15:49 2006 +0100
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path2);
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)
-{
- XenbusState result;
+enum xenbus_state xenbus_read_driver_state(const char *path)
+{
+ enum xenbus_state result;
int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
if (err)
result = XenbusStateClosed;
diff -r ad33b3882867 -r e0bbba2b9850
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed May 24
19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Thu May 25
14:15:49 2006 +0100
@@ -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
diff -r ad33b3882867 -r e0bbba2b9850 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Wed May 24 19:41:47 2006 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Thu May 25 14:15:49 2006 +0100
@@ -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);
/***
diff -r ad33b3882867 -r e0bbba2b9850 xen/include/public/io/xenbus.h
--- a/xen/include/public/io/xenbus.h Wed May 24 19:41:47 2006 +0100
+++ b/xen/include/public/io/xenbus.h Thu May 25 14:15:49 2006 +0100
@@ -9,34 +9,37 @@
#ifndef _XEN_PUBLIC_IO_XENBUS_H
#define _XEN_PUBLIC_IO_XENBUS_H
-/* The state of either end of the Xenbus, i.e. the current communication
- 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
+/*
+ * The state of either end of the Xenbus, i.e. the current communication
+ * 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.
+ */
+enum xenbus_state {
+ XenbusStateUnknown = 0,
-} XenbusState;
+ XenbusStateInitialising = 1,
+
+ /*
+ * InitWait: Finished early initialisation but waiting for information
+ * from the peer or hotplug scripts.
+ */
+ XenbusStateInitWait = 2,
+
+ /*
+ * Initialised: Waiting for a connection from the peer.
+ */
+ XenbusStateInitialised = 3,
+
+ XenbusStateConnected = 4,
+
+ /*
+ * Closing: The device is being closed due to an error or an unplug event.
+ */
+ XenbusStateClosing = 5,
+
+ 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|