From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com
Subject: [Qemu-devel] [RFC 2/7] block: bdrv_img_create(): add param_ret argument
Date: Thu, 11 Oct 2012 18:27:00 -0300 [thread overview]
Message-ID: <1349990825-2659-3-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1349990825-2659-1-git-send-email-lcapitulino@redhat.com>
If set returns a copy of the parameter list used by the block driver
to create the image.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
block.c | 7 ++++++-
block.h | 3 ++-
blockdev.c | 2 +-
qemu-img.c | 2 +-
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index e95f613..13cf04d 100644
--- a/block.c
+++ b/block.c
@@ -4294,7 +4294,8 @@ bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie)
int bdrv_img_create(const char *filename, const char *fmt,
const char *base_filename, const char *base_fmt,
- char *options, uint64_t img_size, int flags)
+ char *options, uint64_t img_size, int flags,
+ QEMUOptionParameter **param_ret)
{
QEMUOptionParameter *param = NULL, *create_options = NULL;
QEMUOptionParameter *backing_fmt, *backing_file, *size;
@@ -4430,6 +4431,10 @@ int bdrv_img_create(const char *filename, const char *fmt,
}
out:
+ if (param_ret) {
+ *param_ret = append_option_parameters(NULL, param);
+ }
+
free_option_parameters(create_options);
free_option_parameters(param);
diff --git a/block.h b/block.h
index e2d89d7..6403b12 100644
--- a/block.h
+++ b/block.h
@@ -341,7 +341,8 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
int bdrv_img_create(const char *filename, const char *fmt,
const char *base_filename, const char *base_fmt,
- char *options, uint64_t img_size, int flags);
+ char *options, uint64_t img_size, int flags,
+ QEMUOptionParameter **param_ret);
void bdrv_set_buffer_alignment(BlockDriverState *bs, int align);
void *qemu_blockalign(BlockDriverState *bs, size_t size);
diff --git a/blockdev.c b/blockdev.c
index 99828ad..9dddefd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -783,7 +783,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
ret = bdrv_img_create(new_image_file, format,
states->old_bs->filename,
states->old_bs->drv->format_name,
- NULL, -1, flags);
+ NULL, -1, flags, NULL);
if (ret) {
error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
goto delete_and_fail;
diff --git a/qemu-img.c b/qemu-img.c
index f17f187..b841012 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -362,7 +362,7 @@ static int img_create(int argc, char **argv)
}
ret = bdrv_img_create(filename, fmt, base_filename, base_fmt,
- options, img_size, BDRV_O_FLAGS);
+ options, img_size, BDRV_O_FLAGS, NULL);
out:
if (ret) {
return 1;
--
1.7.12.315.g682ce8b
next prev parent reply other threads:[~2012-10-11 21:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 21:26 [Qemu-devel] [RFC 0/7] block: bdrv_img_create(): propagate errors Luiz Capitulino
2012-10-11 21:26 ` [Qemu-devel] [RFC 1/7] error: add error_set_errno and error_setg_errno Luiz Capitulino
2012-10-11 21:27 ` Luiz Capitulino [this message]
2012-10-11 21:27 ` [Qemu-devel] [RFC 3/7] block: bdrv_img_create(): move param printing to qemu-img Luiz Capitulino
2012-10-12 8:29 ` Paolo Bonzini
2012-10-15 21:39 ` Luiz Capitulino
2012-10-11 21:27 ` [Qemu-devel] [RFC 4/7] block: bdrv_img_create(): add Error ** argument Luiz Capitulino
2012-10-11 21:27 ` [Qemu-devel] [RFC 5/7] qemu-img: img_create(): use Error object Luiz Capitulino
2012-10-11 21:27 ` [Qemu-devel] [RFC 6/7] qmp: qmp_transaction(): pass Error object to bdrv_img_create() Luiz Capitulino
2012-10-11 21:27 ` [Qemu-devel] [RFC 7/7] block: bdrv_img_create(): drop unused code Luiz Capitulino
2012-10-12 8:31 ` [Qemu-devel] [RFC 0/7] block: bdrv_img_create(): propagate errors Paolo Bonzini
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=1349990825-2659-3-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--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).