direct-io.hg

changeset 11203:26576f1dbadb

[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@xensource.com>
author kaf24@localhost.localdomain
date Sat Aug 19 14:28:10 2006 +0100 (2006-08-19)
parents bb52372aa17f
children 5fc1fe790835
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/blktap/xenbus.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.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/include/xen/xenbus.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Sat Aug 19 12:08:12 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Sat Aug 19 14:28:10 2006 +0100
     1.3 @@ -343,7 +343,6 @@ static void backend_changed(struct xenbu
     1.4  	case XenbusStateInitialising:
     1.5  	case XenbusStateInitWait:
     1.6  	case XenbusStateInitialised:
     1.7 -	case XenbusStateUnknown:
     1.8  		break;
     1.9  
    1.10  	case XenbusStateConnected:
    1.11 @@ -354,10 +353,10 @@ static void backend_changed(struct xenbu
    1.12  		tpmif_set_connected_state(tp, 0);
    1.13  		break;
    1.14  
    1.15 +	case XenbusStateUnknown:
    1.16  	case XenbusStateClosed:
    1.17 -		if (tp->is_suspended == 0) {
    1.18 +		if (tp->is_suspended == 0)
    1.19  			device_unregister(&dev->dev);
    1.20 -		}
    1.21  		xenbus_switch_state(dev, XenbusStateClosed);
    1.22  		break;
    1.23  	}
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     2.3 @@ -331,12 +331,11 @@ static void frontend_changed(struct xenb
     2.4  		xenbus_switch_state(dev, XenbusStateClosing);
     2.5  		break;
     2.6  
     2.7 +	case XenbusStateUnknown:
     2.8  	case XenbusStateClosed:
     2.9  		device_unregister(&dev->dev);
    2.10  		break;
    2.11  
    2.12 -	case XenbusStateUnknown:
    2.13 -	case XenbusStateInitWait:
    2.14  	default:
    2.15  		xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
    2.16  				 frontend_state);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Sat Aug 19 12:08:12 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Sat Aug 19 14:28:10 2006 +0100
     3.3 @@ -256,10 +256,10 @@ static void backend_changed(struct xenbu
     3.4  	DPRINTK("blkfront:backend_changed.\n");
     3.5  
     3.6  	switch (backend_state) {
     3.7 -	case XenbusStateUnknown:
     3.8  	case XenbusStateInitialising:
     3.9  	case XenbusStateInitWait:
    3.10  	case XenbusStateInitialised:
    3.11 +	case XenbusStateUnknown:
    3.12  	case XenbusStateClosed:
    3.13  		break;
    3.14  
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     4.3 @@ -267,12 +267,11 @@ static void tap_frontend_changed(struct 
     4.4  		xenbus_switch_state(dev, XenbusStateClosing);
     4.5  		break;
     4.6  
     4.7 +	case XenbusStateUnknown:
     4.8  	case XenbusStateClosed:
     4.9  		device_unregister(&dev->dev);
    4.10  		break;
    4.11  
    4.12 -	case XenbusStateUnknown:
    4.13 -	case XenbusStateInitWait:
    4.14  	default:
    4.15  		xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
    4.16  				 frontend_state);
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     5.3 @@ -260,14 +260,13 @@ static void frontend_changed(struct xenb
     5.4  		xenbus_switch_state(dev, XenbusStateClosing);
     5.5  		break;
     5.6  
     5.7 +	case XenbusStateUnknown:
     5.8  	case XenbusStateClosed:
     5.9  		if (be->netif != NULL)
    5.10  			kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
    5.11  		device_unregister(&dev->dev);
    5.12  		break;
    5.13  
    5.14 -	case XenbusStateUnknown:
    5.15 -	case XenbusStateInitWait:
    5.16  	default:
    5.17  		xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
    5.18  				 frontend_state);
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     6.3 @@ -181,6 +181,7 @@ static void pciback_frontend_changed(str
     6.4  		xenbus_switch_state(xdev, XenbusStateClosing);
     6.5  		break;
     6.6  
     6.7 +	case XenbusStateUnknown:
     6.8  	case XenbusStateClosed:
     6.9  		dev_dbg(&xdev->dev, "frontend is gone! unregister device\n");
    6.10  		device_unregister(&xdev->dev);
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     7.3 @@ -225,6 +225,7 @@ static void pcifront_backend_changed(str
     7.4  		pcifront_try_disconnect(pdev);
     7.5  		break;
     7.6  
     7.7 +	case XenbusStateUnknown:
     7.8  	case XenbusStateClosed:
     7.9  		dev_warn(&xdev->dev, "backend went away!\n");
    7.10  		pcifront_try_disconnect(pdev);
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Sat Aug 19 12:08:12 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Sat Aug 19 14:28:10 2006 +0100
     8.3 @@ -34,7 +34,6 @@ struct backend_info
     8.4  
     8.5  	/* watch front end for changes */
     8.6  	struct xenbus_watch backend_watch;
     8.7 -	enum xenbus_state frontend_state;
     8.8  };
     8.9  
    8.10  static void maybe_connect(struct backend_info *be);
    8.11 @@ -143,8 +142,6 @@ static void frontend_changed(struct xenb
    8.12  	struct backend_info *be = dev->dev.driver_data;
    8.13  	int err;
    8.14  
    8.15 -	be->frontend_state = frontend_state;
    8.16 -
    8.17  	switch (frontend_state) {
    8.18  	case XenbusStateInitialising:
    8.19  	case XenbusStateInitialised:
    8.20 @@ -162,13 +159,12 @@ static void frontend_changed(struct xenb
    8.21  		be->instance = -1;
    8.22  		break;
    8.23  
    8.24 +	case XenbusStateUnknown:
    8.25  	case XenbusStateClosed:
    8.26  		device_unregister(&be->dev->dev);
    8.27  		tpmback_remove(dev);
    8.28  		break;
    8.29  
    8.30 -	case XenbusStateUnknown:
    8.31 -	case XenbusStateInitWait:
    8.32  	default:
    8.33  		xenbus_dev_fatal(dev, -EINVAL,
    8.34  				 "saw state %d at frontend",
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Sat Aug 19 12:08:12 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Sat Aug 19 14:28:10 2006 +0100
     9.3 @@ -274,7 +274,7 @@ enum xenbus_state xenbus_read_driver_sta
     9.4  	enum xenbus_state result;
     9.5  	int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL);
     9.6  	if (err)
     9.7 -		result = XenbusStateClosed;
     9.8 +		result = XenbusStateUnknown;
     9.9  
    9.10  	return result;
    9.11  }
    10.1 --- a/linux-2.6-xen-sparse/include/xen/xenbus.h	Sat Aug 19 12:08:12 2006 +0100
    10.2 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h	Sat Aug 19 14:28:10 2006 +0100
    10.3 @@ -274,7 +274,7 @@ int xenbus_free_evtchn(struct xenbus_dev
    10.4  
    10.5  /**
    10.6   * Return the state of the driver rooted at the given store path, or
    10.7 - * XenbusStateClosed if no state can be read.
    10.8 + * XenbusStateUnknown if no state can be read.
    10.9   */
   10.10  enum xenbus_state xenbus_read_driver_state(const char *path);
   10.11