aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Li <yili@winhong.com>2020-08-19 09:36:07 +0800
committerMax Reitz <mreitz@redhat.com>2020-09-15 11:05:13 +0200
commitc075c42f9bbde79d07bb680ad0d8aa20b5a387dc (patch)
treea89435dc69d97736a57909e22a370e56d0db9e90
parent2b60c5b996e71eb5186bed7727982a471d5d2558 (diff)
qemu-img: Explicit number replaced by a constant
Signed-off-by: Yi Li <yili@winhong.com> Message-Id: <20200819013607.32280-1-yili@winhong.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--qemu-img.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 37365d06fa..1d8c5cd778 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1201,10 +1201,10 @@ static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum,
*pnum = 0;
return 0;
}
- is_zero = buffer_is_zero(buf, 512);
+ is_zero = buffer_is_zero(buf, BDRV_SECTOR_SIZE);
for(i = 1; i < n; i++) {
- buf += 512;
- if (is_zero != buffer_is_zero(buf, 512)) {
+ buf += BDRV_SECTOR_SIZE;
+ if (is_zero != buffer_is_zero(buf, BDRV_SECTOR_SIZE)) {
break;
}
}
@@ -2513,8 +2513,8 @@ static int img_convert(int argc, char **argv)
}
}
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s.total_sectors * 512,
- &error_abort);
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
+ s.total_sectors * BDRV_SECTOR_SIZE, &error_abort);
ret = add_old_style_options(out_fmt, opts, out_baseimg, NULL);
if (ret < 0) {
goto out;