[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] qemu-img: Explicit number replaced by a constant
From: |
Yi Li |
Subject: |
[PATCH] qemu-img: Explicit number replaced by a constant |
Date: |
Mon, 17 Aug 2020 19:01:13 +0800 |
Signed-off-by: Yi Li <yili@winhong.com>
---
qemu-img.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 5308773811..a0fbc2757c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1181,7 +1181,7 @@ static int64_t find_nonzero(const uint8_t *buf, int64_t n)
}
/*
- * Returns true iff the first sector pointed to by 'buf' contains at least
+ * Returns true if the first sector pointed to by 'buf' contains at least
* a non-NUL byte.
*
* 'pnum' is set to the number of sectors (including and immediately following
@@ -1200,10 +1200,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;
}
}
@@ -2489,8 +2489,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;
--
2.25.3
- [PATCH] qemu-img: Explicit number replaced by a constant,
Yi Li <=