ia64/xen-unstable

changeset 8555:e629bb62c63e

update xs_transaction_t to be a plain u32 integer instead of a fake pointer.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Wed Jan 11 12:01:37 2006 +0000 (2006-01-11)
parents f226284e5c1a
children c886f74b54a4
files linux-2.6-xen-sparse/arch/xen/kernel/reboot.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/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c linux-2.6-xen-sparse/include/asm-xen/xenbus.h tools/python/xen/lowlevel/xs/xs.c tools/xenstat/libxenstat/src/xenstat.c tools/xenstore/xenstore_client.c tools/xenstore/xs.c tools/xenstore/xs.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Wed Jan 11 11:46:32 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Wed Jan 11 12:01:37 2006 +0000
     1.3 @@ -297,8 +297,8 @@ static void shutdown_handler(struct xenb
     1.4  		return;
     1.5  
     1.6   again:
     1.7 -	xbt = xenbus_transaction_start();
     1.8 -	if (IS_ERR(xbt))
     1.9 +	err = xenbus_transaction_start(&xbt);
    1.10 +	if (err)
    1.11  		return;
    1.12  	str = (char *)xenbus_read(xbt, "control", "shutdown", NULL);
    1.13  	/* Ignore read errors and empty reads. */
    1.14 @@ -343,8 +343,8 @@ static void sysrq_handler(struct xenbus_
    1.15  	int err;
    1.16  
    1.17   again:
    1.18 -	xbt  = xenbus_transaction_start();
    1.19 -	if (IS_ERR(xbt))
    1.20 +	err = xenbus_transaction_start(&xbt);
    1.21 +	if (err)
    1.22  		return;
    1.23  	if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
    1.24  		printk(KERN_ERR "Unable to read sysrq code in "
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Jan 11 11:46:32 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Wed Jan 11 12:01:37 2006 +0000
     2.3 @@ -310,10 +310,9 @@ static void connect(struct backend_info 
     2.4  
     2.5  	/* Supply the information about the device the frontend needs */
     2.6  again:
     2.7 -	xbt = xenbus_transaction_start();
     2.8 +	err = xenbus_transaction_start(&xbt);
     2.9  
    2.10 -	if (IS_ERR(xbt)) {
    2.11 -		err = PTR_ERR(xbt);
    2.12 +	if (err) {
    2.13  		xenbus_dev_fatal(dev, err, "starting transaction");
    2.14  		return;
    2.15  	}
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Jan 11 11:46:32 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Jan 11 12:01:37 2006 +0000
     3.3 @@ -170,8 +170,8 @@ static int talk_to_backend(struct xenbus
     3.4  		goto out;
     3.5  
     3.6  again:
     3.7 -	xbt = xenbus_transaction_start();
     3.8 -	if (IS_ERR(xbt)) {
     3.9 +	err = xenbus_transaction_start(&xbt);
    3.10 +	if (err) {
    3.11  		xenbus_dev_fatal(dev, err, "starting transaction");
    3.12  		goto destroy_blkring;
    3.13  	}
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Jan 11 11:46:32 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Jan 11 12:01:37 2006 +0000
     4.3 @@ -275,8 +275,8 @@ static int talk_to_backend(struct xenbus
     4.4  		goto out;
     4.5  
     4.6  again:
     4.7 -	xbt = xenbus_transaction_start();
     4.8 -	if (IS_ERR(xbt)) {
     4.9 +	err = xenbus_transaction_start(&xbt);
    4.10 +	if (err) {
    4.11  		xenbus_dev_fatal(dev, err, "starting transaction");
    4.12  		goto destroy_ring;
    4.13  	}
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed Jan 11 11:46:32 2006 +0000
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed Jan 11 12:01:37 2006 +0000
     5.3 @@ -236,9 +236,8 @@ static void connect(struct backend_info 
     5.4  	unsigned long ready = 1;
     5.5  
     5.6  again:
     5.7 -	xbt = xenbus_transaction_start();
     5.8 -	if (IS_ERR(xbt)) {
     5.9 -		err = PTR_ERR(xbt);
    5.10 +	err = xenbus_transaction_start(&xbt);
    5.11 +	if (err) {
    5.12  		xenbus_dev_fatal(be->dev, err, "starting transaction");
    5.13  		return;
    5.14  	}
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Wed Jan 11 11:46:32 2006 +0000
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Wed Jan 11 12:01:37 2006 +0000
     6.3 @@ -280,8 +280,8 @@ static int talk_to_backend(struct xenbus
     6.4  	}
     6.5  
     6.6  again:
     6.7 -	xbt = xenbus_transaction_start();
     6.8 -	if (IS_ERR(xbt)) {
     6.9 +	err = xenbus_transaction_start(&xbt);
    6.10 +	if (err) {
    6.11  		xenbus_dev_fatal(dev, err, "starting transaction");
    6.12  		goto destroy_tpmring;
    6.13  	}
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Wed Jan 11 11:46:32 2006 +0000
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Wed Jan 11 12:01:37 2006 +0000
     7.3 @@ -147,13 +147,11 @@ static ssize_t xenbus_dev_write(struct f
     7.4  		}
     7.5  
     7.6  		if (u->u.msg.type == XS_TRANSACTION_START) {
     7.7 -			trans->handle = (xenbus_transaction_t)
     7.8 -				simple_strtoul(reply, NULL, 0);
     7.9 +			trans->handle = simple_strtoul(reply, NULL, 0);
    7.10  			list_add(&trans->list, &u->transactions);
    7.11  		} else if (u->u.msg.type == XS_TRANSACTION_END) {
    7.12  			list_for_each_entry(trans, &u->transactions, list)
    7.13 -				if ((unsigned long)trans->handle ==
    7.14 -				    (unsigned long)u->u.msg.tx_id)
    7.15 +				if (trans->handle == u->u.msg.tx_id)
    7.16  					break;
    7.17  			BUG_ON(&trans->list == &u->transactions);
    7.18  			list_del(&trans->list);
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Jan 11 11:46:32 2006 +0000
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Jan 11 12:01:37 2006 +0000
     8.3 @@ -201,7 +201,7 @@ static void *xs_talkv(xenbus_transaction
     8.4  	unsigned int i;
     8.5  	int err;
     8.6  
     8.7 -	msg.tx_id = (u32)(unsigned long)t;
     8.8 +	msg.tx_id = t;
     8.9  	msg.req_id = 0;
    8.10  	msg.type = type;
    8.11  	msg.len = 0;
    8.12 @@ -424,23 +424,21 @@ EXPORT_SYMBOL(xenbus_rm);
    8.13  /* Start a transaction: changes by others will not be seen during this
    8.14   * transaction, and changes will not be visible to others until end.
    8.15   */
    8.16 -xenbus_transaction_t xenbus_transaction_start(void)
    8.17 +int xenbus_transaction_start(xenbus_transaction_t *t)
    8.18  {
    8.19  	char *id_str;
    8.20 -	unsigned long id;
    8.21  
    8.22  	down_read(&xs_state.suspend_mutex);
    8.23  
    8.24  	id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
    8.25  	if (IS_ERR(id_str)) {
    8.26  		up_read(&xs_state.suspend_mutex);
    8.27 -		return (xenbus_transaction_t )id_str;
    8.28 +		return PTR_ERR(id_str);
    8.29  	}
    8.30  
    8.31 -	id = simple_strtoul(id_str, NULL, 0);
    8.32 +	*t = simple_strtoul(id_str, NULL, 0);
    8.33  	kfree(id_str);
    8.34 -
    8.35 -	return (xenbus_transaction_t) id;
    8.36 +	return 0;
    8.37  }
    8.38  EXPORT_SYMBOL(xenbus_transaction_start);
    8.39  
     9.1 --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Wed Jan 11 11:46:32 2006 +0000
     9.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Wed Jan 11 12:01:37 2006 +0000
     9.3 @@ -37,7 +37,7 @@
     9.4  #include <asm-xen/xen-public/io/xenbus.h>
     9.5  #include <asm-xen/xen-public/io/xs_wire.h>
     9.6  
     9.7 -#define XBT_NULL NULL
     9.8 +#define XBT_NULL 0
     9.9  
    9.10  /* Register callback to watch this node. */
    9.11  struct xenbus_watch
    9.12 @@ -102,8 +102,7 @@ int xenbus_register_frontend(struct xenb
    9.13  int xenbus_register_backend(struct xenbus_driver *drv);
    9.14  void xenbus_unregister_driver(struct xenbus_driver *drv);
    9.15  
    9.16 -struct xenbus_transaction;
    9.17 -typedef struct xenbus_transaction *xenbus_transaction_t;
    9.18 +typedef u32 xenbus_transaction_t;
    9.19  
    9.20  char **xenbus_directory(xenbus_transaction_t t,
    9.21  			const char *dir, const char *node, unsigned int *num);
    9.22 @@ -116,7 +115,7 @@ int xenbus_mkdir(xenbus_transaction_t t,
    9.23  int xenbus_exists(xenbus_transaction_t t,
    9.24  		  const char *dir, const char *node);
    9.25  int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
    9.26 -xenbus_transaction_t xenbus_transaction_start(void);
    9.27 +int xenbus_transaction_start(xenbus_transaction_t *t);
    9.28  int xenbus_transaction_end(xenbus_transaction_t t, int abort);
    9.29  
    9.30  /* Single read and scanf: returns -errno or num scanned if > 0. */
    10.1 --- a/tools/python/xen/lowlevel/xs/xs.c	Wed Jan 11 11:46:32 2006 +0000
    10.2 +++ b/tools/python/xen/lowlevel/xs/xs.c	Wed Jan 11 12:01:37 2006 +0000
    10.3 @@ -132,7 +132,7 @@ static PyObject *xspy_write(XsHandle *se
    10.4      if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
    10.5          return NULL;
    10.6  
    10.7 -    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
    10.8 +    th = strtoul(thstr, NULL, 16);
    10.9  
   10.10      Py_BEGIN_ALLOW_THREADS
   10.11      result = xs_write(xh, th, path, data, data_n);
   10.12 @@ -264,7 +264,7 @@ static PyObject *xspy_get_permissions(Xs
   10.13      if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
   10.14          return NULL;
   10.15  
   10.16 -    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   10.17 +    th = strtoul(thstr, NULL, 16);
   10.18  
   10.19      Py_BEGIN_ALLOW_THREADS
   10.20      perms = xs_get_permissions(xh, th, path, &perms_n);
   10.21 @@ -320,7 +320,7 @@ static PyObject *xspy_set_permissions(Xs
   10.22      if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
   10.23          goto exit;
   10.24  
   10.25 -    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   10.26 +    th = strtoul(thstr, NULL, 16);
   10.27  
   10.28      if (!PyList_Check(perms)) {
   10.29          PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
   10.30 @@ -519,7 +519,7 @@ static PyObject *xspy_transaction_start(
   10.31      th = xs_transaction_start(xh);
   10.32      Py_END_ALLOW_THREADS
   10.33  
   10.34 -    if (th == NULL) {
   10.35 +    if (th == XBT_NULL) {
   10.36          PyErr_SetFromErrno(PyExc_RuntimeError);
   10.37          return NULL;
   10.38      }
   10.39 @@ -556,7 +556,7 @@ static PyObject *xspy_transaction_end(Xs
   10.40                                       &thstr, &abort))
   10.41          return NULL;
   10.42  
   10.43 -    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   10.44 +    th = strtoul(thstr, NULL, 16);
   10.45  
   10.46      Py_BEGIN_ALLOW_THREADS
   10.47      result = xs_transaction_end(xh, th, abort);
   10.48 @@ -740,7 +740,7 @@ static int parse_transaction_path(XsHand
   10.49      if (!PyArg_ParseTuple(args, "ss", &thstr, path))
   10.50          return 0;
   10.51  
   10.52 -    *th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   10.53 +    *th = strtoul(thstr, NULL, 16);
   10.54  
   10.55      return 1;
   10.56  }
    11.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Wed Jan 11 11:46:32 2006 +0000
    11.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Wed Jan 11 12:01:37 2006 +0000
    11.3 @@ -705,7 +705,7 @@ static char *xenstat_get_domain_name(xen
    11.4  
    11.5  	snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
    11.6  	
    11.7 -	name = xs_read(handle->xshandle, NULL, path, NULL);
    11.8 +	name = xs_read(handle->xshandle, XBT_NULL, path, NULL);
    11.9  	if (name == NULL)
   11.10  		name = strdup(" ");
   11.11  
    12.1 --- a/tools/xenstore/xenstore_client.c	Wed Jan 11 11:46:32 2006 +0000
    12.2 +++ b/tools/xenstore/xenstore_client.c	Wed Jan 11 12:01:37 2006 +0000
    12.3 @@ -243,7 +243,7 @@ main(int argc, char **argv)
    12.4  
    12.5    again:
    12.6      xth = xs_transaction_start(xsh);
    12.7 -    if (xth == NULL)
    12.8 +    if (xth == XBT_NULL)
    12.9  	errx(1, "couldn't start transaction");
   12.10  
   12.11      ret = perform(optind, argc, argv, xsh, xth, prefix, tidy);
    13.1 --- a/tools/xenstore/xs.c	Wed Jan 11 11:46:32 2006 +0000
    13.2 +++ b/tools/xenstore/xs.c	Wed Jan 11 12:01:37 2006 +0000
    13.3 @@ -304,7 +304,7 @@ static void *xs_talkv(struct xs_handle *
    13.4  	unsigned int i;
    13.5  	struct sigaction ignorepipe, oldact;
    13.6  
    13.7 -	msg.tx_id = (uint32_t)(unsigned long)t;
    13.8 +	msg.tx_id = t;
    13.9  	msg.req_id = 0;
   13.10  	msg.type = type;
   13.11  	msg.len = 0;
   13.12 @@ -634,21 +634,21 @@ bool xs_unwatch(struct xs_handle *h, con
   13.13  /* Start a transaction: changes by others will not be seen during this
   13.14   * transaction, and changes will not be visible to others until end.
   13.15   * You can only have one transaction at any time.
   13.16 - * Returns NULL on failure.
   13.17 + * Returns XBT_NULL on failure.
   13.18   */
   13.19  xs_transaction_t xs_transaction_start(struct xs_handle *h)
   13.20  {
   13.21  	char *id_str;
   13.22 -	unsigned long id;
   13.23 +	xs_transaction_t id;
   13.24  
   13.25  	id_str = xs_single(h, XBT_NULL, XS_TRANSACTION_START, "", NULL);
   13.26  	if (id_str == NULL)
   13.27 -		return NULL;
   13.28 +		return XBT_NULL;
   13.29  
   13.30  	id = strtoul(id_str, NULL, 0);
   13.31  	free(id_str);
   13.32  
   13.33 -	return (xs_transaction_t)id;
   13.34 +	return id;
   13.35  }
   13.36  
   13.37  /* End a transaction.
    14.1 --- a/tools/xenstore/xs.h	Wed Jan 11 11:46:32 2006 +0000
    14.2 +++ b/tools/xenstore/xs.h	Wed Jan 11 12:01:37 2006 +0000
    14.3 @@ -22,11 +22,10 @@
    14.4  
    14.5  #include <xs_lib.h>
    14.6  
    14.7 -#define XBT_NULL NULL
    14.8 +#define XBT_NULL 0
    14.9  
   14.10  struct xs_handle;
   14.11 -struct xs_transaction_t;
   14.12 -typedef struct xs_transaction_t * xs_transaction_t;
   14.13 +typedef uint32_t xs_transaction_t;
   14.14  
   14.15  /* On failure, these routines set errno. */
   14.16