]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen-blkback: prefer xenbus_scanf() over xenbus_gather()
authorJan Beulich <JBeulich@suse.com>
Thu, 7 Jul 2016 08:05:21 +0000 (02:05 -0600)
committerBob Liu <bob.liu@oracle.com>
Thu, 20 Oct 2016 08:00:43 +0000 (04:00 -0400)
... 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 <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 6694389af9be4d1eb8d3313788a902f0590fb8c2)
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Orabug: 24820937

drivers/block/xen-blkback/xenbus.c

index 26aa080e243cb59fa2ba4f2ba39d41f644c46265..43f8a1c9622f1c56ad4f2f5232118ff3968cbdd3 100644 (file)
@@ -1022,9 +1022,9 @@ static int connect_ring(struct backend_info *be)
        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_info *be)
                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;