From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: kashyap.cv@gmail.com, qemu-devel@nongnu.org,
"Benoît Canet" <benoit@irqsave.net>
Subject: Re: [Qemu-devel] [PATCH v2 1/3] qemu-img: Add --backing-chain option to info command
Date: Tue, 16 Oct 2012 12:04:24 +0200 [thread overview]
Message-ID: <507D3128.9080806@redhat.com> (raw)
In-Reply-To: <1350305057-6287-2-git-send-email-stefanha@redhat.com>
Am 15.10.2012 14:44, schrieb Stefan Hajnoczi:
> The qemu-img info --backing-chain option enumerates the backing file
> chain. For example, for base.qcow2 <- snap1.qcow2 <- snap2.qcow2 the
> output becomes:
>
> $ qemu-img info --backing-chain snap2.qcow2
> image: snap2.qcow2
> file format: qcow2
> virtual size: 100M (104857600 bytes)
> disk size: 196K
> cluster_size: 65536
> backing file: snap1.qcow2
> backing file format: qcow2
>
> image: snap1.qcow2
> file format: qcow2
> virtual size: 100M (104857600 bytes)
> disk size: 196K
> cluster_size: 65536
> backing file: base.qcow2
> backing file format: qcow2
>
> image: base.qcow2
> file format: qcow2
> virtual size: 100M (104857600 bytes)
> disk size: 136K
> cluster_size: 65536
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> qemu-img.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 76 insertions(+), 22 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index f17f187..c717f3e 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1249,7 +1249,10 @@ static void dump_human_image_info(ImageInfo *info)
> }
> }
>
> -enum {OPTION_OUTPUT = 256};
> +enum {
> + OPTION_OUTPUT = 256,
> + OPTION_BACKING_CHAIN = 257,
> +};
>
> typedef enum OutputFormat {
> OFORMAT_JSON,
> @@ -1260,7 +1263,9 @@ static int img_info(int argc, char **argv)
> {
> int c;
> OutputFormat output_format = OFORMAT_HUMAN;
> - const char *filename, *fmt, *output;
> + bool chain = false;
> + const char *output;
> + char *filename, *fmt;
Maybe I'm missing something, but where are the strings pointed at by
filename and fmt ever modified? If they aren't, strdup() isn't necessary
either.
Kevin
next prev parent reply other threads:[~2012-10-16 10:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 12:44 [Qemu-devel] [PATCH v2 0/3] qemu-img: Add --backing-chain option to info command Stefan Hajnoczi
2012-10-15 12:44 ` [Qemu-devel] [PATCH v2 1/3] " Stefan Hajnoczi
2012-10-16 10:04 ` Kevin Wolf [this message]
2012-10-16 14:51 ` Stefan Hajnoczi
2012-10-15 12:44 ` [Qemu-devel] [PATCH v2 2/3] qemu-img: Detect backing file chain infinite loops Stefan Hajnoczi
2012-10-16 10:11 ` Kevin Wolf
2012-10-16 14:42 ` Stefan Hajnoczi
2012-10-16 14:58 ` Kevin Wolf
2012-10-15 12:44 ` [Qemu-devel] [PATCH v2 3/3] qemu-iotests: Add 041 backing file chain infinite loop test Stefan Hajnoczi
2012-10-15 17:47 ` Eric Blake
2012-10-16 8:21 ` Stefan Hajnoczi
2012-10-16 10:22 ` Kevin Wolf
2012-10-16 14:53 ` Stefan Hajnoczi
2012-10-15 17:49 ` [Qemu-devel] [PATCH v2 0/3] qemu-img: Add --backing-chain option to info command Eric Blake
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=507D3128.9080806@redhat.com \
--to=kwolf@redhat.com \
--cc=benoit@irqsave.net \
--cc=kashyap.cv@gmail.com \
--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).