Skip to contentSkip to conversation

replace xenbus_transaction_t with an opaque transaction ID.

PATCH New Chris Wright 1 participant 1 message Jun 9, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replace xenbus_transaction_t with an opaque transaction ID.

From: Jeremy Fitzhardinge <[email protected]>

replace xenbus_transaction_t with an opaque transaction ID. xenbus_transaction_t -> struct xenbus_transaction, which just contains a single u32. Also renamed XBT_NULL to XBT_NIL to emphasize that it isn't a NULL pointer, but a NIL transaction ID. Compile and boot tested.

[chrisw: updated for xen-unstable from patchqueue]
---
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c         |    4 -
 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c      |    2 
 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c       |    8 +--
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c    |    6 +-
 linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c     |    2 
 linux-2.6-xen-sparse/drivers/xen/core/reboot.c          |    4 -
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c       |   12 ++---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c    |    8 +--
 linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c       |   14 +++---
 linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c      |    6 +-
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c       |    6 +-
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c |    8 +--
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c    |    6 +-
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c  |   16 +++----
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c     |   36 ++++++++--------
 linux-2.6-xen-sparse/include/xen/xenbus.h               |   32 ++++++++------
 16 files changed, 87 insertions(+), 83 deletions(-)
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c +2 -2
@@ -274,7 +274,7 @@ static int talk_to_backend(struct xenbus
 {
 	const char *message = NULL;
 	int err;
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 
 	err = setup_tpmring(dev, tp);
 	if (err) {
@@ -369,7 +369,7 @@ static int tpmfront_probe(struct xenbus_
 	if (!tp)
 		return -ENOMEM;
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename,
+	err = xenbus_scanf(XBT_NIL, dev->nodename,
 	                   "handle", "%i", &handle);
 	if (XENBUS_EXIST_ERR(err))
 		return err;
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c +1 -1
@@ -378,7 +378,7 @@ static void watch_target(struct xenbus_w
 	unsigned long long new_target;
 	int err;
 
-	err = xenbus_scanf(XBT_NULL, "memory", "target", "%llu", &new_target);
+	err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
 	if (err != 1) {
 		/* This is ok (for domain0 at least) - so just return */
 		return;
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c +4 -4
@@ -186,7 +186,7 @@ static void backend_changed(struct xenbu
 
 	DPRINTK("");
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename, "physical-device", "%x:%x",
+	err = xenbus_scanf(XBT_NIL, dev->nodename, "physical-device", "%x:%x",
 			   &major, &minor);
 	if (XENBUS_EXIST_ERR(err)) {
 		/* Since this watch will fire once immediately after it is
@@ -208,7 +208,7 @@ static void backend_changed(struct xenbu
 		return;
 	}
 
-	be->mode = xenbus_read(XBT_NULL, dev->nodename, "mode", NULL);
+	be->mode = xenbus_read(XBT_NIL, dev->nodename, "mode", NULL);
 	if (IS_ERR(be->mode)) {
 		err = PTR_ERR(be->mode);
 		be->mode = NULL;
@@ -299,7 +299,7 @@ static void frontend_changed(struct xenb
  */
 static void connect(struct backend_info *be)
 {
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 	struct xenbus_device *dev = be->dev;
 
@@ -364,7 +364,7 @@ static int connect_ring(struct backend_i
 
 	DPRINTK("%s", dev->otherend);
 
-	err = xenbus_gather(XBT_NULL, dev->otherend, "ring-ref", "%lu", &ring_ref,
+	err = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%lu", &ring_ref,
 			    "event-channel", "%u", &evtchn, NULL);
 	if (err) {
 		xenbus_dev_fatal(dev, err,
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +3 -3
@@ -83,7 +83,7 @@ static int blkfront_probe(struct xenbus_
 	struct blkfront_info *info;
 
 	/* FIXME: Use dynamic device id if this is not set. */
-	err = xenbus_scanf(XBT_NULL, dev->nodename,
+	err = xenbus_scanf(XBT_NIL, dev->nodename,
 			   "virtual-device", "%i", &vdevice);
 	if (err != 1) {
 		xenbus_dev_fatal(dev, err, "reading virtual-device");
@@ -148,7 +148,7 @@ static int talk_to_backend(struct xenbus
 			   struct blkfront_info *info)
 {
 	const char *message = NULL;
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 
 	/* Create shared ring, alloc event channel. */
@@ -303,7 +303,7 @@ static void connect(struct blkfront_info
 
 	DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend);
 
-	err = xenbus_gather(XBT_NULL, info->xbdev->otherend,
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
 			    "sectors", "%lu", &sectors,
 			    "info", "%u", &binfo,
 			    "sector-size", "%lu", &sector_size,
linux-2.6-xen-sparse/drivers/xen/core/cpu_hotplug.c +1 -1
@@ -34,7 +34,7 @@ static void vcpu_hotplug(unsigned int cp
 		return;
 
 	sprintf(dir, "cpu/%d", cpu);
-	err = xenbus_scanf(XBT_NULL, dir, "availability", "%s", state);
+	err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state);
 	if (err != 1) {
 		printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
 		return;
linux-2.6-xen-sparse/drivers/xen/core/reboot.c +2 -2
@@ -250,7 +250,7 @@ static void shutdown_handler(struct xenb
 			     const char **vec, unsigned int len)
 {
 	char *str;
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 
 	if (shutting_down != SHUTDOWN_INVALID)
@@ -298,7 +298,7 @@ static void sysrq_handler(struct xenbus_
 			  unsigned int len)
 {
 	char sysrq_key = '\0';
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 
  again:
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c +6 -6
@@ -70,7 +70,7 @@ static int netback_probe(struct xenbus_d
 			 const struct xenbus_device_id *id)
 {
 	const char *message;
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 	struct backend_info *be = kzalloc(sizeof(struct backend_info),
 					  GFP_KERNEL);
@@ -141,7 +141,7 @@ static int netback_uevent(struct xenbus_
 
 	DPRINTK("netback_uevent");
 
-	val = xenbus_read(XBT_NULL, xdev->nodename, "script", NULL);
+	val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL);
 	if (IS_ERR(val)) {
 		int err = PTR_ERR(val);
 		xenbus_dev_fatal(xdev, err, "reading script");
@@ -177,7 +177,7 @@ static void backend_changed(struct xenbu
 
 	DPRINTK("");
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename, "handle", "%li", &handle);
+	err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle);
 	if (XENBUS_EXIST_ERR(err)) {
 		/* Since this watch will fire once immediately after it is
 		   registered, we expect this.  Ignore it, and wait for the
@@ -268,7 +268,7 @@ static void xen_net_read_rate(struct xen
 	*bytes = ~0UL;
 	*usec = 0;
 
-	ratestr = xenbus_read(XBT_NULL, dev->nodename, "rate", NULL);
+	ratestr = xenbus_read(XBT_NIL, dev->nodename, "rate", NULL);
 	if (IS_ERR(ratestr))
 		return;
 
@@ -298,7 +298,7 @@ static int xen_net_read_mac(struct xenbu
 	char *s, *e, *macstr;
 	int i;
 
-	macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
+	macstr = s = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL);
 	if (IS_ERR(macstr))
 		return PTR_ERR(macstr);
 
@@ -347,7 +347,7 @@ static int connect_rings(struct backend_
 
 	DPRINTK("");
 
-	err = xenbus_gather(XBT_NULL, dev->otherend,
+	err = xenbus_gather(XBT_NIL, dev->otherend,
 			    "tx-ring-ref", "%lu", &tx_ring_ref,
 			    "rx-ring-ref", "%lu", &rx_ring_ref,
 			    "event-channel", "%u", &evtchn, NULL);
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +4 -4
@@ -193,7 +193,7 @@ static int __devinit netfront_probe(stru
 	struct netfront_info *info;
 	unsigned int handle;
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename, "handle", "%u", &handle);
+	err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%u", &handle);
 	if (err != 1) {
 		xenbus_dev_fatal(dev, err, "reading handle");
 		return err;
@@ -243,7 +243,7 @@ static int xen_net_read_mac(struct xenbu
 	char *s, *e, *macstr;
 	int i;
 
-	macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
+	macstr = s = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL);
 	if (IS_ERR(macstr))
 		return PTR_ERR(macstr);
 
@@ -265,7 +265,7 @@ static int talk_to_backend(struct xenbus
 			   struct netfront_info *info)
 {
 	const char *message;
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 
 	err = xen_net_read_mac(dev, info->mac);
@@ -1057,7 +1057,7 @@ static int xennet_set_sg(struct net_devi
 		struct netfront_info *np = netdev_priv(dev);
 		int val;
 
-		if (xenbus_scanf(XBT_NULL, np->xbdev->otherend, "feature-sg",
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg",
 				 "%d", &val) < 0)
 			val = 0;
 		if (!val)
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c +7 -7
@@ -125,7 +125,7 @@ static int pciback_attach(struct pciback
 
 	dev_dbg(&pdev->xdev->dev, "Reading frontend config\n");
 
-	err = xenbus_gather(XBT_NULL, pdev->xdev->otherend,
+	err = xenbus_gather(XBT_NIL, pdev->xdev->otherend,
 			    "pci-op-ref", "%u", &gnt_ref,
 			    "event-channel", "%u", &remote_evtchn,
 			    "magic", NULL, &magic, NULL);
@@ -200,7 +200,7 @@ static int pciback_publish_pci_root(stru
 
 	dev_dbg(&pdev->xdev->dev, "Publishing pci roots\n");
 
-	err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename,
+	err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename,
 			   "root_num", "%d", &root_num);
 	if (err == 0 || err == -ENOENT)
 		root_num = 0;
@@ -215,7 +215,7 @@ static int pciback_publish_pci_root(stru
 			goto out;
 		}
 
-		err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename,
+		err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename,
 				   str, "%x:%x", &d, &b);
 		if (err < 0)
 			goto out;
@@ -239,12 +239,12 @@ static int pciback_publish_pci_root(stru
 	dev_dbg(&pdev->xdev->dev, "writing root %d at %04x:%02x\n",
 		root_num, domain, bus);
 
-	err = xenbus_printf(XBT_NULL, pdev->xdev->nodename, str,
+	err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str,
 			    "%04x:%02x", domain, bus);
 	if (err)
 		goto out;
 
-	err = xenbus_printf(XBT_NULL, pdev->xdev->nodename,
+	err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
 			    "root_num", "%d", (root_num + 1));
 
       out:
@@ -306,7 +306,7 @@ static int pciback_setup_backend(struct 
 
 	dev_dbg(&pdev->xdev->dev, "getting be setup\n");
 
-	err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename, "num_devs", "%d",
+	err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d",
 			   &num_devs);
 	if (err != 1) {
 		if (err >= 0)
@@ -326,7 +326,7 @@ static int pciback_setup_backend(struct 
 			goto out;
 		}
 
-		err = xenbus_scanf(XBT_NULL, pdev->xdev->nodename, dev_str,
+		err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, dev_str,
 				   "%x:%x:%x.%x", &domain, &bus, &slot, &func);
 		if (err < 0) {
 			xenbus_dev_fatal(pdev->xdev, err,
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c +3 -3
@@ -67,7 +67,7 @@ static void free_pdev(struct pcifront_de
 static int pcifront_publish_info(struct pcifront_device *pdev)
 {
 	int err = 0;
-	xenbus_transaction_t trans;
+	struct xenbus_transaction trans;
 
 	err = xenbus_grant_ring(pdev->xdev, virt_to_mfn(pdev->sh_info));
 	if (err < 0)
@@ -143,7 +143,7 @@ static int pcifront_try_connect(struct p
 		goto out;
 	}
 
-	err = xenbus_scanf(XBT_NULL, pdev->xdev->otherend,
+	err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend,
 			   "root_num", "%d", &num_roots);
 	if (err == -ENOENT) {
 		xenbus_dev_error(pdev->xdev, err,
@@ -165,7 +165,7 @@ static int pcifront_try_connect(struct p
 			goto out;
 		}
 
-		err = xenbus_scanf(XBT_NULL, pdev->xdev->otherend, str,
+		err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str,
 				   "%x:%x", &domain, &bus);
 		if (err != 2) {
 			if (err >= 0)
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c +3 -3
@@ -110,7 +110,7 @@ static void backend_changed(struct xenbu
 		= container_of(watch, struct backend_info, backend_watch);
 	struct xenbus_device *dev = be->dev;
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename,
+	err = xenbus_scanf(XBT_NIL, dev->nodename,
 	                   "instance","%li", &instance);
 	if (XENBUS_EXIST_ERR(err)) {
 		return;
@@ -204,7 +204,7 @@ static void maybe_connect(struct backend
 
 static void connect(struct backend_info *be)
 {
-	xenbus_transaction_t xbt;
+	struct xenbus_transaction xbt;
 	int err;
 	struct xenbus_device *dev = be->dev;
 	unsigned long ready = 1;
@@ -245,7 +245,7 @@ static int connect_ring(struct backend_i
 	unsigned int evtchn;
 	int err;
 
-	err = xenbus_gather(XBT_NULL, dev->otherend,
+	err = xenbus_gather(XBT_NIL, dev->otherend,
 	                    "ring-ref", "%lu", &ring_ref,
 			    "event-channel", "%u", &evtchn, NULL);
 	if (err) {
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +4 -4
@@ -106,12 +106,12 @@ int xenbus_switch_state(struct xenbus_de
 	if (state == dev->state)
 		return 0;
 
-	err = xenbus_scanf(XBT_NULL, dev->nodename, "state", "%d",
+	err = xenbus_scanf(XBT_NIL, dev->nodename, "state", "%d",
 			   &current_state);
 	if (err != 1)
 		return 0;
 
-	err = xenbus_printf(XBT_NULL, dev->nodename, "state", "%d", state);
+	err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%d", state);
 	if (err) {
 		if (state != XenbusStateClosing) /* Avoid looping */
 			xenbus_dev_fatal(dev, err, "writing new state");
@@ -162,7 +162,7 @@ void _dev_error(struct xenbus_device *de
 		goto fail;
 	}
 
-	if (xenbus_write(XBT_NULL, path_buffer, "error", printf_buffer) != 0) {
+	if (xenbus_write(XBT_NIL, path_buffer, "error", printf_buffer) != 0) {
 		printk("xenbus: failed to write error node for %s (%s)\n",
 		       dev->nodename, printf_buffer);
 		goto fail;
@@ -272,7 +272,7 @@ int xenbus_free_evtchn(struct xenbus_dev
 enum xenbus_state xenbus_read_driver_state(const char *path)
 {
 	enum xenbus_state result;
-	int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
+	int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL);
 	if (err)
 		result = XenbusStateClosed;
 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +3 -3
@@ -51,7 +51,7 @@
 
 struct xenbus_dev_transaction {
 	struct list_head list;
-	xenbus_transaction_t handle;
+	struct xenbus_transaction handle;
 };
 
 struct xenbus_dev_data {
@@ -154,11 +154,11 @@ static ssize_t xenbus_dev_write(struct f
 		}
 
 		if (msg_type == XS_TRANSACTION_START) {
-			trans->handle = simple_strtoul(reply, NULL, 0);
+			trans->handle.id = simple_strtoul(reply, NULL, 0);
 			list_add(&trans->list, &u->transactions);
 		} else if (msg_type == XS_TRANSACTION_END) {
 			list_for_each_entry(trans, &u->transactions, list)
-				if (trans->handle == u->u.msg.tx_id)
+				if (trans->handle.id == u->u.msg.tx_id)
 					break;
 			BUG_ON(&trans->list == &u->transactions);
 			list_del(&trans->list);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +8 -8
@@ -128,7 +128,7 @@ static void free_otherend_watch(struct x
 static int read_otherend_details(struct xenbus_device *xendev,
 				 char *id_node, char *path_node)
 {
-	int err = xenbus_gather(XBT_NULL, xendev->nodename,
+	int err = xenbus_gather(XBT_NIL, xendev->nodename,
 				id_node, "%i", &xendev->otherend_id,
 				path_node, NULL, &xendev->otherend,
 				NULL);
@@ -139,7 +139,7 @@ static int read_otherend_details(struct 
 		return err;
 	}
 	if (strlen(xendev->otherend) == 0 ||
-	    !xenbus_exists(XBT_NULL, xendev->otherend, "")) {
+	    !xenbus_exists(XBT_NIL, xendev->otherend, "")) {
 		xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
 				 xendev->nodename);
 		free_otherend_details(xendev);
@@ -195,14 +195,14 @@ static int backend_bus_id(char bus_id[BU
 
 	devid = strrchr(nodename, '/') + 1;
 
-	err = xenbus_gather(XBT_NULL, nodename, "frontend-id", "%i", &domid,
+	err = xenbus_gather(XBT_NIL, nodename, "frontend-id", "%i", &domid,
 			    "frontend", NULL, &frontend,
 			    NULL);
 	if (err)
 		return err;
 	if (strlen(frontend) == 0)
 		err = -ERANGE;
-	if (!err && !xenbus_exists(XBT_NULL, frontend, ""))
+	if (!err && !xenbus_exists(XBT_NIL, frontend, ""))
 		err = -ENOENT;
 
 	kfree(frontend);
@@ -634,7 +634,7 @@ static int xenbus_probe_backend(const ch
 	if (!nodename)
 		return -ENOMEM;
 
-	dir = xenbus_directory(XBT_NULL, nodename, "", &dir_n);
+	dir = xenbus_directory(XBT_NIL, nodename, "", &dir_n);
 	if (IS_ERR(dir)) {
 		kfree(nodename);
 		return PTR_ERR(dir);
@@ -657,7 +657,7 @@ static int xenbus_probe_device_type(stru
 	unsigned int dir_n = 0;
 	int i;
 
-	dir = xenbus_directory(XBT_NULL, bus->root, type, &dir_n);
+	dir = xenbus_directory(XBT_NIL, bus->root, type, &dir_n);
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
 
@@ -676,7 +676,7 @@ static int xenbus_probe_devices(struct x
 	char **dir;
 	unsigned int i, dir_n;
 
-	dir = xenbus_directory(XBT_NULL, bus->root, "", &dir_n);
+	dir = xenbus_directory(XBT_NIL, bus->root, "", &dir_n);
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
 
@@ -722,7 +722,7 @@ static void dev_changed(const char *node
 	if (char_count(node, '/') < 2)
  		return;
 
-	exists = xenbus_exists(XBT_NULL, node, "");
+	exists = xenbus_exists(XBT_NIL, node, "");
 	if (!exists) {
 		xenbus_cleanup_devices(node, &bus->bus);
 		return;
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +18 -18
@@ -192,7 +192,7 @@ void *xenbus_dev_request_and_reply(struc
 }
 
 /* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
-static void *xs_talkv(xenbus_transaction_t t,
+static void *xs_talkv(struct xenbus_transaction t,
 		      enum xsd_sockmsg_type type,
 		      const struct kvec *iovec,
 		      unsigned int num_vecs,
@@ -203,7 +203,7 @@ static void *xs_talkv(xenbus_transaction
 	unsigned int i;
 	int err;
 
-	msg.tx_id = t;
+	msg.tx_id = t.id;
 	msg.req_id = 0;
 	msg.type = type;
 	msg.len = 0;
@@ -251,7 +251,7 @@ static void *xs_talkv(xenbus_transaction
 }
 
 /* Simplified version of xs_talkv: single message. */
-static void *xs_single(xenbus_transaction_t t,
+static void *xs_single(struct xenbus_transaction t,
 		       enum xsd_sockmsg_type type,
 		       const char *string,
 		       unsigned int *len)
@@ -318,7 +318,7 @@ static char **split(char *strings, unsig
 	return ret;
 }
 
-char **xenbus_directory(xenbus_transaction_t t,
+char **xenbus_directory(struct xenbus_transaction t,
 			const char *dir, const char *node, unsigned int *num)
 {
 	char *strings, *path;
@@ -338,7 +338,7 @@ char **xenbus_directory(xenbus_transacti
 EXPORT_SYMBOL_GPL(xenbus_directory);
 
 /* Check if a path exists. Return 1 if it does. */
-int xenbus_exists(xenbus_transaction_t t,
+int xenbus_exists(struct xenbus_transaction t,
 		  const char *dir, const char *node)
 {
 	char **d;
@@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(xenbus_exists);
  * Returns a kmalloced value: call free() on it after use.
  * len indicates length in bytes.
  */
-void *xenbus_read(xenbus_transaction_t t,
+void *xenbus_read(struct xenbus_transaction t,
 		  const char *dir, const char *node, unsigned int *len)
 {
 	char *path;
@@ -375,7 +375,7 @@ EXPORT_SYMBOL_GPL(xenbus_read);
 /* Write the value of a single file.
  * Returns -err on failure.
  */
-int xenbus_write(xenbus_transaction_t t,
+int xenbus_write(struct xenbus_transaction t,
 		 const char *dir, const char *node, const char *string)
 {
 	const char *path;
@@ -398,7 +398,7 @@ int xenbus_write(xenbus_transaction_t t,
 EXPORT_SYMBOL_GPL(xenbus_write);
 
 /* Create a new directory. */
-int xenbus_mkdir(xenbus_transaction_t t,
+int xenbus_mkdir(struct xenbus_transaction t,
 		 const char *dir, const char *node)
 {
 	char *path;
@@ -415,7 +415,7 @@ int xenbus_mkdir(xenbus_transaction_t t,
 EXPORT_SYMBOL_GPL(xenbus_mkdir);
 
 /* Destroy a file or directory (directories must be empty). */
-int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
+int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node)
 {
 	char *path;
 	int ret;
@@ -433,19 +433,19 @@ EXPORT_SYMBOL_GPL(xenbus_rm);
 /* Start a transaction: changes by others will not be seen during this
  * transaction, and changes will not be visible to others until end.
  */
-int xenbus_transaction_start(xenbus_transaction_t *t)
+int xenbus_transaction_start(struct xenbus_transaction *t)
 {
 	char *id_str;
 
 	down_read(&xs_state.suspend_mutex);
 
-	id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
+	id_str = xs_single(XBT_NIL, XS_TRANSACTION_START, "", NULL);
 	if (IS_ERR(id_str)) {
 		up_read(&xs_state.suspend_mutex);
 		return PTR_ERR(id_str);
 	}
 
-	*t = simple_strtoul(id_str, NULL, 0);
+	t->id = simple_strtoul(id_str, NULL, 0);
 	kfree(id_str);
 	return 0;
 }
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(xenbus_transaction_sta
 /* End a transaction.
  * If abandon is true, transaction is discarded instead of committed.
  */
-int xenbus_transaction_end(xenbus_transaction_t t, int abort)
+int xenbus_transaction_end(struct xenbus_transaction t, int abort)
 {
 	char abortstr[2];
 	int err;
@@ -473,7 +473,7 @@ int xenbus_transaction_end(xenbus_transa
 EXPORT_SYMBOL_GPL(xenbus_transaction_end);
 
 /* Single read and scanf: returns -errno or num scanned. */
-int xenbus_scanf(xenbus_transaction_t t,
+int xenbus_scanf(struct xenbus_transaction t,
 		 const char *dir, const char *node, const char *fmt, ...)
 {
 	va_list ap;
@@ -496,7 +496,7 @@ int xenbus_scanf(xenbus_transaction_t t,
 EXPORT_SYMBOL_GPL(xenbus_scanf);
 
 /* Single printf and write: returns -errno or 0. */
-int xenbus_printf(xenbus_transaction_t t,
+int xenbus_printf(struct xenbus_transaction t,
 		  const char *dir, const char *node, const char *fmt, ...)
 {
 	va_list ap;
@@ -522,7 +522,7 @@ int xenbus_printf(xenbus_transaction_t t
 EXPORT_SYMBOL_GPL(xenbus_printf);
 
 /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
-int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
+int xenbus_gather(struct xenbus_transaction t, const char *dir, ...)
 {
 	va_list ap;
 	const char *name;
@@ -560,7 +560,7 @@ static int xs_watch(const char *path, co
 	iov[1].iov_base = (void *)token;
 	iov[1].iov_len = strlen(token) + 1;
 
-	return xs_error(xs_talkv(XBT_NULL, XS_WATCH, iov,
+	return xs_error(xs_talkv(XBT_NIL, XS_WATCH, iov,
 				 ARRAY_SIZE(iov), NULL));
 }
 
@@ -573,7 +573,7 @@ static int xs_unwatch(const char *path, 
 	iov[1].iov_base = (char *)token;
 	iov[1].iov_len = strlen(token) + 1;
 
-	return xs_error(xs_talkv(XBT_NULL, XS_UNWATCH, iov,
+	return xs_error(xs_talkv(XBT_NIL, XS_UNWATCH, iov,
 				 ARRAY_SIZE(iov), NULL));
 }
 
linux-2.6-xen-sparse/include/xen/xenbus.h +18 -14
@@ -42,8 +42,6 @@
 #include <xen/interface/io/xenbus.h>
 #include <xen/interface/io/xs_wire.h>
 
-#define XBT_NULL 0
-
 /* Register callback to watch this node. */
 struct xenbus_watch
 {
@@ -115,35 +113,41 @@ int xenbus_register_frontend(struct xenb
 int xenbus_register_backend(struct xenbus_driver *drv);
 void xenbus_unregister_driver(struct xenbus_driver *drv);
 
-typedef u32 xenbus_transaction_t;
+struct xenbus_transaction
+{
+	u32 id;
+};
+
+/* Nil transaction ID. */
+#define XBT_NIL ((struct xenbus_transaction) { 0 })
 
-char **xenbus_directory(xenbus_transaction_t t,
+char **xenbus_directory(struct xenbus_transaction t,
 			const char *dir, const char *node, unsigned int *num);
-void *xenbus_read(xenbus_transaction_t t,
+void *xenbus_read(struct xenbus_transaction t,
 		  const char *dir, const char *node, unsigned int *len);
-int xenbus_write(xenbus_transaction_t t,
+int xenbus_write(struct xenbus_transaction t,
 		 const char *dir, const char *node, const char *string);
-int xenbus_mkdir(xenbus_transaction_t t,
+int xenbus_mkdir(struct xenbus_transaction t,
 		 const char *dir, const char *node);
-int xenbus_exists(xenbus_transaction_t t,
+int xenbus_exists(struct xenbus_transaction t,
 		  const char *dir, const char *node);
-int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
-int xenbus_transaction_start(xenbus_transaction_t *t);
-int xenbus_transaction_end(xenbus_transaction_t t, int abort);
+int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node);
+int xenbus_transaction_start(struct xenbus_transaction *t);
+int xenbus_transaction_end(struct xenbus_transaction t, int abort);
 
 /* Single read and scanf: returns -errno or num scanned if > 0. */
-int xenbus_scanf(xenbus_transaction_t t,
+int xenbus_scanf(struct xenbus_transaction t,
 		 const char *dir, const char *node, const char *fmt, ...)
 	__attribute__((format(scanf, 4, 5)));
 
 /* Single printf and write: returns -errno or 0. */
-int xenbus_printf(xenbus_transaction_t t,
+int xenbus_printf(struct xenbus_transaction t,
 		  const char *dir, const char *node, const char *fmt, ...)
 	__attribute__((format(printf, 4, 5)));
 
 /* Generic read function: NULL-terminated triples of name,
  * sprintf-style type string, and pointer. Returns 0 or errno.*/
-int xenbus_gather(xenbus_transaction_t t, const char *dir, ...);
+int xenbus_gather(struct xenbus_transaction t, const char *dir, ...);
 
 /* notifer routines for when the xenstore comes up */
 int register_xenstore_notifier(struct notifier_block *nb);