qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Reda Sallahi <fullmanet@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Reda Sallahi <fullmanet@gmail.com>
Subject: [Qemu-devel] [PATCH 4/7] qemu-img: delete not used variable and an unecessary check
Date: Mon, 22 Aug 2016 09:55:14 +0200	[thread overview]
Message-ID: <20160822075517.5859-5-fullmanet@gmail.com> (raw)
In-Reply-To: <20160822075517.5859-1-fullmanet@gmail.com>

block_count is not used in img_dd() and the C_SKIP check is unecessary so
this patch removes both of them.

Signed-off-by: Reda Sallahi <fullmanet@gmail.com>
---
 qemu-img.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index ae3828e..cf78dfe 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -4093,7 +4093,7 @@ static int img_dd(int argc, char **argv)
     const char *out_fmt = "raw";
     const char *fmt = NULL;
     int64_t size = 0, out_size = 0;
-    int64_t block_count = 0, out_pos, in_pos, sparse_count = 0;
+    int64_t out_pos, in_pos, sparse_count = 0;
     bool writethrough = false;
     int flags = 0;
     int ibsz = 0, obsz = 0, bsz;
@@ -4373,8 +4373,7 @@ static int img_dd(int argc, char **argv)
         }
     }
 
-    if (dd.flags & C_SKIP && (in.offset > INT64_MAX / ibsz ||
-                              size < in.offset * ibsz)) {
+    if (in.offset > INT64_MAX / ibsz || size < in.offset * ibsz) {
         /* We give a warning if the skip option is bigger than the input
          * size and create an empty output disk image (i.e. like dd(1)).
          */
@@ -4386,7 +4385,7 @@ static int img_dd(int argc, char **argv)
 
     in.buf = g_new(uint8_t, in.bsz);
 
-    for (out_pos = out.offset * obsz; in_pos < size; block_count++) {
+    for (out_pos = out.offset * obsz; in_pos < size;) {
         int in_ret, out_ret;
         bsz = in.bsz;
 
-- 
2.9.3

  parent reply	other threads:[~2016-08-22  7:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22  7:55 [Qemu-devel] [PATCH 0/7] qemu-img dd Reda Sallahi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 1/7] qemu-img: add seek option to dd Reda Sallahi
2016-08-22 13:06   ` Stefan Hajnoczi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 2/7] qemu-img: add iflag and oflag options " Reda Sallahi
2016-08-22 13:26   ` Stefan Hajnoczi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions " Reda Sallahi
2016-08-22 13:35   ` Stefan Hajnoczi
2016-08-22 14:02     ` Reda Sallahi
2016-08-23 16:03       ` Stefan Hajnoczi
2016-08-22  7:55 ` Reda Sallahi [this message]
2016-08-22 13:36   ` [Qemu-devel] [Qemu-block] [PATCH 4/7] qemu-img: delete not used variable and an unecessary check Stefan Hajnoczi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 5/7] qemu-img: add status option to dd Reda Sallahi
2016-08-22 13:45   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-08-22 13:50   ` [Qemu-devel] " Reda Sallahi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 6/7] qemu-img: clean up dd documentation Reda Sallahi
2016-08-22 13:46   ` Stefan Hajnoczi
2016-08-22  7:55 ` [Qemu-devel] [PATCH 7/7] qemu-img: add a test suite for the count option Reda Sallahi
2016-08-22 13:46   ` Stefan Hajnoczi

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=20160822075517.5859-5-fullmanet@gmail.com \
    --to=fullmanet@gmail.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).