ia64/xen-unstable

changeset 10172:e0bbba2b9850

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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 25 14:15:49 2006 +0100 (2006-05-25)
parents ad33b3882867
children c9c40f6baba0
files linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/xen/xenbus.h xen/include/public/io/xenbus.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Wed May 24 19:41:47 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Thu May 25 14:15:49 2006 +0100
     1.3 @@ -329,7 +329,7 @@ out:
     1.4   * Callback received when the backend's state changes.
     1.5   */
     1.6  static void backend_changed(struct xenbus_device *dev,
     1.7 -			    XenbusState backend_state)
     1.8 +			    enum xenbus_state backend_state)
     1.9  {
    1.10  	struct tpm_private *tp = dev->data;
    1.11  	DPRINTK("\n");
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed May 24 19:41:47 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Thu May 25 14:15:49 2006 +0100
     2.3 @@ -247,7 +247,7 @@ static void backend_changed(struct xenbu
     2.4   * Callback received when the frontend's state changes.
     2.5   */
     2.6  static void frontend_changed(struct xenbus_device *dev,
     2.7 -			     XenbusState frontend_state)
     2.8 +			     enum xenbus_state frontend_state)
     2.9  {
    2.10  	struct backend_info *be = dev->data;
    2.11  	int err;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed May 24 19:41:47 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu May 25 14:15:49 2006 +0100
     3.3 @@ -247,7 +247,7 @@ fail:
     3.4   * Callback received when the backend's state changes.
     3.5   */
     3.6  static void backend_changed(struct xenbus_device *dev,
     3.7 -			    XenbusState backend_state)
     3.8 +			    enum xenbus_state backend_state)
     3.9  {
    3.10  	struct blkfront_info *info = dev->data;
    3.11  	struct block_device *bd;
    3.12 @@ -434,7 +434,7 @@ int blkif_release(struct inode *inode, s
    3.13  		   have ignored this request initially, as the device was
    3.14  		   still mounted. */
    3.15  		struct xenbus_device * dev = info->xbdev;
    3.16 -		XenbusState state = xenbus_read_driver_state(dev->otherend);
    3.17 +		enum xenbus_state state = xenbus_read_driver_state(dev->otherend);
    3.18  
    3.19  		if (state == XenbusStateClosing)
    3.20  			blkfront_closing(dev);
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Wed May 24 19:41:47 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Thu May 25 14:15:49 2006 +0100
     4.3 @@ -37,7 +37,7 @@ struct backend_info
     4.4  	struct xenbus_device *dev;
     4.5  	netif_t *netif;
     4.6  	struct xenbus_watch backend_watch;
     4.7 -	XenbusState frontend_state;
     4.8 +	enum xenbus_state frontend_state;
     4.9  };
    4.10  
    4.11  
    4.12 @@ -191,7 +191,7 @@ static void backend_changed(struct xenbu
    4.13   * Callback received when the frontend's state changes.
    4.14   */
    4.15  static void frontend_changed(struct xenbus_device *dev,
    4.16 -			     XenbusState frontend_state)
    4.17 +			     enum xenbus_state frontend_state)
    4.18  {
    4.19  	struct backend_info *be = dev->data;
    4.20  
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed May 24 19:41:47 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu May 25 14:15:49 2006 +0100
     5.3 @@ -384,7 +384,7 @@ static int setup_device(struct xenbus_de
     5.4   * Callback received when the backend's state changes.
     5.5   */
     5.6  static void backend_changed(struct xenbus_device *dev,
     5.7 -			    XenbusState backend_state)
     5.8 +			    enum xenbus_state backend_state)
     5.9  {
    5.10  	DPRINTK("\n");
    5.11  
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Wed May 24 19:41:47 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Thu May 25 14:15:49 2006 +0100
     6.3 @@ -166,7 +166,7 @@ static int pciback_attach(struct pciback
     6.4  }
     6.5  
     6.6  static void pciback_frontend_changed(struct xenbus_device *xdev,
     6.7 -				     XenbusState fe_state)
     6.8 +				     enum xenbus_state fe_state)
     6.9  {
    6.10  	struct pciback_device *pdev = xdev->data;
    6.11  
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Wed May 24 19:41:47 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Thu May 25 14:15:49 2006 +0100
     7.3 @@ -196,7 +196,7 @@ static int pcifront_try_connect(struct p
     7.4  static int pcifront_try_disconnect(struct pcifront_device *pdev)
     7.5  {
     7.6  	int err = 0;
     7.7 -	XenbusState prev_state;
     7.8 +	enum xenbus_state prev_state;
     7.9  
    7.10  	spin_lock(&pdev->dev_lock);
    7.11  
    7.12 @@ -214,7 +214,7 @@ static int pcifront_try_disconnect(struc
    7.13  }
    7.14  
    7.15  static void pcifront_backend_changed(struct xenbus_device *xdev,
    7.16 -				     XenbusState be_state)
    7.17 +				     enum xenbus_state be_state)
    7.18  {
    7.19  	struct pcifront_device *pdev = xdev->data;
    7.20  
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed May 24 19:41:47 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Thu May 25 14:15:49 2006 +0100
     8.3 @@ -34,7 +34,7 @@ struct backend_info
     8.4  
     8.5  	/* watch front end for changes */
     8.6  	struct xenbus_watch backend_watch;
     8.7 -	XenbusState frontend_state;
     8.8 +	enum xenbus_state frontend_state;
     8.9  };
    8.10  
    8.11  static void maybe_connect(struct backend_info *be);
    8.12 @@ -43,7 +43,7 @@ static int connect_ring(struct backend_i
    8.13  static void backend_changed(struct xenbus_watch *watch,
    8.14                              const char **vec, unsigned int len);
    8.15  static void frontend_changed(struct xenbus_device *dev,
    8.16 -                             XenbusState frontend_state);
    8.17 +                             enum xenbus_state frontend_state);
    8.18  
    8.19  static int tpmback_remove(struct xenbus_device *dev)
    8.20  {
    8.21 @@ -129,7 +129,7 @@ static void backend_changed(struct xenbu
    8.22  
    8.23  
    8.24  static void frontend_changed(struct xenbus_device *dev,
    8.25 -                             XenbusState frontend_state)
    8.26 +                             enum xenbus_state frontend_state)
    8.27  {
    8.28  	struct backend_info *be = dev->data;
    8.29  	int err;
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Wed May 24 19:41:47 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Thu May 25 14:15:49 2006 +0100
     9.3 @@ -84,7 +84,7 @@ int xenbus_watch_path2(struct xenbus_dev
     9.4  EXPORT_SYMBOL_GPL(xenbus_watch_path2);
     9.5  
     9.6  
     9.7 -int xenbus_switch_state(struct xenbus_device *dev, XenbusState state)
     9.8 +int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
     9.9  {
    9.10  	/* We check whether the state is currently set to the given value, and
    9.11  	   if not, then the state is set.  We don't want to unconditionally
    9.12 @@ -269,9 +269,9 @@ int xenbus_free_evtchn(struct xenbus_dev
    9.13  }
    9.14  
    9.15  
    9.16 -XenbusState xenbus_read_driver_state(const char *path)
    9.17 +enum xenbus_state xenbus_read_driver_state(const char *path)
    9.18  {
    9.19 -	XenbusState result;
    9.20 +	enum xenbus_state result;
    9.21  	int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
    9.22  	if (err)
    9.23  		result = XenbusStateClosed;
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed May 24 19:41:47 2006 +0100
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu May 25 14:15:49 2006 +0100
    10.3 @@ -284,7 +284,7 @@ static void otherend_changed(struct xenb
    10.4  	struct xenbus_device *dev =
    10.5  		container_of(watch, struct xenbus_device, otherend_watch);
    10.6  	struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver);
    10.7 -	XenbusState state;
    10.8 +	enum xenbus_state state;
    10.9  
   10.10  	/* Protect us against watches firing on old details when the otherend
   10.11  	   details change, say immediately after a resume. */
   10.12 @@ -539,7 +539,7 @@ static int xenbus_probe_node(struct xen_
   10.13  	size_t stringlen;
   10.14  	char *tmpstring;
   10.15  
   10.16 -	XenbusState state = xenbus_read_driver_state(nodename);
   10.17 +	enum xenbus_state state = xenbus_read_driver_state(nodename);
   10.18  
   10.19  	if (state != XenbusStateInitialising) {
   10.20  		/* Device is not new, so ignore it.  This can happen if a
    11.1 --- a/linux-2.6-xen-sparse/include/xen/xenbus.h	Wed May 24 19:41:47 2006 +0100
    11.2 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h	Thu May 25 14:15:49 2006 +0100
    11.3 @@ -75,7 +75,7 @@ struct xenbus_device {
    11.4  	int otherend_id;
    11.5  	struct xenbus_watch otherend_watch;
    11.6  	struct device dev;
    11.7 -	XenbusState state;
    11.8 +	enum xenbus_state state;
    11.9  	void *data;
   11.10  };
   11.11  
   11.12 @@ -98,7 +98,7 @@ struct xenbus_driver {
   11.13  	int (*probe)(struct xenbus_device *dev,
   11.14  		     const struct xenbus_device_id *id);
   11.15  	void (*otherend_changed)(struct xenbus_device *dev,
   11.16 -				 XenbusState backend_state);
   11.17 +				 enum xenbus_state backend_state);
   11.18  	int (*remove)(struct xenbus_device *dev);
   11.19  	int (*suspend)(struct xenbus_device *dev);
   11.20  	int (*resume)(struct xenbus_device *dev);
   11.21 @@ -207,7 +207,7 @@ int xenbus_watch_path2(struct xenbus_dev
   11.22   * Return 0 on success, or -errno on error.  On error, the device will switch
   11.23   * to XenbusStateClosing, and the error will be saved in the store.
   11.24   */
   11.25 -int xenbus_switch_state(struct xenbus_device *dev, XenbusState new_state);
   11.26 +int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state);
   11.27  
   11.28  
   11.29  /**
   11.30 @@ -273,7 +273,7 @@ int xenbus_free_evtchn(struct xenbus_dev
   11.31   * Return the state of the driver rooted at the given store path, or
   11.32   * XenbusStateClosed if no state can be read.
   11.33   */
   11.34 -XenbusState xenbus_read_driver_state(const char *path);
   11.35 +enum xenbus_state xenbus_read_driver_state(const char *path);
   11.36  
   11.37  
   11.38  /***
    12.1 --- a/xen/include/public/io/xenbus.h	Wed May 24 19:41:47 2006 +0100
    12.2 +++ b/xen/include/public/io/xenbus.h	Thu May 25 14:15:49 2006 +0100
    12.3 @@ -9,34 +9,37 @@
    12.4  #ifndef _XEN_PUBLIC_IO_XENBUS_H
    12.5  #define _XEN_PUBLIC_IO_XENBUS_H
    12.6  
    12.7 -/* The state of either end of the Xenbus, i.e. the current communication
    12.8 -   status of initialisation across the bus.  States here imply nothing about
    12.9 -   the state of the connection between the driver and the kernel's device
   12.10 -   layers.  */
   12.11 -typedef enum
   12.12 -{
   12.13 -  XenbusStateUnknown      = 0,
   12.14 -  XenbusStateInitialising = 1,
   12.15 -  XenbusStateInitWait     = 2,  /* Finished early initialisation, but waiting
   12.16 -                                   for information from the peer or hotplug
   12.17 -				   scripts. */
   12.18 -  XenbusStateInitialised  = 3,  /* Initialised and waiting for a connection
   12.19 -				   from the peer. */
   12.20 -  XenbusStateConnected    = 4,
   12.21 -  XenbusStateClosing      = 5,  /* The device is being closed due to an error
   12.22 -				   or an unplug event. */
   12.23 -  XenbusStateClosed       = 6
   12.24 +/*
   12.25 + * The state of either end of the Xenbus, i.e. the current communication
   12.26 + * status of initialisation across the bus.  States here imply nothing about
   12.27 + * the state of the connection between the driver and the kernel's device
   12.28 + * layers.
   12.29 + */
   12.30 +enum xenbus_state {
   12.31 +    XenbusStateUnknown       = 0,
   12.32 +
   12.33 +    XenbusStateInitialising  = 1,
   12.34  
   12.35 -} XenbusState;
   12.36 +    /*
   12.37 +     * InitWait: Finished early initialisation but waiting for information
   12.38 +     * from the peer or hotplug scripts.
   12.39 +     */
   12.40 +    XenbusStateInitWait      = 2,
   12.41 +
   12.42 +    /*
   12.43 +     * Initialised: Waiting for a connection from the peer.
   12.44 +     */
   12.45 +    XenbusStateInitialised   = 3,
   12.46 +
   12.47 +    XenbusStateConnected     = 4,
   12.48 +
   12.49 +    /*
   12.50 +     * Closing: The device is being closed due to an error or an unplug event.
   12.51 +     */
   12.52 +    XenbusStateClosing       = 5,
   12.53 +
   12.54 +    XenbusStateClosed	     = 6
   12.55 +};
   12.56 +typedef enum xenbus_state XenbusState;
   12.57  
   12.58  #endif /* _XEN_PUBLIC_IO_XENBUS_H */
   12.59 -
   12.60 -/*
   12.61 - * Local variables:
   12.62 - *  c-file-style: "linux"
   12.63 - *  indent-tabs-mode: t
   12.64 - *  c-indent-level: 8
   12.65 - *  c-basic-offset: 8
   12.66 - *  tab-width: 8
   12.67 - * End:
   12.68 - */