summaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-06-26 13:23:21 +0200
committerKevin Wolf <kwolf@redhat.com>2014-08-15 15:07:13 +0200
commit43716fa8058a9095b9c1f9be4397dbaf7c521ee0 (patch)
treedd3c9d56991cf83995e707230e59fde41e10776a /qemu-img.c
parent30a7f2fc9178080a0ce22c12767ce994f882937e (diff)
downloadqemu-43716fa8058a9095b9c1f9be4397dbaf7c521ee0.tar.gz
block: Use bdrv_nb_sectors() in img_convert()
Instead of bdrv_getlength(). Replace variable output_length by output_sectors. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qemu-img.c b/qemu-img.c
index d4518e724f..9832a7ee12 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1469,13 +1469,13 @@ static int img_convert(int argc, char **argv)
buf = qemu_blockalign(out_bs, bufsectors * BDRV_SECTOR_SIZE);
if (skip_create) {
- int64_t output_length = bdrv_getlength(out_bs);
- if (output_length < 0) {
+ int64_t output_sectors = bdrv_nb_sectors(out_bs);
+ if (output_sectors < 0) {
error_report("unable to get output image length: %s\n",
- strerror(-output_length));
+ strerror(-output_sectors));
ret = -1;
goto out;
- } else if (output_length < total_sectors << BDRV_SECTOR_BITS) {
+ } else if (output_sectors < total_sectors) {
error_report("output file is smaller than input file");
ret = -1;
goto out;