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

xen-blkfront: 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.
Acked-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Acked-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 6694389a
...@@ -2208,10 +2208,9 @@ static void blkfront_setup_discard(struct blkfront_info *info) ...@@ -2208,10 +2208,9 @@ static void blkfront_setup_discard(struct blkfront_info *info)
info->discard_granularity = discard_granularity; info->discard_granularity = discard_granularity;
info->discard_alignment = discard_alignment; info->discard_alignment = discard_alignment;
} }
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"discard-secure", "%d", &discard_secure, "discard-secure", "%u", &discard_secure);
NULL); if (err > 0)
if (!err)
info->feature_secdiscard = !!discard_secure; info->feature_secdiscard = !!discard_secure;
} }
...@@ -2310,9 +2309,8 @@ static void blkfront_gather_backend_features(struct blkfront_info *info) ...@@ -2310,9 +2309,8 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
info->feature_flush = 0; info->feature_flush = 0;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"feature-barrier", "%d", &barrier, "feature-barrier", "%d", &barrier);
NULL);
/* /*
* If there's no "feature-barrier" defined, then it means * If there's no "feature-barrier" defined, then it means
...@@ -2321,38 +2319,35 @@ static void blkfront_gather_backend_features(struct blkfront_info *info) ...@@ -2321,38 +2319,35 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
* *
* If there are barriers, then we use flush. * If there are barriers, then we use flush.
*/ */
if (!err && barrier) if (err > 0 && barrier)
info->feature_flush = REQ_FLUSH | REQ_FUA; info->feature_flush = REQ_FLUSH | REQ_FUA;
/* /*
* And if there is "feature-flush-cache" use that above * And if there is "feature-flush-cache" use that above
* barriers. * barriers.
*/ */
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"feature-flush-cache", "%d", &flush, "feature-flush-cache", "%d", &flush);
NULL);
if (!err && flush) if (err > 0 && flush)
info->feature_flush = REQ_FLUSH; info->feature_flush = REQ_FLUSH;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"feature-discard", "%d", &discard, "feature-discard", "%d", &discard);
NULL);
if (!err && discard) if (err > 0 && discard)
blkfront_setup_discard(info); blkfront_setup_discard(info);
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"feature-persistent", "%u", &persistent, "feature-persistent", "%d", &persistent);
NULL); if (err <= 0)
if (err)
info->feature_persistent = 0; info->feature_persistent = 0;
else else
info->feature_persistent = persistent; info->feature_persistent = persistent;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
"feature-max-indirect-segments", "%u", &indirect_segments, "feature-max-indirect-segments", "%u",
NULL); &indirect_segments);
if (err) if (err <= 0)
info->max_indirect_segments = 0; info->max_indirect_segments = 0;
else else
info->max_indirect_segments = min(indirect_segments, info->max_indirect_segments = min(indirect_segments,
......
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