From: "Jan Beulich" Subject: [PATCH] linux-2.6.18: xenbus_gather()/xenbus_scanf() usage adjustments Date: Fri, 17 Jun 2011 16:37:34 +0100 Message-ID: <4DFB90DE02000078000480E9@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0428BFAE.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0428BFAE.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline - don't use xenbus_gather() for just a single, non-string item (as it doesn't do format checking on its inputs) - grant references don't need to be parsed as "long", since grant_ref_t is a typedef of uint32_t - in the frontend protocol determination logic in blkback and blktap, don't parse into a local buffer - use the allocated string directly Signed-off-by: Jan Beulcih --- a/drivers/xen/blkback/xenbus.c +++ b/drivers/xen/blkback/xenbus.c @@ -485,14 +485,13 @@ again: static int connect_ring(struct backend_info *be) { struct xenbus_device *dev =3D be->dev; - unsigned long ring_ref; - unsigned int evtchn; - char protocol[64] =3D ""; + unsigned int ring_ref, evtchn; + char *protocol; int err; =20 DPRINTK("%s", dev->otherend); =20 - err =3D xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%lu", = &ring_ref, + err =3D xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%u", = &ring_ref, "event-channel", "%u", &evtchn, NULL); if (err) { xenbus_dev_fatal(dev, err, @@ -503,9 +502,9 @@ static int connect_ring(struct backend_i =20 be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE; err =3D xenbus_gather(XBT_NIL, dev->otherend, "protocol", - "%63s", protocol, NULL); + NULL, &protocol, NULL); if (err) - strcpy(protocol, "unspecified, assuming native"); + protocol =3D NULL; else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE; else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) @@ -514,16 +513,19 @@ static int connect_ring(struct backend_i be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_64; else { xenbus_dev_fatal(dev, err, "unknown fe protocol %s", = protocol); + kfree(protocol); return -1; } printk(KERN_INFO - "blkback: ring-ref %ld, event-channel %d, protocol %d = (%s)\n", - ring_ref, evtchn, be->blkif->blk_protocol, protocol); + "blkback: ring-ref %u, event-channel %u, protocol %d = (%s)\n", + ring_ref, evtchn, be->blkif->blk_protocol, + protocol ?: "unspecified, assuming native"); + kfree(protocol); =20 /* Map the shared frame, irq etc. */ err =3D blkif_map(be->blkif, ring_ref, evtchn); if (err) { - xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u", + xenbus_dev_fatal(dev, err, "mapping ring-ref %u port %u", ring_ref, evtchn); return err; } --- a/drivers/xen/blkfront/blkfront.c +++ b/drivers/xen/blkfront/blkfront.c @@ -334,7 +334,7 @@ static void connect(struct blkfront_info */ err =3D xenbus_scanf(XBT_NIL, info->xbdev->otherend, "sectors", "%Lu", §ors); - if (XENBUS_EXIST_ERR(err)) + if (err !=3D 1) return; printk(KERN_INFO "Setting capacity to %Lu\n", sectors); @@ -359,10 +359,9 @@ static void connect(struct blkfront_info return; } =20 - err =3D xenbus_gather(XBT_NIL, info->xbdev->otherend, - "feature-barrier", "%d", &info->feature_barrier= , - NULL); - if (err) + err =3D xenbus_scanf(XBT_NIL, info->xbdev->otherend, + "feature-barrier", "%d", &info->feature_barrier)= ; + if (err <=3D 0) info->feature_barrier =3D 0; =20 err =3D xlvbd_add(sectors, info->vdevice, binfo, sector_size, = info); --- a/drivers/xen/blktap/xenbus.c +++ b/drivers/xen/blktap/xenbus.c @@ -319,7 +319,7 @@ static void tap_backend_changed(struct x * and disk info to xenstore */ err =3D xenbus_gather(XBT_NIL, dev->nodename, "info", "%lu", = &info,=20 - NULL); + "sectors", "%Lu", &be->blkif->sectors, NULL); if (XENBUS_EXIST_ERR(err)) return; if (err) { @@ -329,9 +329,6 @@ static void tap_backend_changed(struct x =20 DPRINTK("Userspace update on disk info, %lu\n",info); =20 - err =3D xenbus_gather(XBT_NIL, dev->nodename, "sectors", "%llu",=20= - &be->blkif->sectors, NULL); - /* Associate tap dev with domid*/ be->blkif->dev_num =3D dom_to_devid(be->blkif->domid, be->xenbus_id= ,=20 be->blkif); @@ -436,14 +433,13 @@ again: static int connect_ring(struct backend_info *be) { struct xenbus_device *dev =3D be->dev; - unsigned long ring_ref; - unsigned int evtchn; - char protocol[64]; + unsigned int ring_ref, evtchn; + char *protocol; int err; =20 DPRINTK("%s\n", dev->otherend); =20 - err =3D xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", = "%lu",=20 + err =3D xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%u", &ring_ref, "event-channel", "%u", &evtchn, = NULL); if (err) { xenbus_dev_fatal(dev, err, @@ -454,9 +450,9 @@ static int connect_ring(struct backend_i =20 be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE; err =3D xenbus_gather(XBT_NIL, dev->otherend, "protocol", - "%63s", protocol, NULL); + NULL, &protocol, NULL); if (err) - strcpy(protocol, "unspecified, assuming native"); + protocol =3D NULL; else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE; else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) @@ -465,16 +461,19 @@ static int connect_ring(struct backend_i be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_64; else { xenbus_dev_fatal(dev, err, "unknown fe protocol %s", = protocol); + kfree(protocol); return -1; } printk(KERN_INFO - "blktap: ring-ref %ld, event-channel %d, protocol %d = (%s)\n", - ring_ref, evtchn, be->blkif->blk_protocol, protocol); + "blktap: ring-ref %u, event-channel %u, protocol %d = (%s)\n", + ring_ref, evtchn, be->blkif->blk_protocol, + protocol ?: "unspecified, assuming native"); + kfree(protocol); =20 /* Map the shared frame, irq etc. */ err =3D tap_blkif_map(be->blkif, dev, ring_ref, evtchn); if (err) { - xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u", + xenbus_dev_fatal(dev, err, "mapping ring-ref %u port %u", ring_ref, evtchn); return err; }=20 --- a/drivers/xen/core/reboot.c +++ b/drivers/xen/core/reboot.c @@ -215,7 +215,7 @@ static void sysrq_handler(struct xenbus_ err =3D xenbus_transaction_start(&xbt); if (err) return; - if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) { + if (xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key) <=3D = 0) { printk(KERN_ERR "Unable to read sysrq code in " "control/sysrq\n"); xenbus_transaction_end(xbt, 1); --- a/drivers/xen/netback/xenbus.c +++ b/drivers/xen/netback/xenbus.c @@ -358,7 +358,7 @@ static int connect_rings(struct backend_ { netif_t *netif =3D be->netif; struct xenbus_device *dev =3D be->dev; - unsigned long tx_ring_ref, rx_ring_ref; + unsigned int tx_ring_ref, rx_ring_ref; unsigned int evtchn, rx_copy; int err; int val; @@ -366,8 +366,8 @@ static int connect_rings(struct backend_ DPRINTK(""); =20 err =3D xenbus_gather(XBT_NIL, dev->otherend, - "tx-ring-ref", "%lu", &tx_ring_ref, - "rx-ring-ref", "%lu", &rx_ring_ref, + "tx-ring-ref", "%u", &tx_ring_ref, + "rx-ring-ref", "%u", &rx_ring_ref, "event-channel", "%u", &evtchn, NULL); if (err) { xenbus_dev_fatal(dev, err, @@ -421,7 +421,7 @@ static int connect_rings(struct backend_ err =3D netif_map(be, tx_ring_ref, rx_ring_ref, evtchn); if (err) { xenbus_dev_fatal(dev, err, - "mapping shared-frames %lu/%lu port %u", + "mapping shared-frames %u/%u port %u", tx_ring_ref, rx_ring_ref, evtchn); return err; } --- a/drivers/xen/scsiback/xenbus.c +++ b/drivers/xen/scsiback/xenbus.c @@ -60,13 +60,12 @@ static int __vscsiif_name(struct backend static int scsiback_map(struct backend_info *be) { struct xenbus_device *dev =3D be->dev; - unsigned long ring_ref; - unsigned int evtchn; + unsigned int ring_ref, evtchn; int err; char name[TASK_COMM_LEN]; =20 err =3D xenbus_gather(XBT_NIL, dev->otherend, - "ring-ref", "%lu", &ring_ref, + "ring-ref", "%u", &ring_ref, "event-channel", "%u", &evtchn, NULL); if (err) { xenbus_dev_fatal(dev, err, "reading %s ring", dev->otherend= ); --- a/drivers/xen/tpmback/xenbus.c +++ b/drivers/xen/tpmback/xenbus.c @@ -210,12 +210,11 @@ abort: static int connect_ring(struct backend_info *be) { struct xenbus_device *dev =3D be->dev; - unsigned long ring_ref; - unsigned int evtchn; + unsigned int ring_ref, evtchn; int err; =20 err =3D xenbus_gather(XBT_NIL, dev->otherend, - "ring-ref", "%lu", &ring_ref, + "ring-ref", "%u", &ring_ref, "event-channel", "%u", &evtchn, NULL); if (err) { xenbus_dev_error(dev, err, @@ -238,7 +237,7 @@ static int connect_ring(struct backend_i err =3D tpmif_map(be->tpmif, ring_ref, evtchn); if (err) { xenbus_dev_error(dev, err, - "mapping shared-frame %lu port = %u", + "mapping shared-frame %u port = %u", ring_ref, evtchn); return err; } --- a/drivers/xen/usbback/xenbus.c +++ b/drivers/xen/usbback/xenbus.c @@ -226,14 +226,12 @@ fail: static int connect_rings(usbif_t *usbif) { struct xenbus_device *dev =3D usbif->xbdev; - unsigned long urb_ring_ref; - unsigned long conn_ring_ref; - unsigned int evtchn; + unsigned int urb_ring_ref, conn_ring_ref, evtchn; int err; =20 err =3D xenbus_gather(XBT_NIL, dev->otherend, - "urb-ring-ref", "%lu", &urb_ring_ref, - "conn-ring-ref", "%lu", &conn_ring_ref, + "urb-ring-ref", "%u", &urb_ring_ref, + "conn-ring-ref", "%u", &conn_ring_ref, "event-channel", "%u", &evtchn, NULL); if (err) { xenbus_dev_fatal(dev, err, @@ -242,13 +240,14 @@ static int connect_rings(usbif_t *usbif) return err; } =20 - printk("usbback: urb-ring-ref %ld, conn-ring-ref %ld, event-channel= %d\n", + printk("usbback: urb-ring-ref %u, conn-ring-ref %u," + " event-channel %u\n", urb_ring_ref, conn_ring_ref, evtchn); =20 err =3D usbif_map(usbif, urb_ring_ref, conn_ring_ref, evtchn); if (err) { xenbus_dev_fatal(dev, err, - "mapping urb-ring-ref %lu conn-ring-ref = %lu port %u", + "mapping urb-ring-ref %u conn-ring-ref %u = port %u", urb_ring_ref, conn_ring_ref, evtchn); return err; } --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -276,9 +276,9 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); =20 enum xenbus_state xenbus_read_driver_state(const char *path) { - enum xenbus_state result; - int err =3D xenbus_gather(XBT_NIL, path, "state", "%d", &result, = NULL); - if (err) + int result; + + if (xenbus_scanf(XBT_NIL, path, "state", "%d", &result) !=3D 1) result =3D XenbusStateUnknown; =20 return result; --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -865,7 +865,8 @@ static int be_state; =20 static void xenbus_reset_state_changed(struct xenbus_watch *w, const char = **v, unsigned int l) { - xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &be_state); + if (xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &be_state) = !=3D 1) + be_state =3D XenbusStateUnknown; printk(KERN_INFO "XENBUS: %s %s\n", v[XS_WATCH_PATH], xenbus_strsta= te(be_state)); wake_up(&be_state_wq); } --=__Part0428BFAE.0__= Content-Type: text/plain; name="xen-xenbus-scanf-gather.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-xenbus-scanf-gather.patch" Subject: xenbus_gather()/xenbus_scanf() usage adjustments=0A=0A- don't use = xenbus_gather() for just a single, non-string item (as it=0A doesn't do = format checking on its inputs)=0A- grant references don't need to be = parsed as "long", since grant_ref_t=0A is a typedef of uint32_t=0A- in = the frontend protocol determination logic in blkback and blktap,=0A don't = parse into a local buffer - use the allocated string directly=0A=0ASigned-o= ff-by: Jan Beulcih =0A=0A--- a/drivers/xen/blkback/xen= bus.c=0A+++ b/drivers/xen/blkback/xenbus.c=0A@@ -485,14 +485,13 @@ = again:=0A static int connect_ring(struct backend_info *be)=0A {=0A = struct xenbus_device *dev =3D be->dev;=0A- unsigned long ring_ref;=0A-= unsigned int evtchn;=0A- char protocol[64] =3D "";=0A+ = unsigned int ring_ref, evtchn;=0A+ char *protocol;=0A int = err;=0A =0A DPRINTK("%s", dev->otherend);=0A =0A- err =3D xenbus_gath= er(XBT_NIL, dev->otherend, "ring-ref", "%lu", &ring_ref,=0A+ err =3D = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%u", &ring_ref,=0A = "event-channel", "%u", &evtchn, NULL);=0A if (err) {=0A = xenbus_dev_fatal(dev, err,=0A@@ -503,9 +502,9 @@ static int connect_ring(st= ruct backend_i=0A =0A be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE;= =0A err =3D xenbus_gather(XBT_NIL, dev->otherend, "protocol",=0A- = "%63s", protocol, NULL);=0A+ NULL, = &protocol, NULL);=0A if (err)=0A- strcpy(protocol, "unspecifi= ed, assuming native");=0A+ protocol =3D NULL;=0A else if (0 = =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE))=0A be->blkif->= blk_protocol =3D BLKIF_PROTOCOL_NATIVE;=0A else if (0 =3D=3D = strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))=0A@@ -514,16 +513,19 @@ static = int connect_ring(struct backend_i=0A be->blkif->blk_protocol = =3D BLKIF_PROTOCOL_X86_64;=0A else {=0A xenbus_dev_fatal(de= v, err, "unknown fe protocol %s", protocol);=0A+ kfree(proto= col);=0A return -1;=0A }=0A printk(KERN_INFO=0A- = "blkback: ring-ref %ld, event-channel %d, protocol %d (%s)\n",=0A- = ring_ref, evtchn, be->blkif->blk_protocol, protocol);=0A+ = "blkback: ring-ref %u, event-channel %u, protocol %d (%s)\n",=0A+ = ring_ref, evtchn, be->blkif->blk_protocol,=0A+ protocol ?: = "unspecified, assuming native");=0A+ kfree(protocol);=0A =0A /* = Map the shared frame, irq etc. */=0A err =3D blkif_map(be->blkif, = ring_ref, evtchn);=0A if (err) {=0A- xenbus_dev_fatal(dev, err, = "mapping ring-ref %lu port %u",=0A+ xenbus_dev_fatal(dev, err, = "mapping ring-ref %u port %u",=0A ring_ref, = evtchn);=0A return err;=0A }=0A--- a/drivers/xen/blkfront/blkf= ront.c=0A+++ b/drivers/xen/blkfront/blkfront.c=0A@@ -334,7 +334,7 @@ = static void connect(struct blkfront_info=0A */=0A = err =3D xenbus_scanf(XBT_NIL, info->xbdev->otherend,=0A = "sectors", "%Lu", §ors);=0A- if (XENBUS_EXIST_ER= R(err))=0A+ if (err !=3D 1)=0A return;=0A = printk(KERN_INFO "Setting capacity to %Lu\n",=0A = sectors);=0A@@ -359,10 +359,9 @@ static void connect(struct = blkfront_info=0A return;=0A }=0A =0A- err =3D = xenbus_gather(XBT_NIL, info->xbdev->otherend,=0A- = "feature-barrier", "%d", &info->feature_barrier,=0A- = NULL);=0A- if (err)=0A+ err =3D xenbus_scanf(XBT_NIL, info->xbdev->= otherend,=0A+ "feature-barrier", "%d", &info->feature_= barrier);=0A+ if (err <=3D 0)=0A info->feature_barrier =3D = 0;=0A =0A err =3D xlvbd_add(sectors, info->vdevice, binfo, sector_siz= e, info);=0A--- a/drivers/xen/blktap/xenbus.c=0A+++ b/drivers/xen/blktap/xe= nbus.c=0A@@ -319,7 +319,7 @@ static void tap_backend_changed(struct x=0A = * and disk info to xenstore=0A */=0A err =3D xenbus_gather(XBT_N= IL, dev->nodename, "info", "%lu", &info, =0A- = NULL);=0A+ "sectors", "%Lu", &be->blkif->sectors, = NULL);=0A if (XENBUS_EXIST_ERR(err))=0A return;=0A if = (err) {=0A@@ -329,9 +329,6 @@ static void tap_backend_changed(struct x=0A = =0A DPRINTK("Userspace update on disk info, %lu\n",info);=0A =0A- = err =3D xenbus_gather(XBT_NIL, dev->nodename, "sectors", "%llu", =0A- = &be->blkif->sectors, NULL);=0A-=0A /* Associate tap dev with = domid*/=0A be->blkif->dev_num =3D dom_to_devid(be->blkif->domid, = be->xenbus_id, =0A be->blkif);=0A@@ = -436,14 +433,13 @@ again:=0A static int connect_ring(struct backend_info = *be)=0A {=0A struct xenbus_device *dev =3D be->dev;=0A- unsigned = long ring_ref;=0A- unsigned int evtchn;=0A- char protocol[64];= =0A+ unsigned int ring_ref, evtchn;=0A+ char *protocol;=0A = int err;=0A =0A DPRINTK("%s\n", dev->otherend);=0A =0A- err =3D = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%lu", =0A+ err =3D = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%u",=0A = &ring_ref, "event-channel", "%u", &evtchn, NULL);=0A if (err) = {=0A xenbus_dev_fatal(dev, err,=0A@@ -454,9 +450,9 @@ static = int connect_ring(struct backend_i=0A =0A be->blkif->blk_protocol = =3D BLKIF_PROTOCOL_NATIVE;=0A err =3D xenbus_gather(XBT_NIL, dev->otheren= d, "protocol",=0A- "%63s", protocol, NULL);=0A+ = NULL, &protocol, NULL);=0A if (err)=0A- = strcpy(protocol, "unspecified, assuming native");=0A+ protocol = =3D NULL;=0A else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)= )=0A be->blkif->blk_protocol =3D BLKIF_PROTOCOL_NATIVE;=0A = else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))=0A@@ -465,16 = +461,19 @@ static int connect_ring(struct backend_i=0A be->blkif->= blk_protocol =3D BLKIF_PROTOCOL_X86_64;=0A else {=0A = xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);=0A+ = kfree(protocol);=0A return -1;=0A }=0A printk(KERN_INFO=0A= - "blktap: ring-ref %ld, event-channel %d, protocol %d = (%s)\n",=0A- ring_ref, evtchn, be->blkif->blk_protocol, = protocol);=0A+ "blktap: ring-ref %u, event-channel %u, protocol %d = (%s)\n",=0A+ ring_ref, evtchn, be->blkif->blk_protocol,=0A+ = protocol ?: "unspecified, assuming native");=0A+ kfree(protocol);=0A= =0A /* Map the shared frame, irq etc. */=0A err =3D tap_blkif_m= ap(be->blkif, dev, ring_ref, evtchn);=0A if (err) {=0A- = xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u",=0A+ = xenbus_dev_fatal(dev, err, "mapping ring-ref %u port %u",=0A = ring_ref, evtchn);=0A return err;=0A } =0A--- a/drivers/= xen/core/reboot.c=0A+++ b/drivers/xen/core/reboot.c=0A@@ -215,7 +215,7 @@ = static void sysrq_handler(struct xenbus_=0A err =3D xenbus_transaction_= start(&xbt);=0A if (err)=0A return;=0A- if = (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {=0A+ if = (xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key) <=3D 0) {=0A = printk(KERN_ERR "Unable to read sysrq code in "=0A = "control/sysrq\n");=0A xenbus_transaction_end(xbt, 1);=0A--- = a/drivers/xen/netback/xenbus.c=0A+++ b/drivers/xen/netback/xenbus.c=0A@@ = -358,7 +358,7 @@ static int connect_rings(struct backend_=0A {=0A = netif_t *netif =3D be->netif;=0A struct xenbus_device *dev =3D = be->dev;=0A- unsigned long tx_ring_ref, rx_ring_ref;=0A+ unsigned = int tx_ring_ref, rx_ring_ref;=0A unsigned int evtchn, rx_copy;=0A = int err;=0A int val;=0A@@ -366,8 +366,8 @@ static int connect_rings(str= uct backend_=0A DPRINTK("");=0A =0A err =3D xenbus_gather(XBT_N= IL, dev->otherend,=0A- "tx-ring-ref", "%lu", = &tx_ring_ref,=0A- "rx-ring-ref", "%lu", = &rx_ring_ref,=0A+ "tx-ring-ref", "%u", &tx_ring_r= ef,=0A+ "rx-ring-ref", "%u", &rx_ring_ref,=0A = "event-channel", "%u", &evtchn, NULL);=0A if (err) {=0A = xenbus_dev_fatal(dev, err,=0A@@ -421,7 +421,7 @@ static int connect_rings(s= truct backend_=0A err =3D netif_map(be, tx_ring_ref, rx_ring_ref, = evtchn);=0A if (err) {=0A xenbus_dev_fatal(dev, err,=0A- = "mapping shared-frames %lu/%lu port %u",=0A+ = "mapping shared-frames %u/%u port %u",=0A = tx_ring_ref, rx_ring_ref, evtchn);=0A return err;=0A }=0A--- = a/drivers/xen/scsiback/xenbus.c=0A+++ b/drivers/xen/scsiback/xenbus.c=0A@@ = -60,13 +60,12 @@ static int __vscsiif_name(struct backend=0A static int = scsiback_map(struct backend_info *be)=0A {=0A struct xenbus_device *dev = =3D be->dev;=0A- unsigned long ring_ref;=0A- unsigned int = evtchn;=0A+ unsigned int ring_ref, evtchn;=0A int err;=0A = char name[TASK_COMM_LEN];=0A =0A err =3D xenbus_gather(XBT_NIL, = dev->otherend,=0A- "ring-ref", "%lu", &ring_ref,=0A+ = "ring-ref", "%u", &ring_ref,=0A = "event-channel", "%u", &evtchn, NULL);=0A if (err) {=0A = xenbus_dev_fatal(dev, err, "reading %s ring", dev->otherend);=0A--- = a/drivers/xen/tpmback/xenbus.c=0A+++ b/drivers/xen/tpmback/xenbus.c=0A@@ = -210,12 +210,11 @@ abort:=0A static int connect_ring(struct backend_info = *be)=0A {=0A struct xenbus_device *dev =3D be->dev;=0A- unsigned = long ring_ref;=0A- unsigned int evtchn;=0A+ unsigned int = ring_ref, evtchn;=0A int err;=0A =0A err =3D xenbus_gather(XBT_N= IL, dev->otherend,=0A- "ring-ref", "%lu", &ring_ref,= =0A+ "ring-ref", "%u", &ring_ref,=0A = "event-channel", "%u", &evtchn, NULL);=0A if (err) {=0A = xenbus_dev_error(dev, err,=0A@@ -238,7 +237,7 @@ static int connect_ring(st= ruct backend_i=0A err =3D tpmif_map(be->tpmif, ring_ref, = evtchn);=0A if (err) {=0A xenbus_dev_error(de= v, err,=0A- "mapping shared-frame %lu = port %u",=0A+ "mapping shared-frame %u = port %u",=0A ring_ref, evtchn);=0A = return err;=0A }=0A--- a/drivers/xen/usbback/xenbus.c=0A++= + b/drivers/xen/usbback/xenbus.c=0A@@ -226,14 +226,12 @@ fail:=0A static = int connect_rings(usbif_t *usbif)=0A {=0A struct xenbus_device *dev = =3D usbif->xbdev;=0A- unsigned long urb_ring_ref;=0A- unsigned long = conn_ring_ref;=0A- unsigned int evtchn;=0A+ unsigned int = urb_ring_ref, conn_ring_ref, evtchn;=0A int err;=0A =0A = err =3D xenbus_gather(XBT_NIL, dev->otherend,=0A- = "urb-ring-ref", "%lu", &urb_ring_ref,=0A- = "conn-ring-ref", "%lu", &conn_ring_ref,=0A+ = "urb-ring-ref", "%u", &urb_ring_ref,=0A+ = "conn-ring-ref", "%u", &conn_ring_ref,=0A = "event-channel", "%u", &evtchn, NULL);=0A if (err) {=0A = xenbus_dev_fatal(dev, err,=0A@@ -242,13 +240,14 @@ static int connect_rings= (usbif_t *usbif)=0A return err;=0A }=0A =0A- printk("usb= back: urb-ring-ref %ld, conn-ring-ref %ld, event-channel %d\n",=0A+ = printk("usbback: urb-ring-ref %u, conn-ring-ref %u,"=0A+ " = event-channel %u\n",=0A urb_ring_ref, conn_ring_ref, = evtchn);=0A =0A err =3D usbif_map(usbif, urb_ring_ref, conn_ring_re= f, evtchn);=0A if (err) {=0A xenbus_dev_fatal(dev, err,=0A- = "mapping urb-ring-ref %lu conn-ring-ref %lu port %u",=0A+ = "mapping urb-ring-ref %u conn-ring-ref %u port = %u",=0A urb_ring_ref, conn_ring_ref, = evtchn);=0A return err;=0A }=0A--- a/drivers/xen/xenbus/xenbus= _client.c=0A+++ b/drivers/xen/xenbus/xenbus_client.c=0A@@ -276,9 +276,9 @@ = EXPORT_SYMBOL_GPL(xenbus_free_evtchn);=0A =0A enum xenbus_state xenbus_read= _driver_state(const char *path)=0A {=0A- enum xenbus_state = result;=0A- int err =3D xenbus_gather(XBT_NIL, path, "state", "%d", = &result, NULL);=0A- if (err)=0A+ int result;=0A+=0A+ if = (xenbus_scanf(XBT_NIL, path, "state", "%d", &result) !=3D 1)=0A = result =3D XenbusStateUnknown;=0A =0A return result;=0A--- a/drivers/xen/= xenbus/xenbus_probe.c=0A+++ b/drivers/xen/xenbus/xenbus_probe.c=0A@@ = -865,7 +865,8 @@ static int be_state;=0A =0A static void xenbus_reset_state= _changed(struct xenbus_watch *w, const char **v, unsigned int l)=0A {=0A- = xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &be_state);=0A+ if = (xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &be_state) !=3D 1)=0A+ = be_state =3D XenbusStateUnknown;=0A printk(KERN_INFO "XENBUS: = %s %s\n", v[XS_WATCH_PATH], xenbus_strstate(be_state));=0A wake_up(&be= _state_wq);=0A }=0A --=__Part0428BFAE.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part0428BFAE.0__=--