diff options
author | Jan Beulich <JBeulich@suse.com> | 2016-07-07 04:05:21 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2016-07-22 08:23:38 -0400 |
commit | 6694389af9be4d1eb8d3313788a902f0590fb8c2 (patch) | |
tree | 017c38ced502ee9bc874259be7ab61031a15df27 | |
parent | 6ba286ad845799b135e5af73d1fbc838fa79f709 (diff) |
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: 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>
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 3355f1cdd4e5..bf09ffe5d460 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -1022,9 +1022,9 @@ static int connect_ring(struct backend_info *be) | |||
1022 | pr_debug("%s %s\n", __func__, dev->otherend); | 1022 | pr_debug("%s %s\n", __func__, dev->otherend); |
1023 | 1023 | ||
1024 | be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; | 1024 | be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; |
1025 | err = xenbus_gather(XBT_NIL, dev->otherend, "protocol", | 1025 | err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol", |
1026 | "%63s", protocol, NULL); | 1026 | "%63s", protocol); |
1027 | if (err) | 1027 | if (err <= 0) |
1028 | strcpy(protocol, "unspecified, assuming default"); | 1028 | strcpy(protocol, "unspecified, assuming default"); |
1029 | else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) | 1029 | else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) |
1030 | be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; | 1030 | be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; |
@@ -1036,10 +1036,9 @@ static int connect_ring(struct backend_info *be) | |||
1036 | xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); | 1036 | xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); |
1037 | return -ENOSYS; | 1037 | return -ENOSYS; |
1038 | } | 1038 | } |
1039 | err = xenbus_gather(XBT_NIL, dev->otherend, | 1039 | err = xenbus_scanf(XBT_NIL, dev->otherend, |
1040 | "feature-persistent", "%u", | 1040 | "feature-persistent", "%u", &pers_grants); |
1041 | &pers_grants, NULL); | 1041 | if (err <= 0) |
1042 | if (err) | ||
1043 | pers_grants = 0; | 1042 | pers_grants = 0; |
1044 | 1043 | ||
1045 | be->blkif->vbd.feature_gnt_persistent = pers_grants; | 1044 | be->blkif->vbd.feature_gnt_persistent = pers_grants; |