Commit 6694389a authored by Jan Beulich's avatar Jan Beulich Committed by Konrad Rzeszutek Wilk

xen-blkback: prefer xenbus_scanf() over xenbus_gather()

... 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: default avatarJan Beulich <jbeulich@suse.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Acked-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6ba286ad
...@@ -1022,9 +1022,9 @@ static int connect_ring(struct backend_info *be) ...@@ -1022,9 +1022,9 @@ static int connect_ring(struct backend_info *be)
pr_debug("%s %s\n", __func__, dev->otherend); pr_debug("%s %s\n", __func__, dev->otherend);
be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT;
err = xenbus_gather(XBT_NIL, dev->otherend, "protocol", err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol",
"%63s", protocol, NULL); "%63s", protocol);
if (err) if (err <= 0)
strcpy(protocol, "unspecified, assuming default"); strcpy(protocol, "unspecified, assuming default");
else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE))
be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE;
...@@ -1036,10 +1036,9 @@ static int connect_ring(struct backend_info *be) ...@@ -1036,10 +1036,9 @@ static int connect_ring(struct backend_info *be)
xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
return -ENOSYS; return -ENOSYS;
} }
err = xenbus_gather(XBT_NIL, dev->otherend, err = xenbus_scanf(XBT_NIL, dev->otherend,
"feature-persistent", "%u", "feature-persistent", "%u", &pers_grants);
&pers_grants, NULL); if (err <= 0)
if (err)
pers_grants = 0; pers_grants = 0;
be->blkif->vbd.feature_gnt_persistent = pers_grants; be->blkif->vbd.feature_gnt_persistent = pers_grants;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment