From: Stefan Hajnoczi <stefanha@redhat.com>
To: Reda Sallahi <fullmanet@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Fam Zheng <famz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/7] qemu-img: add more conv= conversions to dd
Date: Tue, 13 Sep 2016 17:06:30 +0100 [thread overview]
Message-ID: <20160913160630.GE5677@stefanha-x1.localdomain> (raw)
In-Reply-To: <20160826091643.15841-4-fullmanet@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]
On Fri, Aug 26, 2016 at 11:16:39AM +0200, Reda Sallahi wrote:
> @@ -3968,7 +3963,11 @@ static int img_dd_flag(const char *arg, struct DdIo *io,
> int j;
> for (j = 0; flags[j].name != NULL; j++) {
> if (!strcmp(tok, flags[j].name)) {
> - io->flags |= flags[j].value;
> + if (dd) {
> + dd->conv |= flags[j].value;
> + } else {
> + io->flags |= flags[j].value;
> + }
> break;
> }
> }
Does this function need to know about DdIo and DdInfo? How about:
static int img_dd_flag(const char *arg, unsigned int *flag_bits,
const struct DdSymbols *flags, const char *err_str)
Then function can be called with &dd->flags or &io->flags.
If you do this then please squash the change into earlier patches in
this series using git-rebase(1). That way the function is created with
its final prototype in the earliest patch that needs it and there is no
code churn.
> @@ -4219,6 +4260,7 @@ static int img_dd(int argc, char **argv)
> ret = -1;
> goto out;
> }
> + local_err = NULL;
Why set local_err to NULL here and not where it's declared? If it could
possibly be non-NULL then error_free() must be used to avoid a memory
leak.
> + if (dd.conv & C_SPARSE) {
> + if (buffer_is_zero(in.buf, bsz)) {
> + sparse_count++;
> + continue;
> + }
> + if (sparse_count > 0) {
> + out_pos += sparse_count * in.bsz;
> + sparse_count = 0;
> + }
> + }
Is sparse_count needed at all?
if ((dd.conv & C_SPARSE) && buffer_is_zero(in.buf, bsz)) {
out_pos += in.bsz;
continue;
}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2016-09-13 16:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 9:16 [Qemu-devel] [PATCH v2 0/7] qemu-img dd Reda Sallahi
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 1/7] qemu-img: add seek option to dd Reda Sallahi
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 2/7] qemu-img: add iflag and oflag options " Reda Sallahi
2016-09-13 15:48 ` Stefan Hajnoczi
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 3/7] qemu-img: add more conv= conversions " Reda Sallahi
2016-09-13 16:06 ` Stefan Hajnoczi [this message]
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 4/7] qemu-img: delete not used variable and an unecessary check Reda Sallahi
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 5/7] qemu-img: add status option to dd Reda Sallahi
2016-09-13 16:19 ` Stefan Hajnoczi
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 6/7] qemu-img: clean up dd documentation Reda Sallahi
2016-09-13 16:31 ` Eric Blake
2016-08-26 9:16 ` [Qemu-devel] [PATCH v2 7/7] qemu-img: add a test suite for the count option Reda Sallahi
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=20160913160630.GE5677@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=fullmanet@gmail.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).