[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] update xs_transaction_t to be a plain u32 integer instead of a fake pointer.



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID e629bb62c63ea8b95030b347c01112cec8fd66b7
# Parent  f226284e5c1a32ee249f98460d3a28e0350d22e5
update xs_transaction_t to be a plain u32 integer instead of a fake pointer.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Wed Jan 11 11:46:32 2006
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Wed Jan 11 12:01:37 2006
@@ -297,8 +297,8 @@
                return;
 
  again:
-       xbt = xenbus_transaction_start();
-       if (IS_ERR(xbt))
+       err = xenbus_transaction_start(&xbt);
+       if (err)
                return;
        str = (char *)xenbus_read(xbt, "control", "shutdown", NULL);
        /* Ignore read errors and empty reads. */
@@ -343,8 +343,8 @@
        int err;
 
  again:
-       xbt  = xenbus_transaction_start();
-       if (IS_ERR(xbt))
+       err = xenbus_transaction_start(&xbt);
+       if (err)
                return;
        if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
                printk(KERN_ERR "Unable to read sysrq code in "
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Jan 11 11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Wed Jan 11 12:01:37 2006
@@ -310,10 +310,9 @@
 
        /* Supply the information about the device the frontend needs */
 again:
-       xbt = xenbus_transaction_start();
-
-       if (IS_ERR(xbt)) {
-               err = PTR_ERR(xbt);
+       err = xenbus_transaction_start(&xbt);
+
+       if (err) {
                xenbus_dev_fatal(dev, err, "starting transaction");
                return;
        }
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Wed Jan 11 
11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Wed Jan 11 
12:01:37 2006
@@ -170,8 +170,8 @@
                goto out;
 
 again:
-       xbt = xenbus_transaction_start();
-       if (IS_ERR(xbt)) {
+       err = xenbus_transaction_start(&xbt);
+       if (err) {
                xenbus_dev_fatal(dev, err, "starting transaction");
                goto destroy_blkring;
        }
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Jan 11 
11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Jan 11 
12:01:37 2006
@@ -275,8 +275,8 @@
                goto out;
 
 again:
-       xbt = xenbus_transaction_start();
-       if (IS_ERR(xbt)) {
+       err = xenbus_transaction_start(&xbt);
+       if (err) {
                xenbus_dev_fatal(dev, err, "starting transaction");
                goto destroy_ring;
        }
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Wed Jan 11 11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Wed Jan 11 12:01:37 2006
@@ -236,9 +236,8 @@
        unsigned long ready = 1;
 
 again:
-       xbt = xenbus_transaction_start();
-       if (IS_ERR(xbt)) {
-               err = PTR_ERR(xbt);
+       err = xenbus_transaction_start(&xbt);
+       if (err) {
                xenbus_dev_fatal(be->dev, err, "starting transaction");
                return;
        }
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Wed Jan 11 
11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Wed Jan 11 
12:01:37 2006
@@ -280,8 +280,8 @@
        }
 
 again:
-       xbt = xenbus_transaction_start();
-       if (IS_ERR(xbt)) {
+       err = xenbus_transaction_start(&xbt);
+       if (err) {
                xenbus_dev_fatal(dev, err, "starting transaction");
                goto destroy_tpmring;
        }
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Wed Jan 11 
11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Wed Jan 11 
12:01:37 2006
@@ -147,13 +147,11 @@
                }
 
                if (u->u.msg.type == XS_TRANSACTION_START) {
-                       trans->handle = (xenbus_transaction_t)
-                               simple_strtoul(reply, NULL, 0);
+                       trans->handle = simple_strtoul(reply, NULL, 0);
                        list_add(&trans->list, &u->transactions);
                } else if (u->u.msg.type == XS_TRANSACTION_END) {
                        list_for_each_entry(trans, &u->transactions, list)
-                               if ((unsigned long)trans->handle ==
-                                   (unsigned long)u->u.msg.tx_id)
+                               if (trans->handle == u->u.msg.tx_id)
                                        break;
                        BUG_ON(&trans->list == &u->transactions);
                        list_del(&trans->list);
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Wed Jan 11 
11:46:32 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Wed Jan 11 
12:01:37 2006
@@ -201,7 +201,7 @@
        unsigned int i;
        int err;
 
-       msg.tx_id = (u32)(unsigned long)t;
+       msg.tx_id = t;
        msg.req_id = 0;
        msg.type = type;
        msg.len = 0;
@@ -424,23 +424,21 @@
 /* Start a transaction: changes by others will not be seen during this
  * transaction, and changes will not be visible to others until end.
  */
-xenbus_transaction_t xenbus_transaction_start(void)
+int xenbus_transaction_start(xenbus_transaction_t *t)
 {
        char *id_str;
-       unsigned long id;
 
        down_read(&xs_state.suspend_mutex);
 
        id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
        if (IS_ERR(id_str)) {
                up_read(&xs_state.suspend_mutex);
-               return (xenbus_transaction_t )id_str;
-       }
-
-       id = simple_strtoul(id_str, NULL, 0);
+               return PTR_ERR(id_str);
+       }
+
+       *t = simple_strtoul(id_str, NULL, 0);
        kfree(id_str);
-
-       return (xenbus_transaction_t) id;
+       return 0;
 }
 EXPORT_SYMBOL(xenbus_transaction_start);
 
diff -r f226284e5c1a -r e629bb62c63e 
linux-2.6-xen-sparse/include/asm-xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Wed Jan 11 11:46:32 2006
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Wed Jan 11 12:01:37 2006
@@ -37,7 +37,7 @@
 #include <asm-xen/xen-public/io/xenbus.h>
 #include <asm-xen/xen-public/io/xs_wire.h>
 
-#define XBT_NULL NULL
+#define XBT_NULL 0
 
 /* Register callback to watch this node. */
 struct xenbus_watch
@@ -102,8 +102,7 @@
 int xenbus_register_backend(struct xenbus_driver *drv);
 void xenbus_unregister_driver(struct xenbus_driver *drv);
 
-struct xenbus_transaction;
-typedef struct xenbus_transaction *xenbus_transaction_t;
+typedef u32 xenbus_transaction_t;
 
 char **xenbus_directory(xenbus_transaction_t t,
                        const char *dir, const char *node, unsigned int *num);
@@ -116,7 +115,7 @@
 int xenbus_exists(xenbus_transaction_t t,
                  const char *dir, const char *node);
 int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
-xenbus_transaction_t xenbus_transaction_start(void);
+int xenbus_transaction_start(xenbus_transaction_t *t);
 int xenbus_transaction_end(xenbus_transaction_t t, int abort);
 
 /* Single read and scanf: returns -errno or num scanned if > 0. */
diff -r f226284e5c1a -r e629bb62c63e tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Wed Jan 11 11:46:32 2006
+++ b/tools/python/xen/lowlevel/xs/xs.c Wed Jan 11 12:01:37 2006
@@ -132,7 +132,7 @@
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
         return NULL;
 
-    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+    th = strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_write(xh, th, path, data, data_n);
@@ -264,7 +264,7 @@
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
         return NULL;
 
-    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+    th = strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     perms = xs_get_permissions(xh, th, path, &perms_n);
@@ -320,7 +320,7 @@
     if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
         goto exit;
 
-    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+    th = strtoul(thstr, NULL, 16);
 
     if (!PyList_Check(perms)) {
         PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
@@ -519,7 +519,7 @@
     th = xs_transaction_start(xh);
     Py_END_ALLOW_THREADS
 
-    if (th == NULL) {
+    if (th == XBT_NULL) {
         PyErr_SetFromErrno(PyExc_RuntimeError);
         return NULL;
     }
@@ -556,7 +556,7 @@
                                      &thstr, &abort))
         return NULL;
 
-    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+    th = strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_transaction_end(xh, th, abort);
@@ -740,7 +740,7 @@
     if (!PyArg_ParseTuple(args, "ss", &thstr, path))
         return 0;
 
-    *th = (xs_transaction_t)strtoul(thstr, NULL, 16);
+    *th = strtoul(thstr, NULL, 16);
 
     return 1;
 }
diff -r f226284e5c1a -r e629bb62c63e tools/xenstat/libxenstat/src/xenstat.c
--- a/tools/xenstat/libxenstat/src/xenstat.c    Wed Jan 11 11:46:32 2006
+++ b/tools/xenstat/libxenstat/src/xenstat.c    Wed Jan 11 12:01:37 2006
@@ -705,7 +705,7 @@
 
        snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
        
-       name = xs_read(handle->xshandle, NULL, path, NULL);
+       name = xs_read(handle->xshandle, XBT_NULL, path, NULL);
        if (name == NULL)
                name = strdup(" ");
 
diff -r f226284e5c1a -r e629bb62c63e tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c  Wed Jan 11 11:46:32 2006
+++ b/tools/xenstore/xenstore_client.c  Wed Jan 11 12:01:37 2006
@@ -243,7 +243,7 @@
 
   again:
     xth = xs_transaction_start(xsh);
-    if (xth == NULL)
+    if (xth == XBT_NULL)
        errx(1, "couldn't start transaction");
 
     ret = perform(optind, argc, argv, xsh, xth, prefix, tidy);
diff -r f226284e5c1a -r e629bb62c63e tools/xenstore/xs.c
--- a/tools/xenstore/xs.c       Wed Jan 11 11:46:32 2006
+++ b/tools/xenstore/xs.c       Wed Jan 11 12:01:37 2006
@@ -304,7 +304,7 @@
        unsigned int i;
        struct sigaction ignorepipe, oldact;
 
-       msg.tx_id = (uint32_t)(unsigned long)t;
+       msg.tx_id = t;
        msg.req_id = 0;
        msg.type = type;
        msg.len = 0;
@@ -634,21 +634,21 @@
 /* Start a transaction: changes by others will not be seen during this
  * transaction, and changes will not be visible to others until end.
  * You can only have one transaction at any time.
- * Returns NULL on failure.
+ * Returns XBT_NULL on failure.
  */
 xs_transaction_t xs_transaction_start(struct xs_handle *h)
 {
        char *id_str;
-       unsigned long id;
+       xs_transaction_t id;
 
        id_str = xs_single(h, XBT_NULL, XS_TRANSACTION_START, "", NULL);
        if (id_str == NULL)
-               return NULL;
+               return XBT_NULL;
 
        id = strtoul(id_str, NULL, 0);
        free(id_str);
 
-       return (xs_transaction_t)id;
+       return id;
 }
 
 /* End a transaction.
diff -r f226284e5c1a -r e629bb62c63e tools/xenstore/xs.h
--- a/tools/xenstore/xs.h       Wed Jan 11 11:46:32 2006
+++ b/tools/xenstore/xs.h       Wed Jan 11 12:01:37 2006
@@ -22,11 +22,10 @@
 
 #include <xs_lib.h>
 
-#define XBT_NULL NULL
+#define XBT_NULL 0
 
 struct xs_handle;
-struct xs_transaction_t;
-typedef struct xs_transaction_t * xs_transaction_t;
+typedef uint32_t xs_transaction_t;
 
 /* On failure, these routines set errno. */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.