* [PATCH 00/12] xen: add common function for reading optional value
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, konrad.wilk,
roger.pau, peterhuewe, tpmdd, jarkko.sakkinen, jgunthorpe,
tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2,
paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen,
linux-fbdev
There are multiple instances of code reading an optional unsigned
parameter from Xenstore via xenbus_scanf(). Instead of repeating the
same code over and over add a service function doing the job and
replace the call of xenbus_scanf() with the call of the new function
where appropriate.
Juergen Gross (12):
xen: introduce xenbus_read_unsigned()
xen: make use of xenbus_read_unsigned() in xen-blkback
xen: make use of xenbus_read_unsigned() in xen-blkfront
xen: make use of xenbus_read_unsigned() in xen-tpmfront
xen: make use of xenbus_read_unsigned() in xen-kbdfront
xen: make use of xenbus_read_unsigned() in xen-netback
xen: make use of xenbus_read_unsigned() in xen-netfront
xen: make use of xenbus_read_unsigned() in xen-pcifront
xen: make use of xenbus_read_unsigned() in xen-scsifront
xen: make use of xenbus_read_unsigned() in xen-fbfront
xen: make use of xenbus_read_unsigned() in xen-pciback
xen: make use of xenbus_read_unsigned() in xenbus
drivers/block/xen-blkback/xenbus.c | 36 ++++++--------
drivers/block/xen-blkfront.c | 81 ++++++++++---------------------
drivers/char/tpm/xen-tpmfront.c | 8 +--
drivers/input/misc/xen-kbdfront.c | 13 ++---
drivers/net/xen-netback/xenbus.c | 50 ++++++-------------
drivers/net/xen-netfront.c | 67 +++++++------------------
drivers/pci/xen-pcifront.c | 6 +--
drivers/scsi/xen-scsifront.c | 6 +--
drivers/video/fbdev/xen-fbfront.c | 13 ++---
drivers/xen/xen-pciback/xenbus.c | 8 ++-
drivers/xen/xenbus/xenbus_probe_backend.c | 8 +--
drivers/xen/xenbus/xenbus_xs.c | 22 +++++++--
include/xen/xenbus.h | 4 ++
13 files changed, 112 insertions(+), 210 deletions(-)
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Cc: peterhuewe@gmx.de
Cc: tpmdd@selhorst.net
Cc: jarkko.sakkinen@linux.intel.com
Cc: jgunthorpe@obsidianresearch.com
Cc: tpmdd-devel@lists.sourceforge.net
Cc: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org
Cc: wei.liu2@citrix.com
Cc: paul.durrant@citrix.com
Cc: netdev@vger.kernel.org
Cc: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org
Cc: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org
--
2.6.6
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 01/12] xen: introduce xenbus_read_unsigned()
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: david.vrabel, boris.ostrovsky, Juergen Gross
There are multiple instances of code reading an optional unsigned
parameter from Xenstore via xenbus_scanf(). Instead of repeating the
same code over and over add a service function doing the job.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_xs.c | 15 +++++++++++++++
include/xen/xenbus.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 22f7cd7..99dfdfa 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -559,6 +559,21 @@ int xenbus_scanf(struct xenbus_transaction t,
}
EXPORT_SYMBOL_GPL(xenbus_scanf);
+/* Read an (optional) unsigned value. */
+unsigned int xenbus_read_unsigned(const char *dir, const char *node,
+ unsigned int default_val)
+{
+ unsigned int val;
+ int ret;
+
+ ret = xenbus_scanf(XBT_NIL, dir, node, "%u", &val);
+ if (ret <= 0)
+ val = default_val;
+
+ return val;
+}
+EXPORT_SYMBOL_GPL(xenbus_read_unsigned);
+
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 32b944b..271ba62 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -151,6 +151,10 @@ __scanf(4, 5)
int xenbus_scanf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...);
+/* Read an (optional) unsigned value. */
+unsigned int xenbus_read_unsigned(const char *dir, const char *node,
+ unsigned int default_val);
+
/* Single printf and write: returns -errno or 0. */
__printf(4, 5)
int xenbus_printf(struct xenbus_transaction t,
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 01/12] xen: introduce xenbus_read_unsigned()
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: Juergen Gross, boris.ostrovsky, david.vrabel
There are multiple instances of code reading an optional unsigned
parameter from Xenstore via xenbus_scanf(). Instead of repeating the
same code over and over add a service function doing the job.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_xs.c | 15 +++++++++++++++
include/xen/xenbus.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 22f7cd7..99dfdfa 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -559,6 +559,21 @@ int xenbus_scanf(struct xenbus_transaction t,
}
EXPORT_SYMBOL_GPL(xenbus_scanf);
+/* Read an (optional) unsigned value. */
+unsigned int xenbus_read_unsigned(const char *dir, const char *node,
+ unsigned int default_val)
+{
+ unsigned int val;
+ int ret;
+
+ ret = xenbus_scanf(XBT_NIL, dir, node, "%u", &val);
+ if (ret <= 0)
+ val = default_val;
+
+ return val;
+}
+EXPORT_SYMBOL_GPL(xenbus_read_unsigned);
+
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...)
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 32b944b..271ba62 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -151,6 +151,10 @@ __scanf(4, 5)
int xenbus_scanf(struct xenbus_transaction t,
const char *dir, const char *node, const char *fmt, ...);
+/* Read an (optional) unsigned value. */
+unsigned int xenbus_read_unsigned(const char *dir, const char *node,
+ unsigned int default_val);
+
/* Single printf and write: returns -errno or 0. */
__printf(4, 5)
int xenbus_printf(struct xenbus_transaction t,
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 01/12] xen: introduce xenbus_read_unsigned()
2016-10-31 16:48 ` Juergen Gross
(?)
@ 2016-11-07 11:02 ` David Vrabel
-1 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:02 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: boris.ostrovsky, david.vrabel
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job.
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
David
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [Xen-devel] [PATCH 01/12] xen: introduce xenbus_read_unsigned()
2016-10-31 16:48 ` Juergen Gross
(?)
(?)
@ 2016-11-07 11:02 ` David Vrabel
-1 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:02 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: boris.ostrovsky, david.vrabel
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job.
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
David
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 02/12] xen: make use of xenbus_read_unsigned() in xen-blkback
2016-10-31 16:48 ` Juergen Gross
(?)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, boris.ostrovsky, roger.pau, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of one read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/block/xen-blkback/xenbus.c | 36 ++++++++++++++----------------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 3cc6d1d..415e79b 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -533,13 +533,11 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
struct xenbus_device *dev = be->dev;
struct xen_blkif *blkif = be->blkif;
int err;
- int state = 0, discard_enable;
+ int state = 0;
struct block_device *bdev = be->blkif->vbd.bdev;
struct request_queue *q = bdev_get_queue(bdev);
- err = xenbus_scanf(XBT_NIL, dev->nodename, "discard-enable", "%d",
- &discard_enable);
- if (err == 1 && !discard_enable)
+ if (!xenbus_read_unsigned(dev->nodename, "discard-enable", 1))
return;
if (blk_queue_discard(q)) {
@@ -1039,30 +1037,24 @@ static int connect_ring(struct backend_info *be)
xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
return -ENOSYS;
}
- err = xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-persistent", "%u", &pers_grants);
- if (err <= 0)
- pers_grants = 0;
-
+ pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent",
+ 0);
be->blkif->vbd.feature_gnt_persistent = pers_grants;
be->blkif->vbd.overflow_max_grants = 0;
/*
* Read the number of hardware queues from frontend.
*/
- err = xenbus_scanf(XBT_NIL, dev->otherend, "multi-queue-num-queues",
- "%u", &requested_num_queues);
- if (err < 0) {
- requested_num_queues = 1;
- } else {
- if (requested_num_queues > xenblk_max_queues
- || requested_num_queues == 0) {
- /* Buggy or malicious guest. */
- xenbus_dev_fatal(dev, err,
- "guest requested %u queues, exceeding the maximum of %u.",
- requested_num_queues, xenblk_max_queues);
- return -ENOSYS;
- }
+ requested_num_queues = xenbus_read_unsigned(dev->otherend,
+ "multi-queue-num-queues",
+ 1);
+ if (requested_num_queues > xenblk_max_queues
+ || requested_num_queues == 0) {
+ /* Buggy or malicious guest. */
+ xenbus_dev_fatal(dev, err,
+ "guest requested %u queues, exceeding the maximum of %u.",
+ requested_num_queues, xenblk_max_queues);
+ return -ENOSYS;
}
be->blkif->nr_rings = requested_num_queues;
if (xen_blkif_alloc_rings(be->blkif))
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 02/12] xen: make use of xenbus_read_unsigned() in xen-blkback
2016-10-31 16:48 ` Juergen Gross
` (2 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, konrad.wilk, roger.pau
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of one read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/block/xen-blkback/xenbus.c | 36 ++++++++++++++----------------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 3cc6d1d..415e79b 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -533,13 +533,11 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
struct xenbus_device *dev = be->dev;
struct xen_blkif *blkif = be->blkif;
int err;
- int state = 0, discard_enable;
+ int state = 0;
struct block_device *bdev = be->blkif->vbd.bdev;
struct request_queue *q = bdev_get_queue(bdev);
- err = xenbus_scanf(XBT_NIL, dev->nodename, "discard-enable", "%d",
- &discard_enable);
- if (err == 1 && !discard_enable)
+ if (!xenbus_read_unsigned(dev->nodename, "discard-enable", 1))
return;
if (blk_queue_discard(q)) {
@@ -1039,30 +1037,24 @@ static int connect_ring(struct backend_info *be)
xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
return -ENOSYS;
}
- err = xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-persistent", "%u", &pers_grants);
- if (err <= 0)
- pers_grants = 0;
-
+ pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent",
+ 0);
be->blkif->vbd.feature_gnt_persistent = pers_grants;
be->blkif->vbd.overflow_max_grants = 0;
/*
* Read the number of hardware queues from frontend.
*/
- err = xenbus_scanf(XBT_NIL, dev->otherend, "multi-queue-num-queues",
- "%u", &requested_num_queues);
- if (err < 0) {
- requested_num_queues = 1;
- } else {
- if (requested_num_queues > xenblk_max_queues
- || requested_num_queues == 0) {
- /* Buggy or malicious guest. */
- xenbus_dev_fatal(dev, err,
- "guest requested %u queues, exceeding the maximum of %u.",
- requested_num_queues, xenblk_max_queues);
- return -ENOSYS;
- }
+ requested_num_queues = xenbus_read_unsigned(dev->otherend,
+ "multi-queue-num-queues",
+ 1);
+ if (requested_num_queues > xenblk_max_queues
+ || requested_num_queues == 0) {
+ /* Buggy or malicious guest. */
+ xenbus_dev_fatal(dev, err,
+ "guest requested %u queues, exceeding the maximum of %u.",
+ requested_num_queues, xenblk_max_queues);
+ return -ENOSYS;
}
be->blkif->nr_rings = requested_num_queues;
if (xen_blkif_alloc_rings(be->blkif))
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 03/12] xen: make use of xenbus_read_unsigned() in xen-blkfront
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, konrad.wilk, roger.pau
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/block/xen-blkfront.c | 81 ++++++++++++++------------------------------
1 file changed, 26 insertions(+), 55 deletions(-)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9908597..2ee9646 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1758,17 +1758,13 @@ static int talk_to_blkback(struct xenbus_device *dev,
const char *message = NULL;
struct xenbus_transaction xbt;
int err;
- unsigned int i, max_page_order = 0;
- unsigned int ring_page_order = 0;
+ unsigned int i, max_page_order;
+ unsigned int ring_page_order;
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "max-ring-page-order", "%u", &max_page_order);
- if (err != 1)
- info->nr_ring_pages = 1;
- else {
- ring_page_order = min(xen_blkif_max_ring_order, max_page_order);
- info->nr_ring_pages = 1 << ring_page_order;
- }
+ max_page_order = xenbus_read_unsigned(info->xbdev->otherend,
+ "max-ring-page-order", 0);
+ ring_page_order = min(xen_blkif_max_ring_order, max_page_order);
+ info->nr_ring_pages = 1 << ring_page_order;
for (i = 0; i < info->nr_rings; i++) {
struct blkfront_ring_info *rinfo = &info->rinfo[i];
@@ -1877,18 +1873,14 @@ static int talk_to_blkback(struct xenbus_device *dev,
static int negotiate_mq(struct blkfront_info *info)
{
- unsigned int backend_max_queues = 0;
- int err;
+ unsigned int backend_max_queues;
unsigned int i;
BUG_ON(info->nr_rings);
/* Check if backend supports multiple queues. */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "multi-queue-max-queues", "%u", &backend_max_queues);
- if (err < 0)
- backend_max_queues = 1;
-
+ backend_max_queues = xenbus_read_unsigned(info->xbdev->otherend,
+ "multi-queue-max-queues", 1);
info->nr_rings = min(backend_max_queues, xen_blkif_max_queues);
/* We need at least one ring. */
if (!info->nr_rings)
@@ -2195,7 +2187,6 @@ static void blkfront_setup_discard(struct blkfront_info *info)
int err;
unsigned int discard_granularity;
unsigned int discard_alignment;
- unsigned int discard_secure;
info->feature_discard = 1;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
@@ -2206,10 +2197,9 @@ static void blkfront_setup_discard(struct blkfront_info *info)
info->discard_granularity = discard_granularity;
info->discard_alignment = discard_alignment;
}
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "discard-secure", "%u", &discard_secure);
- if (err > 0)
- info->feature_secdiscard = !!discard_secure;
+ info->feature_secdiscard =
+ !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure",
+ 0);
}
static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
@@ -2301,16 +2291,11 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
*/
static void blkfront_gather_backend_features(struct blkfront_info *info)
{
- int err;
- int barrier, flush, discard, persistent;
unsigned int indirect_segments;
info->feature_flush = 0;
info->feature_fua = 0;
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-barrier", "%d", &barrier);
-
/*
* If there's no "feature-barrier" defined, then it means
* we're dealing with a very old backend which writes
@@ -2318,7 +2303,7 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
*
* If there are barriers, then we use flush.
*/
- if (err > 0 && barrier) {
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-barrier", 0)) {
info->feature_flush = 1;
info->feature_fua = 1;
}
@@ -2327,35 +2312,23 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
* And if there is "feature-flush-cache" use that above
* barriers.
*/
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-flush-cache", "%d", &flush);
-
- if (err > 0 && flush) {
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-flush-cache",
+ 0)) {
info->feature_flush = 1;
info->feature_fua = 0;
}
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-discard", "%d", &discard);
-
- if (err > 0 && discard)
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
blkfront_setup_discard(info);
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-persistent", "%d", &persistent);
- if (err <= 0)
- info->feature_persistent = 0;
- else
- info->feature_persistent = persistent;
+ info->feature_persistent =
+ xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-persistent", 0);
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-max-indirect-segments", "%u",
- &indirect_segments);
- if (err <= 0)
- info->max_indirect_segments = 0;
- else
- info->max_indirect_segments = min(indirect_segments,
- xen_blkif_max_segments);
+ indirect_segments = xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-max-indirect-segments", 0);
+ info->max_indirect_segments = min(indirect_segments,
+ xen_blkif_max_segments);
}
/*
@@ -2420,11 +2393,9 @@ static void blkfront_connect(struct blkfront_info *info)
* provide this. Assume physical sector size to be the same as
* sector_size in that case.
*/
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "physical-sector-size", "%u", &physical_sector_size);
- if (err != 1)
- physical_sector_size = sector_size;
-
+ physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
+ "physical-sector-size",
+ sector_size);
blkfront_gather_backend_features(info);
for (i = 0; i < info->nr_rings; i++) {
err = blkfront_setup_indirect(&info->rinfo[i]);
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 03/12] xen: make use of xenbus_read_unsigned() in xen-blkfront
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, boris.ostrovsky, roger.pau, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/block/xen-blkfront.c | 81 ++++++++++++++------------------------------
1 file changed, 26 insertions(+), 55 deletions(-)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9908597..2ee9646 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1758,17 +1758,13 @@ static int talk_to_blkback(struct xenbus_device *dev,
const char *message = NULL;
struct xenbus_transaction xbt;
int err;
- unsigned int i, max_page_order = 0;
- unsigned int ring_page_order = 0;
+ unsigned int i, max_page_order;
+ unsigned int ring_page_order;
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "max-ring-page-order", "%u", &max_page_order);
- if (err != 1)
- info->nr_ring_pages = 1;
- else {
- ring_page_order = min(xen_blkif_max_ring_order, max_page_order);
- info->nr_ring_pages = 1 << ring_page_order;
- }
+ max_page_order = xenbus_read_unsigned(info->xbdev->otherend,
+ "max-ring-page-order", 0);
+ ring_page_order = min(xen_blkif_max_ring_order, max_page_order);
+ info->nr_ring_pages = 1 << ring_page_order;
for (i = 0; i < info->nr_rings; i++) {
struct blkfront_ring_info *rinfo = &info->rinfo[i];
@@ -1877,18 +1873,14 @@ static int talk_to_blkback(struct xenbus_device *dev,
static int negotiate_mq(struct blkfront_info *info)
{
- unsigned int backend_max_queues = 0;
- int err;
+ unsigned int backend_max_queues;
unsigned int i;
BUG_ON(info->nr_rings);
/* Check if backend supports multiple queues. */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "multi-queue-max-queues", "%u", &backend_max_queues);
- if (err < 0)
- backend_max_queues = 1;
-
+ backend_max_queues = xenbus_read_unsigned(info->xbdev->otherend,
+ "multi-queue-max-queues", 1);
info->nr_rings = min(backend_max_queues, xen_blkif_max_queues);
/* We need at least one ring. */
if (!info->nr_rings)
@@ -2195,7 +2187,6 @@ static void blkfront_setup_discard(struct blkfront_info *info)
int err;
unsigned int discard_granularity;
unsigned int discard_alignment;
- unsigned int discard_secure;
info->feature_discard = 1;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
@@ -2206,10 +2197,9 @@ static void blkfront_setup_discard(struct blkfront_info *info)
info->discard_granularity = discard_granularity;
info->discard_alignment = discard_alignment;
}
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "discard-secure", "%u", &discard_secure);
- if (err > 0)
- info->feature_secdiscard = !!discard_secure;
+ info->feature_secdiscard =
+ !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure",
+ 0);
}
static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
@@ -2301,16 +2291,11 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
*/
static void blkfront_gather_backend_features(struct blkfront_info *info)
{
- int err;
- int barrier, flush, discard, persistent;
unsigned int indirect_segments;
info->feature_flush = 0;
info->feature_fua = 0;
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-barrier", "%d", &barrier);
-
/*
* If there's no "feature-barrier" defined, then it means
* we're dealing with a very old backend which writes
@@ -2318,7 +2303,7 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
*
* If there are barriers, then we use flush.
*/
- if (err > 0 && barrier) {
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-barrier", 0)) {
info->feature_flush = 1;
info->feature_fua = 1;
}
@@ -2327,35 +2312,23 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
* And if there is "feature-flush-cache" use that above
* barriers.
*/
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-flush-cache", "%d", &flush);
-
- if (err > 0 && flush) {
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-flush-cache",
+ 0)) {
info->feature_flush = 1;
info->feature_fua = 0;
}
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-discard", "%d", &discard);
-
- if (err > 0 && discard)
+ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
blkfront_setup_discard(info);
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-persistent", "%d", &persistent);
- if (err <= 0)
- info->feature_persistent = 0;
- else
- info->feature_persistent = persistent;
+ info->feature_persistent =
+ xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-persistent", 0);
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-max-indirect-segments", "%u",
- &indirect_segments);
- if (err <= 0)
- info->max_indirect_segments = 0;
- else
- info->max_indirect_segments = min(indirect_segments,
- xen_blkif_max_segments);
+ indirect_segments = xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-max-indirect-segments", 0);
+ info->max_indirect_segments = min(indirect_segments,
+ xen_blkif_max_segments);
}
/*
@@ -2420,11 +2393,9 @@ static void blkfront_connect(struct blkfront_info *info)
* provide this. Assume physical sector size to be the same as
* sector_size in that case.
*/
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "physical-sector-size", "%u", &physical_sector_size);
- if (err != 1)
- physical_sector_size = sector_size;
-
+ physical_sector_size = xenbus_read_unsigned(info->xbdev->otherend,
+ "physical-sector-size",
+ sector_size);
blkfront_gather_backend_features(info);
for (i = 0; i < info->nr_rings; i++) {
err = blkfront_setup_indirect(&info->rinfo[i]);
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, peterhuewe, tpmdd,
jarkko.sakkinen, jgunthorpe, tpmdd-devel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of one read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: peterhuewe@gmx.de
Cc: tpmdd@selhorst.net
Cc: jarkko.sakkinen@linux.intel.com
Cc: jgunthorpe@obsidianresearch.com
Cc: tpmdd-devel@lists.sourceforge.net
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/char/tpm/xen-tpmfront.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 62028f4..50072cc 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
static void backend_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{
- int val;
-
switch (backend_state) {
case XenbusStateInitialised:
case XenbusStateConnected:
if (dev->state == XenbusStateConnected)
break;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-protocol-v2", "%d", &val) < 0)
- val = 0;
- if (!val) {
+ if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
+ 0)) {
xenbus_dev_fatal(dev, -EINVAL,
"vTPM protocol 2 required");
return;
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, tpmdd, jarkko.sakkinen, jgunthorpe, tpmdd-devel,
david.vrabel, boris.ostrovsky, peterhuewe
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of one read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: peterhuewe@gmx.de
Cc: tpmdd@selhorst.net
Cc: jarkko.sakkinen@linux.intel.com
Cc: jgunthorpe@obsidianresearch.com
Cc: tpmdd-devel@lists.sourceforge.net
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/char/tpm/xen-tpmfront.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 62028f4..50072cc 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
static void backend_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{
- int val;
-
switch (backend_state) {
case XenbusStateInitialised:
case XenbusStateConnected:
if (dev->state == XenbusStateConnected)
break;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-protocol-v2", "%d", &val) < 0)
- val = 0;
- if (!val) {
+ if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
+ 0)) {
xenbus_dev_fatal(dev, -EINVAL,
"vTPM protocol 2 required");
return;
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
@ 2016-11-02 10:34 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-02 10:34 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
peterhuewe, tpmdd, jgunthorpe, tpmdd-devel
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe@gmx.de
> Cc: tpmdd@selhorst.net
> Cc: jarkko.sakkinen@linux.intel.com
> Cc: jgunthorpe@obsidianresearch.com
> Cc: tpmdd-devel@lists.sourceforge.net
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
@ 2016-11-02 10:34 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-02 10:34 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
xen-devel-GuqFBffKawuEi8DpZVb4nw,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA,
boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe-Mmb7MZpHnFY@public.gmane.org
> Cc: tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org
> Cc: jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
> Cc: jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
> Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>
> Signed-off-by: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
2016-10-31 16:48 ` Juergen Gross
(?)
(?)
@ 2016-11-02 10:34 ` Jarkko Sakkinen
-1 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-02 10:34 UTC (permalink / raw)
To: Juergen Gross
Cc: tpmdd, linux-kernel, xen-devel, jgunthorpe, tpmdd-devel,
david.vrabel, boris.ostrovsky, peterhuewe
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe@gmx.de
> Cc: tpmdd@selhorst.net
> Cc: jarkko.sakkinen@linux.intel.com
> Cc: jgunthorpe@obsidianresearch.com
> Cc: tpmdd-devel@lists.sourceforge.net
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
@ 2016-11-04 4:26 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-04 4:26 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
peterhuewe, tpmdd, jgunthorpe, tpmdd-devel
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe@gmx.de
> Cc: tpmdd@selhorst.net
> Cc: jarkko.sakkinen@linux.intel.com
> Cc: jgunthorpe@obsidianresearch.com
> Cc: tpmdd-devel@lists.sourceforge.net
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
@ 2016-11-04 4:26 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-04 4:26 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
xen-devel-GuqFBffKawuEi8DpZVb4nw,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA,
boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe-Mmb7MZpHnFY@public.gmane.org
> Cc: tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org
> Cc: jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
> Cc: jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
> Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>
> Signed-off-by: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront
2016-10-31 16:48 ` Juergen Gross
` (3 preceding siblings ...)
(?)
@ 2016-11-04 4:26 ` Jarkko Sakkinen
-1 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-04 4:26 UTC (permalink / raw)
To: Juergen Gross
Cc: tpmdd, linux-kernel, xen-devel, jgunthorpe, tpmdd-devel,
david.vrabel, boris.ostrovsky, peterhuewe
On Mon, Oct 31, 2016 at 05:48:22PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of one read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: peterhuewe@gmx.de
> Cc: tpmdd@selhorst.net
> Cc: jarkko.sakkinen@linux.intel.com
> Cc: jgunthorpe@obsidianresearch.com
> Cc: tpmdd-devel@lists.sourceforge.net
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
> ---
> drivers/char/tpm/xen-tpmfront.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 62028f4..50072cc 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - int val;
> -
> switch (backend_state) {
> case XenbusStateInitialised:
> case XenbusStateConnected:
> if (dev->state == XenbusStateConnected)
> break;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-protocol-v2", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
> + 0)) {
> xenbus_dev_fatal(dev, -EINVAL,
> "vTPM protocol 2 required");
> return;
> --
> 2.6.6
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
2016-10-31 16:48 ` Juergen Gross
` (5 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
2016-11-09 0:29 ` Dmitry Torokhov
2016-11-09 0:29 ` Dmitry Torokhov
-1 siblings, 2 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, dmitry.torokhov,
linux-input
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/input/misc/xen-kbdfront.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 227fbd2..3900875 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
static int xenkbd_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
- int ret, i, abs;
+ int ret, i;
+ unsigned int abs;
struct xenkbd_info *info;
struct input_dev *kbd, *ptr;
@@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
if (!info->page)
goto error_nomem;
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
- abs = 0;
+ abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
if (abs) {
ret = xenbus_write(XBT_NIL, dev->nodename,
"request-abs-pointer", "1");
@@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
case XenbusStateInitWait:
InitWait:
- ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-abs-pointer", "%d", &val);
- if (ret < 0)
- val = 0;
- if (val) {
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-abs-pointer", 0)) {
ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
"request-abs-pointer", "1");
if (ret)
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross
@ 2016-11-09 0:29 ` Dmitry Torokhov
2016-11-09 0:29 ` Dmitry Torokhov
1 sibling, 0 replies; 55+ messages in thread
From: Dmitry Torokhov @ 2016-11-09 0:29 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky, linux-input
On Mon, Oct 31, 2016 at 05:48:23PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
>
> Cc: dmitry.torokhov@gmail.com
> Cc: linux-input@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/misc/xen-kbdfront.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 227fbd2..3900875 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
> static int xenkbd_probe(struct xenbus_device *dev,
> const struct xenbus_device_id *id)
> {
> - int ret, i, abs;
> + int ret, i;
> + unsigned int abs;
> struct xenkbd_info *info;
> struct input_dev *kbd, *ptr;
>
> @@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
> if (!info->page)
> goto error_nomem;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
> - abs = 0;
> + abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
> if (abs) {
> ret = xenbus_write(XBT_NIL, dev->nodename,
> "request-abs-pointer", "1");
> @@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>
> case XenbusStateInitWait:
> InitWait:
> - ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
> - "feature-abs-pointer", "%d", &val);
> - if (ret < 0)
> - val = 0;
> - if (val) {
> + if (xenbus_read_unsigned(info->xbdev->otherend,
> + "feature-abs-pointer", 0)) {
> ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
> "request-abs-pointer", "1");
> if (ret)
> --
> 2.6.6
>
--
Dmitry
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross
2016-11-09 0:29 ` Dmitry Torokhov
@ 2016-11-09 0:29 ` Dmitry Torokhov
1 sibling, 0 replies; 55+ messages in thread
From: Dmitry Torokhov @ 2016-11-09 0:29 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-input, boris.ostrovsky, david.vrabel, linux-kernel, xen-devel
On Mon, Oct 31, 2016 at 05:48:23PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
>
> Cc: dmitry.torokhov@gmail.com
> Cc: linux-input@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/misc/xen-kbdfront.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 227fbd2..3900875 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
> static int xenkbd_probe(struct xenbus_device *dev,
> const struct xenbus_device_id *id)
> {
> - int ret, i, abs;
> + int ret, i;
> + unsigned int abs;
> struct xenkbd_info *info;
> struct input_dev *kbd, *ptr;
>
> @@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
> if (!info->page)
> goto error_nomem;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
> - abs = 0;
> + abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
> if (abs) {
> ret = xenbus_write(XBT_NIL, dev->nodename,
> "request-abs-pointer", "1");
> @@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
>
> case XenbusStateInitWait:
> InitWait:
> - ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
> - "feature-abs-pointer", "%d", &val);
> - if (ret < 0)
> - val = 0;
> - if (val) {
> + if (xenbus_read_unsigned(info->xbdev->otherend,
> + "feature-abs-pointer", 0)) {
> ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
> "request-abs-pointer", "1");
> if (ret)
> --
> 2.6.6
>
--
Dmitry
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront
2016-10-31 16:48 ` Juergen Gross
` (6 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, boris.ostrovsky, dmitry.torokhov, david.vrabel,
linux-input
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/input/misc/xen-kbdfront.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 227fbd2..3900875 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
static int xenkbd_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
- int ret, i, abs;
+ int ret, i;
+ unsigned int abs;
struct xenkbd_info *info;
struct input_dev *kbd, *ptr;
@@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
if (!info->page)
goto error_nomem;
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
- abs = 0;
+ abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
if (abs) {
ret = xenbus_write(XBT_NIL, dev->nodename,
"request-abs-pointer", "1");
@@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
case XenbusStateInitWait:
InitWait:
- ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-abs-pointer", "%d", &val);
- if (ret < 0)
- val = 0;
- if (val) {
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-abs-pointer", 0)) {
ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
"request-abs-pointer", "1");
if (ret)
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback
2016-10-31 16:48 ` Juergen Gross
` (7 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
2016-11-01 9:42 ` Paul Durrant
2016-11-01 9:42 ` Paul Durrant
-1 siblings, 2 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, wei.liu2,
paul.durrant, netdev
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: wei.liu2@citrix.com
Cc: paul.durrant@citrix.com
Cc: netdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/net/xen-netback/xenbus.c | 50 +++++++++++-----------------------------
1 file changed, 14 insertions(+), 36 deletions(-)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 8674e18..7356e00 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -785,12 +785,9 @@ static void xen_mcast_ctrl_changed(struct xenbus_watch *watch,
struct xenvif *vif = container_of(watch, struct xenvif,
mcast_ctrl_watch);
struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
- int val;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "request-multicast-control", "%d", &val) < 0)
- val = 0;
- vif->multicast_control = !!val;
+ vif->multicast_control = !!xenbus_read_unsigned(dev->otherend,
+ "request-multicast-control", 0);
}
static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
@@ -934,12 +931,9 @@ static void connect(struct backend_info *be)
/* Check whether the frontend requested multiple queues
* and read the number requested.
*/
- err = xenbus_scanf(XBT_NIL, dev->otherend,
- "multi-queue-num-queues",
- "%u", &requested_num_queues);
- if (err < 0) {
- requested_num_queues = 1; /* Fall back to single queue */
- } else if (requested_num_queues > xenvif_max_queues) {
+ requested_num_queues = xenbus_read_unsigned(dev->otherend,
+ "multi-queue-num-queues", 1);
+ if (requested_num_queues > xenvif_max_queues) {
/* buggy or malicious guest */
xenbus_dev_fatal(dev, err,
"guest requested %u queues, exceeding the maximum of %u.",
@@ -1134,7 +1128,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
struct xenvif *vif = be->vif;
struct xenbus_device *dev = be->dev;
unsigned int rx_copy;
- int err, val;
+ int err;
err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u",
&rx_copy);
@@ -1150,10 +1144,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
if (!rx_copy)
return -EOPNOTSUPP;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-rx-notify", "%d", &val) < 0)
- val = 0;
- if (!val) {
+ if (!xenbus_read_unsigned(dev->otherend, "feature-rx-notify", 0)) {
/* - Reduce drain timeout to poll more frequently for
* Rx requests.
* - Disable Rx stall detection.
@@ -1162,34 +1153,21 @@ static int read_xenbus_vif_flags(struct backend_info *be)
be->vif->stall_timeout = 0;
}
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
- "%d", &val) < 0)
- val = 0;
- vif->can_sg = !!val;
+ vif->can_sg = !!xenbus_read_unsigned(dev->otherend, "feature-sg", 0);
vif->gso_mask = 0;
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
- "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv4", 0))
vif->gso_mask |= GSO_BIT(TCPV4);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
- "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv6", 0))
vif->gso_mask |= GSO_BIT(TCPV6);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
- "%d", &val) < 0)
- val = 0;
- vif->ip_csum = !val;
+ vif->ip_csum = !xenbus_read_unsigned(dev->otherend,
+ "feature-no-csum-offload", 0);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload",
- "%d", &val) < 0)
- val = 0;
- vif->ipv6_csum = !!val;
+ vif->ipv6_csum = !!xenbus_read_unsigned(dev->otherend,
+ "feature-ipv6-csum-offload", 0);
return 0;
}
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback
2016-10-31 16:48 ` [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback Juergen Gross
@ 2016-11-01 9:42 ` Paul Durrant
2016-11-01 9:42 ` Paul Durrant
1 sibling, 0 replies; 55+ messages in thread
From: Paul Durrant @ 2016-11-01 9:42 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: netdev, boris.ostrovsky, Wei Liu, David Vrabel
> -----Original Message-----
> From: Juergen Gross [mailto:jgross@suse.com]
> Sent: 31 October 2016 16:48
> To: linux-kernel@vger.kernel.org; xen-devel@lists.xen.org
> Cc: David Vrabel <david.vrabel@citrix.com>; boris.ostrovsky@oracle.com;
> Juergen Gross <jgross@suse.com>; Wei Liu <wei.liu2@citrix.com>; Paul
> Durrant <Paul.Durrant@citrix.com>; netdev@vger.kernel.org
> Subject: [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-
> netback
>
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of some reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
>
> Cc: wei.liu2@citrix.com
> Cc: paul.durrant@citrix.com
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> Cc: netdev@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> drivers/net/xen-netback/xenbus.c | 50 +++++++++++---------------------------
> --
> 1 file changed, 14 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-
> netback/xenbus.c
> index 8674e18..7356e00 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -785,12 +785,9 @@ static void xen_mcast_ctrl_changed(struct
> xenbus_watch *watch,
> struct xenvif *vif = container_of(watch, struct xenvif,
> mcast_ctrl_watch);
> struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
> - int val;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "request-multicast-control", "%d", &val) < 0)
> - val = 0;
> - vif->multicast_control = !!val;
> + vif->multicast_control = !!xenbus_read_unsigned(dev->otherend,
> + "request-multicast-control", 0);
> }
>
> static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
> @@ -934,12 +931,9 @@ static void connect(struct backend_info *be)
> /* Check whether the frontend requested multiple queues
> * and read the number requested.
> */
> - err = xenbus_scanf(XBT_NIL, dev->otherend,
> - "multi-queue-num-queues",
> - "%u", &requested_num_queues);
> - if (err < 0) {
> - requested_num_queues = 1; /* Fall back to single queue */
> - } else if (requested_num_queues > xenvif_max_queues) {
> + requested_num_queues = xenbus_read_unsigned(dev->otherend,
> + "multi-queue-num-queues", 1);
> + if (requested_num_queues > xenvif_max_queues) {
> /* buggy or malicious guest */
> xenbus_dev_fatal(dev, err,
> "guest requested %u queues, exceeding the
> maximum of %u.",
> @@ -1134,7 +1128,7 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> struct xenvif *vif = be->vif;
> struct xenbus_device *dev = be->dev;
> unsigned int rx_copy;
> - int err, val;
> + int err;
>
> err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy",
> "%u",
> &rx_copy);
> @@ -1150,10 +1144,7 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> if (!rx_copy)
> return -EOPNOTSUPP;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-rx-notify", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-rx-notify", 0)) {
> /* - Reduce drain timeout to poll more frequently for
> * Rx requests.
> * - Disable Rx stall detection.
> @@ -1162,34 +1153,21 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> be->vif->stall_timeout = 0;
> }
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
> - "%d", &val) < 0)
> - val = 0;
> - vif->can_sg = !!val;
> + vif->can_sg = !!xenbus_read_unsigned(dev->otherend, "feature-
> sg", 0);
>
> vif->gso_mask = 0;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
> - "%d", &val) < 0)
> - val = 0;
> - if (val)
> + if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv4", 0))
> vif->gso_mask |= GSO_BIT(TCPV4);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
> - "%d", &val) < 0)
> - val = 0;
> - if (val)
> + if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv6", 0))
> vif->gso_mask |= GSO_BIT(TCPV6);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-
> offload",
> - "%d", &val) < 0)
> - val = 0;
> - vif->ip_csum = !val;
> + vif->ip_csum = !xenbus_read_unsigned(dev->otherend,
> + "feature-no-csum-offload", 0);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-
> offload",
> - "%d", &val) < 0)
> - val = 0;
> - vif->ipv6_csum = !!val;
> + vif->ipv6_csum = !!xenbus_read_unsigned(dev->otherend,
> + "feature-ipv6-csum-offload",
> 0);
>
> return 0;
> }
> --
> 2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* RE: [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback
2016-10-31 16:48 ` [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback Juergen Gross
2016-11-01 9:42 ` Paul Durrant
@ 2016-11-01 9:42 ` Paul Durrant
1 sibling, 0 replies; 55+ messages in thread
From: Paul Durrant @ 2016-11-01 9:42 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: David Vrabel, boris.ostrovsky, Wei Liu, netdev
> -----Original Message-----
> From: Juergen Gross [mailto:jgross@suse.com]
> Sent: 31 October 2016 16:48
> To: linux-kernel@vger.kernel.org; xen-devel@lists.xen.org
> Cc: David Vrabel <david.vrabel@citrix.com>; boris.ostrovsky@oracle.com;
> Juergen Gross <jgross@suse.com>; Wei Liu <wei.liu2@citrix.com>; Paul
> Durrant <Paul.Durrant@citrix.com>; netdev@vger.kernel.org
> Subject: [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-
> netback
>
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of some reads from int to unsigned,
> but these cases have been wrong before: negative values are not allowed
> for the modified cases.
>
> Cc: wei.liu2@citrix.com
> Cc: paul.durrant@citrix.com
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> Cc: netdev@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> drivers/net/xen-netback/xenbus.c | 50 +++++++++++---------------------------
> --
> 1 file changed, 14 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-
> netback/xenbus.c
> index 8674e18..7356e00 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -785,12 +785,9 @@ static void xen_mcast_ctrl_changed(struct
> xenbus_watch *watch,
> struct xenvif *vif = container_of(watch, struct xenvif,
> mcast_ctrl_watch);
> struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
> - int val;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "request-multicast-control", "%d", &val) < 0)
> - val = 0;
> - vif->multicast_control = !!val;
> + vif->multicast_control = !!xenbus_read_unsigned(dev->otherend,
> + "request-multicast-control", 0);
> }
>
> static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
> @@ -934,12 +931,9 @@ static void connect(struct backend_info *be)
> /* Check whether the frontend requested multiple queues
> * and read the number requested.
> */
> - err = xenbus_scanf(XBT_NIL, dev->otherend,
> - "multi-queue-num-queues",
> - "%u", &requested_num_queues);
> - if (err < 0) {
> - requested_num_queues = 1; /* Fall back to single queue */
> - } else if (requested_num_queues > xenvif_max_queues) {
> + requested_num_queues = xenbus_read_unsigned(dev->otherend,
> + "multi-queue-num-queues", 1);
> + if (requested_num_queues > xenvif_max_queues) {
> /* buggy or malicious guest */
> xenbus_dev_fatal(dev, err,
> "guest requested %u queues, exceeding the
> maximum of %u.",
> @@ -1134,7 +1128,7 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> struct xenvif *vif = be->vif;
> struct xenbus_device *dev = be->dev;
> unsigned int rx_copy;
> - int err, val;
> + int err;
>
> err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy",
> "%u",
> &rx_copy);
> @@ -1150,10 +1144,7 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> if (!rx_copy)
> return -EOPNOTSUPP;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend,
> - "feature-rx-notify", "%d", &val) < 0)
> - val = 0;
> - if (!val) {
> + if (!xenbus_read_unsigned(dev->otherend, "feature-rx-notify", 0)) {
> /* - Reduce drain timeout to poll more frequently for
> * Rx requests.
> * - Disable Rx stall detection.
> @@ -1162,34 +1153,21 @@ static int read_xenbus_vif_flags(struct
> backend_info *be)
> be->vif->stall_timeout = 0;
> }
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
> - "%d", &val) < 0)
> - val = 0;
> - vif->can_sg = !!val;
> + vif->can_sg = !!xenbus_read_unsigned(dev->otherend, "feature-
> sg", 0);
>
> vif->gso_mask = 0;
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
> - "%d", &val) < 0)
> - val = 0;
> - if (val)
> + if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv4", 0))
> vif->gso_mask |= GSO_BIT(TCPV4);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
> - "%d", &val) < 0)
> - val = 0;
> - if (val)
> + if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv6", 0))
> vif->gso_mask |= GSO_BIT(TCPV6);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-
> offload",
> - "%d", &val) < 0)
> - val = 0;
> - vif->ip_csum = !val;
> + vif->ip_csum = !xenbus_read_unsigned(dev->otherend,
> + "feature-no-csum-offload", 0);
>
> - if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-
> offload",
> - "%d", &val) < 0)
> - val = 0;
> - vif->ipv6_csum = !!val;
> + vif->ipv6_csum = !!xenbus_read_unsigned(dev->otherend,
> + "feature-ipv6-csum-offload",
> 0);
>
> return 0;
> }
> --
> 2.6.6
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 06/12] xen: make use of xenbus_read_unsigned() in xen-netback
2016-10-31 16:48 ` Juergen Gross
` (8 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, wei.liu2, netdev, paul.durrant, david.vrabel,
boris.ostrovsky
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: wei.liu2@citrix.com
Cc: paul.durrant@citrix.com
Cc: netdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/net/xen-netback/xenbus.c | 50 +++++++++++-----------------------------
1 file changed, 14 insertions(+), 36 deletions(-)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 8674e18..7356e00 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -785,12 +785,9 @@ static void xen_mcast_ctrl_changed(struct xenbus_watch *watch,
struct xenvif *vif = container_of(watch, struct xenvif,
mcast_ctrl_watch);
struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
- int val;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "request-multicast-control", "%d", &val) < 0)
- val = 0;
- vif->multicast_control = !!val;
+ vif->multicast_control = !!xenbus_read_unsigned(dev->otherend,
+ "request-multicast-control", 0);
}
static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
@@ -934,12 +931,9 @@ static void connect(struct backend_info *be)
/* Check whether the frontend requested multiple queues
* and read the number requested.
*/
- err = xenbus_scanf(XBT_NIL, dev->otherend,
- "multi-queue-num-queues",
- "%u", &requested_num_queues);
- if (err < 0) {
- requested_num_queues = 1; /* Fall back to single queue */
- } else if (requested_num_queues > xenvif_max_queues) {
+ requested_num_queues = xenbus_read_unsigned(dev->otherend,
+ "multi-queue-num-queues", 1);
+ if (requested_num_queues > xenvif_max_queues) {
/* buggy or malicious guest */
xenbus_dev_fatal(dev, err,
"guest requested %u queues, exceeding the maximum of %u.",
@@ -1134,7 +1128,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
struct xenvif *vif = be->vif;
struct xenbus_device *dev = be->dev;
unsigned int rx_copy;
- int err, val;
+ int err;
err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u",
&rx_copy);
@@ -1150,10 +1144,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
if (!rx_copy)
return -EOPNOTSUPP;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-rx-notify", "%d", &val) < 0)
- val = 0;
- if (!val) {
+ if (!xenbus_read_unsigned(dev->otherend, "feature-rx-notify", 0)) {
/* - Reduce drain timeout to poll more frequently for
* Rx requests.
* - Disable Rx stall detection.
@@ -1162,34 +1153,21 @@ static int read_xenbus_vif_flags(struct backend_info *be)
be->vif->stall_timeout = 0;
}
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
- "%d", &val) < 0)
- val = 0;
- vif->can_sg = !!val;
+ vif->can_sg = !!xenbus_read_unsigned(dev->otherend, "feature-sg", 0);
vif->gso_mask = 0;
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
- "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv4", 0))
vif->gso_mask |= GSO_BIT(TCPV4);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
- "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv6", 0))
vif->gso_mask |= GSO_BIT(TCPV6);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
- "%d", &val) < 0)
- val = 0;
- vif->ip_csum = !val;
+ vif->ip_csum = !xenbus_read_unsigned(dev->otherend,
+ "feature-no-csum-offload", 0);
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload",
- "%d", &val) < 0)
- val = 0;
- vif->ipv6_csum = !!val;
+ vif->ipv6_csum = !!xenbus_read_unsigned(dev->otherend,
+ "feature-ipv6-csum-offload", 0);
return 0;
}
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 07/12] xen: make use of xenbus_read_unsigned() in xen-netfront
2016-10-31 16:48 ` Juergen Gross
` (9 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, netdev
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: netdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/net/xen-netfront.c | 67 +++++++++++++---------------------------------
1 file changed, 18 insertions(+), 49 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e17879d..95d664e 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1169,43 +1169,23 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct netfront_info *np = netdev_priv(dev);
- int val;
- if (features & NETIF_F_SG) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg",
- "%d", &val) < 0)
- val = 0;
+ if (features & NETIF_F_SG &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0))
+ features &= ~NETIF_F_SG;
- if (!val)
- features &= ~NETIF_F_SG;
- }
+ if (features & NETIF_F_IPV6_CSUM &&
+ !xenbus_read_unsigned(np->xbdev->otherend,
+ "feature-ipv6-csum-offload", 0))
+ features &= ~NETIF_F_IPV6_CSUM;
- if (features & NETIF_F_IPV6_CSUM) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-ipv6-csum-offload", "%d", &val) < 0)
- val = 0;
+ if (features & NETIF_F_TSO &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0))
+ features &= ~NETIF_F_TSO;
- if (!val)
- features &= ~NETIF_F_IPV6_CSUM;
- }
-
- if (features & NETIF_F_TSO) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-gso-tcpv4", "%d", &val) < 0)
- val = 0;
-
- if (!val)
- features &= ~NETIF_F_TSO;
- }
-
- if (features & NETIF_F_TSO6) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-gso-tcpv6", "%d", &val) < 0)
- val = 0;
-
- if (!val)
- features &= ~NETIF_F_TSO6;
- }
+ if (features & NETIF_F_TSO6 &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0))
+ features &= ~NETIF_F_TSO6;
return features;
}
@@ -1821,18 +1801,13 @@ static int talk_to_netback(struct xenbus_device *dev,
info->netdev->irq = 0;
/* Check if backend supports multiple queues */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "multi-queue-max-queues", "%u", &max_queues);
- if (err < 0)
- max_queues = 1;
+ max_queues = xenbus_read_unsigned(info->xbdev->otherend,
+ "multi-queue-max-queues", 1);
num_queues = min(max_queues, xennet_max_queues);
/* Check feature-split-event-channels */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-split-event-channels", "%u",
- &feature_split_evtchn);
- if (err < 0)
- feature_split_evtchn = 0;
+ feature_split_evtchn = xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-split-event-channels", 0);
/* Read mac addr. */
err = xen_net_read_mac(dev, info->netdev->dev_addr);
@@ -1966,16 +1941,10 @@ static int xennet_connect(struct net_device *dev)
struct netfront_info *np = netdev_priv(dev);
unsigned int num_queues = 0;
int err;
- unsigned int feature_rx_copy;
unsigned int j = 0;
struct netfront_queue *queue = NULL;
- err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-rx-copy", "%u", &feature_rx_copy);
- if (err != 1)
- feature_rx_copy = 0;
-
- if (!feature_rx_copy) {
+ if (!xenbus_read_unsigned(np->xbdev->otherend, "feature-rx-copy", 0)) {
dev_info(&dev->dev,
"backend does not support copying receive path\n");
return -ENODEV;
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 07/12] xen: make use of xenbus_read_unsigned() in xen-netfront
2016-10-31 16:48 ` Juergen Gross
` (10 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, netdev, boris.ostrovsky, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of some reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: netdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/net/xen-netfront.c | 67 +++++++++++++---------------------------------
1 file changed, 18 insertions(+), 49 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e17879d..95d664e 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1169,43 +1169,23 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct netfront_info *np = netdev_priv(dev);
- int val;
- if (features & NETIF_F_SG) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg",
- "%d", &val) < 0)
- val = 0;
+ if (features & NETIF_F_SG &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0))
+ features &= ~NETIF_F_SG;
- if (!val)
- features &= ~NETIF_F_SG;
- }
+ if (features & NETIF_F_IPV6_CSUM &&
+ !xenbus_read_unsigned(np->xbdev->otherend,
+ "feature-ipv6-csum-offload", 0))
+ features &= ~NETIF_F_IPV6_CSUM;
- if (features & NETIF_F_IPV6_CSUM) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-ipv6-csum-offload", "%d", &val) < 0)
- val = 0;
+ if (features & NETIF_F_TSO &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0))
+ features &= ~NETIF_F_TSO;
- if (!val)
- features &= ~NETIF_F_IPV6_CSUM;
- }
-
- if (features & NETIF_F_TSO) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-gso-tcpv4", "%d", &val) < 0)
- val = 0;
-
- if (!val)
- features &= ~NETIF_F_TSO;
- }
-
- if (features & NETIF_F_TSO6) {
- if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-gso-tcpv6", "%d", &val) < 0)
- val = 0;
-
- if (!val)
- features &= ~NETIF_F_TSO6;
- }
+ if (features & NETIF_F_TSO6 &&
+ !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0))
+ features &= ~NETIF_F_TSO6;
return features;
}
@@ -1821,18 +1801,13 @@ static int talk_to_netback(struct xenbus_device *dev,
info->netdev->irq = 0;
/* Check if backend supports multiple queues */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "multi-queue-max-queues", "%u", &max_queues);
- if (err < 0)
- max_queues = 1;
+ max_queues = xenbus_read_unsigned(info->xbdev->otherend,
+ "multi-queue-max-queues", 1);
num_queues = min(max_queues, xennet_max_queues);
/* Check feature-split-event-channels */
- err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-split-event-channels", "%u",
- &feature_split_evtchn);
- if (err < 0)
- feature_split_evtchn = 0;
+ feature_split_evtchn = xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-split-event-channels", 0);
/* Read mac addr. */
err = xen_net_read_mac(dev, info->netdev->dev_addr);
@@ -1966,16 +1941,10 @@ static int xennet_connect(struct net_device *dev)
struct netfront_info *np = netdev_priv(dev);
unsigned int num_queues = 0;
int err;
- unsigned int feature_rx_copy;
unsigned int j = 0;
struct netfront_queue *queue = NULL;
- err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
- "feature-rx-copy", "%u", &feature_rx_copy);
- if (err != 1)
- feature_rx_copy = 0;
-
- if (!feature_rx_copy) {
+ if (!xenbus_read_unsigned(np->xbdev->otherend, "feature-rx-copy", 0)) {
dev_info(&dev->dev,
"backend does not support copying receive path\n");
return -ENODEV;
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
2016-10-31 16:48 ` Juergen Gross
` (11 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
2016-10-31 18:18 ` Bjorn Helgaas
2016-10-31 18:18 ` Bjorn Helgaas
-1 siblings, 2 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, bhelgaas, linux-pci
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/pci/xen-pcifront.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index d6ff5e8..8fc2e95 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
err = -ENOMEM;
goto out;
}
- err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
- &state);
- if (err != 1)
- state = XenbusStateUnknown;
+ state = xenbus_read_unsigned(pdev->xdev->otherend, str,
+ XenbusStateUnknown);
if (state != XenbusStateClosing)
continue;
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
2016-10-31 16:48 ` [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront Juergen Gross
@ 2016-10-31 18:18 ` Bjorn Helgaas
2016-10-31 18:18 ` Bjorn Helgaas
1 sibling, 0 replies; 55+ messages in thread
From: Bjorn Helgaas @ 2016-10-31 18:18 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-pci, linux-kernel, xen-devel, david.vrabel, bhelgaas,
boris.ostrovsky
On Mon, Oct 31, 2016 at 05:48:26PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: bhelgaas@google.com
> Cc: linux-pci@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
I assume this will be merged with the rest of the series via some tree
other than mine.
> ---
> drivers/pci/xen-pcifront.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index d6ff5e8..8fc2e95 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
> err = -ENOMEM;
> goto out;
> }
> - err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
> - &state);
> - if (err != 1)
> - state = XenbusStateUnknown;
> + state = xenbus_read_unsigned(pdev->xdev->otherend, str,
> + XenbusStateUnknown);
>
> if (state != XenbusStateClosing)
> continue;
> --
> 2.6.6
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
2016-10-31 16:48 ` [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront Juergen Gross
2016-10-31 18:18 ` Bjorn Helgaas
@ 2016-10-31 18:18 ` Bjorn Helgaas
1 sibling, 0 replies; 55+ messages in thread
From: Bjorn Helgaas @ 2016-10-31 18:18 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky, bhelgaas,
linux-pci
On Mon, Oct 31, 2016 at 05:48:26PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
>
> Cc: bhelgaas@google.com
> Cc: linux-pci@vger.kernel.org
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
I assume this will be merged with the rest of the series via some tree
other than mine.
> ---
> drivers/pci/xen-pcifront.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index d6ff5e8..8fc2e95 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
> err = -ENOMEM;
> goto out;
> }
> - err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
> - &state);
> - if (err != 1)
> - state = XenbusStateUnknown;
> + state = xenbus_read_unsigned(pdev->xdev->otherend, str,
> + XenbusStateUnknown);
>
> if (state != XenbusStateClosing)
> continue;
> --
> 2.6.6
>
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
2016-10-31 16:48 ` Juergen Gross
` (12 preceding siblings ...)
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, bhelgaas, boris.ostrovsky, david.vrabel, linux-pci
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Cc: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/pci/xen-pcifront.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index d6ff5e8..8fc2e95 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
err = -ENOMEM;
goto out;
}
- err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
- &state);
- if (err != 1)
- state = XenbusStateUnknown;
+ state = xenbus_read_unsigned(pdev->xdev->otherend, str,
+ XenbusStateUnknown);
if (state != XenbusStateClosing)
continue;
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 09/12] xen: make use of xenbus_read_unsigned() in xen-scsifront
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: david.vrabel, boris.ostrovsky, Juergen Gross
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/scsi/xen-scsifront.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 9dc8687..7e817c6 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -1060,13 +1060,9 @@ static void scsifront_read_backend_params(struct xenbus_device *dev,
struct vscsifrnt_info *info)
{
unsigned int sg_grant, nr_segs;
- int ret;
struct Scsi_Host *host = info->host;
- ret = xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg-grant", "%u",
- &sg_grant);
- if (ret != 1)
- sg_grant = 0;
+ sg_grant = xenbus_read_unsigned(dev->otherend, "feature-sg-grant", 0);
nr_segs = min_t(unsigned int, sg_grant, SG_ALL);
nr_segs = max_t(unsigned int, nr_segs, VSCSIIF_SG_TABLESIZE);
nr_segs = min_t(unsigned int, nr_segs,
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 09/12] xen: make use of xenbus_read_unsigned() in xen-scsifront
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: Juergen Gross, boris.ostrovsky, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/scsi/xen-scsifront.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 9dc8687..7e817c6 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -1060,13 +1060,9 @@ static void scsifront_read_backend_params(struct xenbus_device *dev,
struct vscsifrnt_info *info)
{
unsigned int sg_grant, nr_segs;
- int ret;
struct Scsi_Host *host = info->host;
- ret = xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg-grant", "%u",
- &sg_grant);
- if (ret != 1)
- sg_grant = 0;
+ sg_grant = xenbus_read_unsigned(dev->otherend, "feature-sg-grant", 0);
nr_segs = min_t(unsigned int, sg_grant, SG_ALL);
nr_segs = max_t(unsigned int, nr_segs, VSCSIIF_SG_TABLESIZE);
nr_segs = min_t(unsigned int, nr_segs,
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront
2016-10-31 16:48 ` Juergen Gross
(?)
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, tomi.valkeinen,
linux-fbdev
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/video/fbdev/xen-fbfront.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index 0567d51..d0115a7 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -633,7 +633,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
- int val;
switch (backend_state) {
case XenbusStateInitialising:
@@ -657,16 +656,12 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
if (dev->state != XenbusStateConnected)
goto InitWait; /* no InitWait seen yet, fudge it */
- if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "request-update", "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "request-update", 0))
info->update_wanted = 1;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-resize", "%d", &val) < 0)
- val = 0;
- info->feature_resize = val;
+ info->feature_resize = xenbus_read_unsigned(dev->otherend,
+ "feature-resize", 0);
break;
case XenbusStateClosed:
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Juergen Gross, boris.ostrovsky, tomi.valkeinen, david.vrabel,
linux-fbdev
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/video/fbdev/xen-fbfront.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index 0567d51..d0115a7 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -633,7 +633,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
- int val;
switch (backend_state) {
case XenbusStateInitialising:
@@ -657,16 +656,12 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
if (dev->state != XenbusStateConnected)
goto InitWait; /* no InitWait seen yet, fudge it */
- if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "request-update", "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "request-update", 0))
info->update_wanted = 1;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-resize", "%d", &val) < 0)
- val = 0;
- info->feature_resize = val;
+ info->feature_resize = xenbus_read_unsigned(dev->otherend,
+ "feature-resize", 0);
break;
case XenbusStateClosed:
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: david.vrabel, boris.ostrovsky, Juergen Gross, tomi.valkeinen,
linux-fbdev
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Cc: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/video/fbdev/xen-fbfront.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index 0567d51..d0115a7 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -633,7 +633,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
- int val;
switch (backend_state) {
case XenbusStateInitialising:
@@ -657,16 +656,12 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
if (dev->state != XenbusStateConnected)
goto InitWait; /* no InitWait seen yet, fudge it */
- if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "request-update", "%d", &val) < 0)
- val = 0;
- if (val)
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "request-update", 0))
info->update_wanted = 1;
- if (xenbus_scanf(XBT_NIL, dev->otherend,
- "feature-resize", "%d", &val) < 0)
- val = 0;
- info->feature_resize = val;
+ info->feature_resize = xenbus_read_unsigned(dev->otherend,
+ "feature-resize", 0);
break;
case XenbusStateClosed:
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 11/12] xen: make use of xenbus_read_unsigned() in xen-pciback
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: david.vrabel, boris.ostrovsky, Juergen Gross
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xen-pciback/xenbus.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 5ce878c..3f0aee0 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -362,7 +362,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
int err = 0;
int num_devs;
int domain, bus, slot, func;
- int substate;
+ unsigned int substate;
int i, len;
char state_str[64];
char dev_str[64];
@@ -395,10 +395,8 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
"configuration");
goto out;
}
- err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str,
- "%d", &substate);
- if (err != 1)
- substate = XenbusStateUnknown;
+ substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str,
+ XenbusStateUnknown);
switch (substate) {
case XenbusStateInitialising:
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 11/12] xen: make use of xenbus_read_unsigned() in xen-pciback
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: Juergen Gross, boris.ostrovsky, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xen-pciback/xenbus.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 5ce878c..3f0aee0 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -362,7 +362,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
int err = 0;
int num_devs;
int domain, bus, slot, func;
- int substate;
+ unsigned int substate;
int i, len;
char state_str[64];
char dev_str[64];
@@ -395,10 +395,8 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
"configuration");
goto out;
}
- err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str,
- "%d", &substate);
- if (err != 1)
- substate = XenbusStateUnknown;
+ substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str,
+ XenbusStateUnknown);
switch (substate) {
case XenbusStateInitialising:
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 12/12] xen: make use of xenbus_read_unsigned() in xenbus
2016-10-31 16:48 ` Juergen Gross
@ 2016-10-31 16:48 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: david.vrabel, boris.ostrovsky, Juergen Gross
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_probe_backend.c | 8 +-------
drivers/xen/xenbus/xenbus_xs.c | 7 +++----
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
index 04f7f85..37929df 100644
--- a/drivers/xen/xenbus/xenbus_probe_backend.c
+++ b/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -224,13 +224,7 @@ static int read_frontend_details(struct xenbus_device *xendev)
int xenbus_dev_is_online(struct xenbus_device *dev)
{
- int rc, val;
-
- rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val);
- if (rc != 1)
- val = 0; /* no online node present */
-
- return val;
+ return !!xenbus_read_unsigned(dev->nodename, "online", 0);
}
EXPORT_SYMBOL_GPL(xenbus_dev_is_online);
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 99dfdfa..6afb993 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -687,7 +687,7 @@ static bool xen_strict_xenbus_quirk(void)
}
static void xs_reset_watches(void)
{
- int err, supported = 0;
+ int err;
if (!xen_hvm_domain() || xen_initial_domain())
return;
@@ -695,9 +695,8 @@ static void xs_reset_watches(void)
if (xen_strict_xenbus_quirk())
return;
- err = xenbus_scanf(XBT_NIL, "control",
- "platform-feature-xs_reset_watches", "%d", &supported);
- if (err != 1 || !supported)
+ if (!xenbus_read_unsigned("control",
+ "platform-feature-xs_reset_watches", 0))
return;
err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL));
--
2.6.6
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH 12/12] xen: make use of xenbus_read_unsigned() in xenbus
@ 2016-10-31 16:48 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: Juergen Gross, boris.ostrovsky, david.vrabel
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_probe_backend.c | 8 +-------
drivers/xen/xenbus/xenbus_xs.c | 7 +++----
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
index 04f7f85..37929df 100644
--- a/drivers/xen/xenbus/xenbus_probe_backend.c
+++ b/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -224,13 +224,7 @@ static int read_frontend_details(struct xenbus_device *xendev)
int xenbus_dev_is_online(struct xenbus_device *dev)
{
- int rc, val;
-
- rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val);
- if (rc != 1)
- val = 0; /* no online node present */
-
- return val;
+ return !!xenbus_read_unsigned(dev->nodename, "online", 0);
}
EXPORT_SYMBOL_GPL(xenbus_dev_is_online);
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 99dfdfa..6afb993 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -687,7 +687,7 @@ static bool xen_strict_xenbus_quirk(void)
}
static void xs_reset_watches(void)
{
- int err, supported = 0;
+ int err;
if (!xen_hvm_domain() || xen_initial_domain())
return;
@@ -695,9 +695,8 @@ static void xs_reset_watches(void)
if (xen_strict_xenbus_quirk())
return;
- err = xenbus_scanf(XBT_NIL, "control",
- "platform-feature-xs_reset_watches", "%d", &supported);
- if (err != 1 || !supported)
+ if (!xenbus_read_unsigned("control",
+ "platform-feature-xs_reset_watches", 0))
return;
err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL));
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-10-31 16:48 ` Juergen Gross
(?)
@ 2016-10-31 17:08 ` David Miller
-1 siblings, 0 replies; 55+ messages in thread
From: David Miller @ 2016-10-31 17:08 UTC (permalink / raw)
To: jgross
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen,
jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2,
paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen,
linux-fbdev
From: Juergen Gross <jgross@suse.com>
Date: Mon, 31 Oct 2016 17:48:18 +0100
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
As this seems to be a series that will go through some tree other
than mine, I assume the networking bits will be taken care of that
way.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-10-31 17:08 ` David Miller
0 siblings, 0 replies; 55+ messages in thread
From: David Miller @ 2016-10-31 17:08 UTC (permalink / raw)
To: jgross
Cc: linux-fbdev, wei.liu2, linux-pci, netdev, tomi.valkeinen,
dmitry.torokhov, tpmdd, linux-kernel, jarkko.sakkinen, xen-devel,
jgunthorpe, tpmdd-devel, david.vrabel, linux-input, bhelgaas,
boris.ostrovsky, peterhuewe, paul.durrant, roger.pau
From: Juergen Gross <jgross@suse.com>
Date: Mon, 31 Oct 2016 17:48:18 +0100
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
As this seems to be a series that will go through some tree other
than mine, I assume the networking bits will be taken care of that
way.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-10-31 17:08 ` David Miller
0 siblings, 0 replies; 55+ messages in thread
From: David Miller @ 2016-10-31 17:08 UTC (permalink / raw)
To: jgross
Cc: linux-fbdev, wei.liu2, linux-pci, netdev, tomi.valkeinen,
dmitry.torokhov, tpmdd, linux-kernel, jarkko.sakkinen, xen-devel,
jgunthorpe, tpmdd-devel, david.vrabel, linux-input, bhelgaas,
boris.ostrovsky, peterhuewe, paul.durrant, roger.pau
From: Juergen Gross <jgross@suse.com>
Date: Mon, 31 Oct 2016 17:48:18 +0100
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
As this seems to be a series that will go through some tree other
than mine, I assume the networking bits will be taken care of that
way.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-10-31 17:08 ` David Miller
@ 2016-11-01 4:33 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-11-01 4:33 UTC (permalink / raw)
To: David Miller
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen,
jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2,
paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen,
linux-fbdev
On 31/10/16 18:08, David Miller wrote:
> From: Juergen Gross <jgross@suse.com>
> Date: Mon, 31 Oct 2016 17:48:18 +0100
>
>> There are multiple instances of code reading an optional unsigned
>> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
>> same code over and over add a service function doing the job and
>> replace the call of xenbus_scanf() with the call of the new function
>> where appropriate.
>
> As this seems to be a series that will go through some tree other
> than mine, I assume the networking bits will be taken care of that
> way.
>
If accepted I expect this series to go through the Xen tree.
Juergen
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-01 4:33 ` Juergen Gross
0 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-11-01 4:33 UTC (permalink / raw)
To: David Miller
Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky,
konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen,
jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2,
paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen,
linux-fbdev
On 31/10/16 18:08, David Miller wrote:
> From: Juergen Gross <jgross@suse.com>
> Date: Mon, 31 Oct 2016 17:48:18 +0100
>
>> There are multiple instances of code reading an optional unsigned
>> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
>> same code over and over add a service function doing the job and
>> replace the call of xenbus_scanf() with the call of the new function
>> where appropriate.
>
> As this seems to be a series that will go through some tree other
> than mine, I assume the networking bits will be taken care of that
> way.
>
If accepted I expect this series to go through the Xen tree.
Juergen
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-10-31 17:08 ` David Miller
` (2 preceding siblings ...)
(?)
@ 2016-11-01 4:33 ` Juergen Gross
-1 siblings, 0 replies; 55+ messages in thread
From: Juergen Gross @ 2016-11-01 4:33 UTC (permalink / raw)
To: David Miller
Cc: linux-fbdev, wei.liu2, linux-pci, netdev, tomi.valkeinen,
dmitry.torokhov, tpmdd, linux-kernel, jarkko.sakkinen, xen-devel,
jgunthorpe, tpmdd-devel, david.vrabel, linux-input, bhelgaas,
boris.ostrovsky, peterhuewe, paul.durrant, roger.pau
On 31/10/16 18:08, David Miller wrote:
> From: Juergen Gross <jgross@suse.com>
> Date: Mon, 31 Oct 2016 17:48:18 +0100
>
>> There are multiple instances of code reading an optional unsigned
>> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
>> same code over and over add a service function doing the job and
>> replace the call of xenbus_scanf() with the call of the new function
>> where appropriate.
>
> As this seems to be a series that will go through some tree other
> than mine, I assume the networking bits will be taken care of that
> way.
>
If accepted I expect this series to go through the Xen tree.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-10-31 16:48 ` Juergen Gross
(?)
@ 2016-11-07 11:08 ` David Vrabel
-1 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:08 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: boris.ostrovsky, konrad.wilk, roger.pau, peterhuewe, tpmdd,
jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov,
linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci,
tomi.valkeinen, linux-fbdev
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
Acked-by: David Vrabel <david.vrabel@citrix.com>
Please queue for the next release.
David
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-07 11:08 ` David Vrabel
0 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:08 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: boris.ostrovsky, konrad.wilk, roger.pau, peterhuewe, tpmdd,
jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov,
linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci,
tomi.valkeinen, linux-fbdev
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
Acked-by: David Vrabel <david.vrabel@citrix.com>
Please queue for the next release.
David
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-07 11:08 ` David Vrabel
0 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:08 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: boris.ostrovsky, konrad.wilk, roger.pau, peterhuewe, tpmdd,
jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov,
linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci,
tomi.valkeinen, linux-fbdev
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
Acked-by: David Vrabel <david.vrabel@citrix.com>
Please queue for the next release.
David
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-11-07 11:08 ` David Vrabel
(?)
(?)
@ 2016-11-07 16:20 ` Jarkko Sakkinen
-1 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-07 16:20 UTC (permalink / raw)
To: David Vrabel
Cc: Juergen Gross, linux-fbdev, wei.liu2, linux-pci, netdev,
tomi.valkeinen, dmitry.torokhov, tpmdd, linux-kernel, xen-devel,
jgunthorpe, tpmdd-devel, linux-input, bhelgaas, boris.ostrovsky,
peterhuewe, paul.durrant, roger.pau
On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote:
> On 31/10/16 16:48, Juergen Gross wrote:
> > There are multiple instances of code reading an optional unsigned
> > parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> > same code over and over add a service function doing the job and
> > replace the call of xenbus_scanf() with the call of the new function
> > where appropriate.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>
>
> Please queue for the next release.
If you want this change to tpmdd, please resend it to tpmdd mailing
list and CC it to linux-security-module. Thanks.
> David
/Jarkko
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-07 16:20 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-07 16:20 UTC (permalink / raw)
To: David Vrabel
Cc: Juergen Gross, linux-kernel, xen-devel, boris.ostrovsky,
konrad.wilk, roger.pau, peterhuewe, tpmdd, jgunthorpe,
tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2,
paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen,
linux-fbdev
On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote:
> On 31/10/16 16:48, Juergen Gross wrote:
> > There are multiple instances of code reading an optional unsigned
> > parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> > same code over and over add a service function doing the job and
> > replace the call of xenbus_scanf() with the call of the new function
> > where appropriate.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>
>
> Please queue for the next release.
If you want this change to tpmdd, please resend it to tpmdd mailing
list and CC it to linux-security-module. Thanks.
> David
/Jarkko
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-07 16:20 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-07 16:20 UTC (permalink / raw)
To: David Vrabel
Cc: Juergen Gross, linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
wei.liu2-Sxgqhf6Nn4DQT0dZR+AlfA,
konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA,
linux-pci-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
tomi.valkeinen-l0cyMroinI0,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
xen-devel-GuqFBffKawuEi8DpZVb4nw,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-input-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA,
paul.durrant-Sxgqhf6Nn4DQT0dZR+AlfA,
roger.pau-Sxgqhf6Nn4DQT0dZR+AlfA
On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote:
> On 31/10/16 16:48, Juergen Gross wrote:
> > There are multiple instances of code reading an optional unsigned
> > parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> > same code over and over add a service function doing the job and
> > replace the call of xenbus_scanf() with the call of the new function
> > where appropriate.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>
>
> Please queue for the next release.
If you want this change to tpmdd, please resend it to tpmdd mailing
list and CC it to linux-security-module. Thanks.
> David
/Jarkko
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
@ 2016-11-07 16:20 ` Jarkko Sakkinen
0 siblings, 0 replies; 55+ messages in thread
From: Jarkko Sakkinen @ 2016-11-07 16:20 UTC (permalink / raw)
To: David Vrabel
Cc: Juergen Gross, linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
wei.liu2-Sxgqhf6Nn4DQT0dZR+AlfA,
konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA,
linux-pci-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
tomi.valkeinen-l0cyMroinI0,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
xen-devel-GuqFBffKawuEi8DpZVb4nw,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-input-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA,
paul.durrant-Sxgqhf6Nn4DQT0dZR+AlfA,
roger.pau-Sxgqhf6Nn4DQT0dZR+AlfA
On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote:
> On 31/10/16 16:48, Juergen Gross wrote:
> > There are multiple instances of code reading an optional unsigned
> > parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> > same code over and over add a service function doing the job and
> > replace the call of xenbus_scanf() with the call of the new function
> > where appropriate.
>
> Acked-by: David Vrabel <david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
>
> Please queue for the next release.
If you want this change to tpmdd, please resend it to tpmdd mailing
list and CC it to linux-security-module. Thanks.
> David
/Jarkko
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value
2016-10-31 16:48 ` Juergen Gross
` (19 preceding siblings ...)
(?)
@ 2016-11-07 11:08 ` David Vrabel
-1 siblings, 0 replies; 55+ messages in thread
From: David Vrabel @ 2016-11-07 11:08 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel
Cc: linux-fbdev, wei.liu2, linux-pci, netdev, tomi.valkeinen,
dmitry.torokhov, tpmdd, jarkko.sakkinen, jgunthorpe, tpmdd-devel,
linux-input, bhelgaas, boris.ostrovsky, peterhuewe, paul.durrant,
roger.pau
On 31/10/16 16:48, Juergen Gross wrote:
> There are multiple instances of code reading an optional unsigned
> parameter from Xenstore via xenbus_scanf(). Instead of repeating the
> same code over and over add a service function doing the job and
> replace the call of xenbus_scanf() with the call of the new function
> where appropriate.
Acked-by: David Vrabel <david.vrabel@citrix.com>
Please queue for the next release.
David
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 55+ messages in thread