ia64/xen-unstable

changeset 11405:e036feb6a4ff

Add xenbus_strstate() helper function for more readable debug output.

From: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Sep 01 00:20:42 2006 +0100 (2006-09-01)
parents e83368c8d5e2
children 98a81d2ccf4c
files 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
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Thu Aug 31 23:59:11 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Fri Sep 01 00:20:42 2006 +0100
     1.3 @@ -41,6 +41,20 @@ extern char *kasprintf(const char *fmt, 
     1.4  #define DPRINTK(fmt, args...) \
     1.5      pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
     1.6  
     1.7 +char *xenbus_strstate(enum xenbus_state state)
     1.8 +{
     1.9 +	static char *name[] = {
    1.10 +		[ XenbusStateUnknown      ] = "Unknown",
    1.11 +		[ XenbusStateInitialising ] = "Initialising",
    1.12 +		[ XenbusStateInitWait     ] = "InitWait",
    1.13 +		[ XenbusStateInitialised  ] = "Initialised",
    1.14 +		[ XenbusStateConnected    ] = "Connected",
    1.15 +		[ XenbusStateClosing      ] = "Closing",
    1.16 +		[ XenbusStateClosed	  ] = "Closed",
    1.17 +	};
    1.18 +	return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID";
    1.19 +}
    1.20 +
    1.21  int xenbus_watch_path(struct xenbus_device *dev, const char *path,
    1.22  		      struct xenbus_watch *watch,
    1.23  		      void (*callback)(struct xenbus_watch *,
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu Aug 31 23:59:11 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Sep 01 00:20:42 2006 +0100
     2.3 @@ -316,8 +316,9 @@ static void otherend_changed(struct xenb
     2.4  
     2.5  	state = xenbus_read_driver_state(dev->otherend);
     2.6  
     2.7 -	DPRINTK("state is %d, %s, %s",
     2.8 -		state, dev->otherend_watch.node, vec[XS_WATCH_PATH]);
     2.9 +	DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
    2.10 +		dev->otherend_watch.node, vec[XS_WATCH_PATH]);
    2.11 +
    2.12  	if (drv->otherend_changed)
    2.13  		drv->otherend_changed(dev, state);
    2.14  }
     3.1 --- a/linux-2.6-xen-sparse/include/xen/xenbus.h	Thu Aug 31 23:59:11 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h	Fri Sep 01 00:20:42 2006 +0100
     3.3 @@ -297,4 +297,6 @@ void xenbus_dev_fatal(struct xenbus_devi
     3.4  
     3.5  int __init xenbus_dev_init(void);
     3.6  
     3.7 +char *xenbus_strstate(enum xenbus_state state);
     3.8 +
     3.9  #endif /* _XEN_XENBUS_H */