From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756674AbcGGIFZ (ORCPT ); Thu, 7 Jul 2016 04:05:25 -0400 Received: from prv-mh.provo.novell.com ([137.65.248.74]:57827 "EHLO prv-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030272AbcGGIFV convert rfc822-to-8bit (ORCPT ); Thu, 7 Jul 2016 04:05:21 -0400 Message-Id: <577E296102000078000FBF1C@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Thu, 07 Jul 2016 02:05:21 -0600 From: "Jan Beulich" To: "Roger Pau Monne" , "Konrad Rzeszutek Wilk" Cc: , Subject: [PATCH] xen-blkback: prefer xenbus_scanf() over xenbus_gather() Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ... for single items being collected: It is more typesafe (as the compiler can check format string and to-be-written-to variable match) and requires one less parameter to be passed. Signed-off-by: Jan Beulich --- drivers/block/xen-blkback/xenbus.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- 4.7-rc6-prefer-xenbus_scanf.orig/drivers/block/xen-blkback/xenbus.c +++ 4.7-rc6-prefer-xenbus_scanf/drivers/block/xen-blkback/xenbus.c @@ -1022,9 +1022,9 @@ static int connect_ring(struct backend_i pr_debug("%s %s\n", __func__, dev->otherend); be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; - err = xenbus_gather(XBT_NIL, dev->otherend, "protocol", - "%63s", protocol, NULL); - if (err) + err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol", + "%63s", protocol); + if (err <= 0) strcpy(protocol, "unspecified, assuming default"); else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; @@ -1036,10 +1036,9 @@ static int connect_ring(struct backend_i xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); return -ENOSYS; } - err = xenbus_gather(XBT_NIL, dev->otherend, - "feature-persistent", "%u", - &pers_grants, NULL); - if (err) + err = xenbus_scanf(XBT_NIL, dev->otherend, + "feature-persistent", "%u", &pers_grants); + if (err <= 0) pers_grants = 0; be->blkif->vbd.feature_gnt_persistent = pers_grants;