qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nir Soffer <nsoffer@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-block@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Nir Soffer" <nsoffer@redhat.com>
Subject: [PATCH v2 1/5] qemu-img.c: Move IO_BUF_SIZE to the top of the file
Date: Mon, 28 Nov 2022 16:15:10 +0200	[thread overview]
Message-ID: <20221128141514.388724-2-nsoffer@redhat.com> (raw)
In-Reply-To: <20221128141514.388724-1-nsoffer@redhat.com>

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(-)

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
-- 
2.38.1



  reply	other threads:[~2022-11-28 14:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 14:15 [PATCH v2 0/5] Add qemu-img checksum command using blkhash Nir Soffer
2022-11-28 14:15 ` Nir Soffer [this message]
2022-12-12 10:35   ` [PATCH v2 1/5] qemu-img.c: Move IO_BUF_SIZE to the top of the file Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 2/5] Support format or cache specific out file Nir Soffer
2022-12-12 10:38   ` Hanna Reitz
2022-12-13 15:56     ` Nir Soffer
2022-12-13 18:09       ` Hanna Reitz
2022-12-13 19:53         ` Nir Soffer
2022-11-28 14:15 ` [PATCH v2 3/5] qemu-img: Add checksum command Nir Soffer
2022-12-12 10:42   ` Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 4/5] iotests: Test qemu-img checksum Nir Soffer
2022-12-12 10:43   ` Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 5/5] qemu-img: Speed up checksum Nir Soffer
2022-12-12 10:43   ` Hanna Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221128141514.388724-2-nsoffer@redhat.com \
    --to=nsoffer@redhat.com \
    --cc=berrange@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).