[PATCH 00/12] xen: add common function for reading optional value

STALE3560d

6 messages, 4 authors, 2016-11-07 · open the first message on its own page

[PATCH 00/12] xen: add common function for reading optional value

From: Juergen Gross <jgross@suse.com>
Date: 2016-10-31 16:48:46

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

[PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront

From: Juergen Gross <jgross@suse.com>
Date: 2016-10-31 16:50:11

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

Re: [PATCH 00/12] xen: add common function for reading optional value

From: David Miller <davem@davemloft.net>
Date: 2016-10-31 17:09:30

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.

Re: [PATCH 00/12] xen: add common function for reading optional value

From: Juergen Gross <jgross@suse.com>
Date: 2016-11-01 04:33:12

On 31/10/16 18:08, David Miller wrote:
From: Juergen Gross <jgross@suse.com>
Date: Mon, 31 Oct 2016 17:48:18 +0100
quoted
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

Re: [PATCH 00/12] xen: add common function for reading optional value

From: David Vrabel <hidden>
Date: 2016-11-07 11:08:19

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 <redacted>

Please queue for the next release.

David

Re: [PATCH 00/12] xen: add common function for reading optional value

From: Jarkko Sakkinen <hidden>
Date: 2016-11-07 16:20:58

On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote:
On 31/10/16 16:48, Juergen Gross wrote:
quoted
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 <redacted>

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help