diff mbox series

[v2,1/5] qemu-img.c: Move IO_BUF_SIZE to the top of the file

Message ID 20221128141514.388724-2-nsoffer@redhat.com (mailing list archive)
State New, archived
Headers show
Series Add qemu-img checksum command using blkhash | expand

Commit Message

Nir Soffer Nov. 28, 2022, 2:15 p.m. UTC
This macro is used by various commands (compare, convert, rebase) but it
is defined somewhere in the middle of the file. I'm going to use it in
the new checksum command so lets clean up a bit before that.
---
 qemu-img.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Hanna Czenczek Dec. 12, 2022, 10:35 a.m. UTC | #1
On 28.11.22 15:15, Nir Soffer wrote:
> This macro is used by various commands (compare, convert, rebase) but it
> is defined somewhere in the middle of the file. I'm going to use it in
> the new checksum command so lets clean up a bit before that.
> ---
>   qemu-img.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Looks good, but is missing your S-o-b – with it added:

Reviewed-by: Hanna Reitz <hreitz@redhat.com>
diff mbox series

Patch

diff --git a/qemu-img.c b/qemu-img.c
index a9b3a8103c..c03d6b4b31 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -49,20 +49,21 @@ 
 #include "block/block_int.h"
 #include "block/blockjob.h"
 #include "block/qapi.h"
 #include "crypto/init.h"
 #include "trace/control.h"
 #include "qemu/throttle.h"
 #include "block/throttle-groups.h"
 
 #define QEMU_IMG_VERSION "qemu-img version " QEMU_FULL_VERSION \
                           "\n" QEMU_COPYRIGHT "\n"
+#define IO_BUF_SIZE (2 * MiB)
 
 typedef struct img_cmd_t {
     const char *name;
     int (*handler)(int argc, char **argv);
 } img_cmd_t;
 
 enum {
     OPTION_OUTPUT = 256,
     OPTION_BACKING_CHAIN = 257,
     OPTION_OBJECT = 258,
@@ -1281,22 +1282,20 @@  static int compare_buffers(const uint8_t *buf1, const uint8_t *buf2,
         if (!!memcmp(buf1 + i, buf2 + i, len) != res) {
             break;
         }
         i += len;
     }
 
     *pnum = i;
     return res;
 }
 
-#define IO_BUF_SIZE (2 * MiB)
-
 /*
  * Check if passed sectors are empty (not allocated or contain only 0 bytes)
  *
  * Intended for use by 'qemu-img compare': Returns 0 in case sectors are
  * filled with 0, 1 if sectors contain non-zero data (this is a comparison
  * failure), and 4 on error (the exit status for read errors), after emitting
  * an error message.
  *
  * @param blk:  BlockBackend for the image
  * @param offset: Starting offset to check