[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 06/10] block: Use bdrv_nb_sectors() in img_conver
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v5 06/10] block: Use bdrv_nb_sectors() in img_convert() |
Date: |
Thu, 26 Jun 2014 13:23:21 +0200 |
Instead of bdrv_getlength(). Replace variable output_length by
output_sectors.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
---
qemu-img.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index c98896b..c16037b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1470,13 +1470,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;
--
1.9.3
- [Qemu-devel] [PATCH v5 00/10] Clean up around bdrv_getlength(), Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 04/10] block: Use bdrv_nb_sectors() in bdrv_aligned_preadv(), Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 03/10] block: Use bdrv_nb_sectors() in bdrv_make_zero(), Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 02/10] block: New bdrv_nb_sectors(), Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 07/10] block: Use bdrv_nb_sectors() where sectors, not bytes are wanted, Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 10/10] block: Avoid bdrv_get_geometry() where errors should be detected, Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 05/10] block: Use bdrv_nb_sectors() in bdrv_co_get_block_status(), Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 08/10] block: Drop superfluous aligning of bdrv_getlength()'s value, Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 06/10] block: Use bdrv_nb_sectors() in img_convert(),
Markus Armbruster <=
- [Qemu-devel] [PATCH v5 09/10] qemu-img: Make img_convert() get image size just once per image, Markus Armbruster, 2014/06/26
- [Qemu-devel] [PATCH v5 01/10] raw-posix: Fix raw_getlength() to always return -errno on error, Markus Armbruster, 2014/06/26