From: Kevin Wolf <kwolf@redhat.com>
To: Chunyan Liu <cyliu@suse.com>
Cc: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [v19 24/25] cleanup QEMUOptionParameter
Date: Wed, 22 Jan 2014 15:33:21 +0100 [thread overview]
Message-ID: <20140122143321.GN10065@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1390227608-7225-25-git-send-email-cyliu@suse.com>
Am 20.01.2014 um 15:20 hat Chunyan Liu geschrieben:
> Now all places using QEMUOptionParameter could use QemuOpts too, remove
> QEMUOptionParameter related code.
>
> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
> block.c | 147 ++---------------------
> block/cow.c | 2 +-
> block/qcow.c | 2 +-
> block/qcow2.c | 2 +-
> block/qed.c | 2 +-
> block/raw_bsd.c | 2 +-
> block/vhdx.c | 2 +-
> block/vmdk.c | 4 +-
> block/vvfat.c | 2 +-
> include/block/block.h | 4 +-
> include/block/block_int.h | 3 -
> include/qemu/option.h | 35 ------
> qemu-img.c | 93 ++-------------
> util/qemu-option.c | 294 ---------------------------------------------
> 14 files changed, 30 insertions(+), 564 deletions(-)
>
> diff --git a/block.c b/block.c
> index 8c490c6..b33d095 100644
> --- a/block.c
> +++ b/block.c
> @@ -394,7 +394,6 @@ BlockDriver *bdrv_find_whitelisted_format(const char *format_name,
> typedef struct CreateCo {
> BlockDriver *drv;
> char *filename;
> - QEMUOptionParameter *options;
> QemuOpts *opts;
> int ret;
> Error *err;
> @@ -403,15 +402,13 @@ typedef struct CreateCo {
> static void coroutine_fn bdrv_create_co_entry(void *opaque)
> {
> Error *local_err = NULL;
> - int ret;
> + int ret = -1;
>
> CreateCo *cco = opaque;
> assert(cco->drv);
>
> if (cco->drv->bdrv_create2)
> ret = cco->drv->bdrv_create2(cco->filename, cco->opts, &local_err);
> - else
> - ret = cco->drv->bdrv_create(cco->filename, cco->options, &local_err);
The if condition isn't needed any more, it is always true.
> if (error_is_set(&local_err)) {
> error_propagate(&cco->err, local_err);
> }
> @@ -324,22 +315,19 @@ fail:
> return NULL;
> }
>
> -static int add_old_style_options(const char *fmt, QEMUOptionParameter *list,
> +static int add_old_style_options(const char *fmt,
> QemuOpts *opts,
> const char *base_filename,
> const char *base_fmt)
> {
> if (base_filename) {
> - if ((opts && qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename)) ||
> - (list && set_option_parameter(list, BLOCK_OPT_BACKING_FILE, base_filename))) {
> - error_report("Backing file not supported for file format '%s'",
> + if (opts && qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename)) { error_report("Backing file not supported for file format '%s'",
I think you lost a line break here. :-)
> fmt);
> return -1;
> }
> }
> if (base_fmt) {
> - if ((opts && qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt)) ||
> - (list && set_option_parameter(list, BLOCK_OPT_BACKING_FMT, base_fmt))) {
> + if (opts && qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt)) {
> error_report("Backing file format not supported for file "
> "format '%s'", fmt);
> return -1;
> @@ -1152,7 +1140,6 @@ static int img_convert(int argc, char **argv)
> size_t bufsectors = IO_BUF_SIZE / BDRV_SECTOR_SIZE;
> const uint8_t *buf1;
> BlockDriverInfo bdi;
> - QEMUOptionParameter *param = NULL, *create_options = NULL;
> QemuOpts *opts = NULL;
> QemuOptsList *create_opts = NULL;
> char *options = NULL;
> @@ -1337,7 +1324,7 @@ static int img_convert(int argc, char **argv)
> }
>
> qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_sectors * 512);
> - ret = add_old_style_options(out_fmt, NULL, opts, out_baseimg, NULL);
> + ret = add_old_style_options(out_fmt, opts, out_baseimg, NULL);
> if (ret < 0) {
> goto out;
> }
> @@ -1379,70 +1366,12 @@ static int img_convert(int argc, char **argv)
> }
>
> } else {
> - QEMUOptionParameter *out_baseimg_param;
> -
> - create_options = append_option_parameters(create_options,
> - drv->create_options);
> - create_options = append_option_parameters(create_options,
> - proto_drv->create_options);
> -
> - if (options) {
> - param = parse_option_parameters(options, create_options, param);
> - if (param == NULL) {
> - error_report("Invalid options for file format '%s'.", out_fmt);
> - ret = -1;
> - goto out;
> - }
> - } else {
> - param = parse_option_parameters("", create_options, param);
> - }
> -
> - set_option_parameter_int(param, BLOCK_OPT_SIZE, total_sectors * 512);
> - ret = add_old_style_options(out_fmt, param, NULL, out_baseimg, NULL);
> - if (ret < 0) {
> - goto out;
> - }
> -
> - /* Get backing file name if -o backing_file was used */
> - out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
> - if (out_baseimg_param) {
> - out_baseimg = out_baseimg_param->value.s;
> - }
> -
> - /* Check if compression is supported */
> - if (compress) {
> - QEMUOptionParameter *encryption =
> - get_option_parameter(param, BLOCK_OPT_ENCRYPT);
> - QEMUOptionParameter *preallocation =
> - get_option_parameter(param, BLOCK_OPT_PREALLOC);
> -
> - if (!drv->bdrv_write_compressed) {
> - error_report("Compression not supported for this file format");
> - ret = -1;
> - goto out;
> - }
> -
> - if (encryption && encryption->value.n) {
> - error_report("Compression and encryption not supported at "
> - "the same time");
> - ret = -1;
> - goto out;
> - }
> -
> - if (preallocation && preallocation->value.s
> - && strcmp(preallocation->value.s, "off"))
> - {
> - error_report("Compression and preallocation not supported at "
> - "the same time");
> - ret = -1;
> - goto out;
> - }
> - }
> + error_report("Not supported");
> }
Do you really need the if condition any more? I think bdrv_create()
still returns an error like it used to, and we didn't have the check
before this series.
Kevin
next prev parent reply other threads:[~2014-01-22 14:33 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-20 14:19 [Qemu-devel] [v19 00/25] replace QEMUOptionParameter with QemuOpts Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 01/25] add def_value_str to QemuOptDesc Chunyan Liu
2014-01-22 13:25 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 02/25] qapi: output def_value_str when query command line options Chunyan Liu
2014-01-20 15:53 ` Eric Blake
2014-01-20 14:19 ` [Qemu-devel] [v19 03/25] improve some functions in qemu-option.c Chunyan Liu
2014-01-22 13:33 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 04/25] add some QemuOpts functions for replace work Chunyan Liu
2014-01-22 13:57 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 05/25] change block layer to support both QemuOpts and QEMUOptionParameter Chunyan Liu
2014-01-22 14:19 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 06/25] cow.c: replace QEMUOptionParameter with QemuOpts Chunyan Liu
2014-01-22 14:20 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 07/25] gluster.c: " Chunyan Liu
2014-01-22 13:10 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 08/25] iscsi.c: replace QEMUOptionParamter " Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 09/25] qcow.c: " Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 10/25] qcow2.c: replace QEMUOptionParameter with QemuOpts in create Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 11/25] qcow2.c: replace QEMUOptionParameter with QemuOpts in amend options Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 12/25] qed.c: replace QEMUOptionParameter with QemuOpts Chunyan Liu
2014-01-22 14:24 ` Kevin Wolf
2014-01-20 14:19 ` [Qemu-devel] [v19 13/25] raw-posix.c: " Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 14/25] raw-win32.c: " Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 15/25] rbd.c: " Chunyan Liu
2014-01-20 14:19 ` [Qemu-devel] [v19 16/25] sheepdog.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 17/25] ssh.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 18/25] vdi.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 19/25] vmdk.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 20/25] vpc.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 21/25] raw_bsd.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 22/25] vhdx.c: " Chunyan Liu
2014-01-22 14:26 ` Kevin Wolf
2014-01-20 14:20 ` [Qemu-devel] [v19 23/25] vvfat.c: " Chunyan Liu
2014-01-20 14:20 ` [Qemu-devel] [v19 24/25] cleanup QEMUOptionParameter Chunyan Liu
2014-01-22 14:33 ` Kevin Wolf [this message]
2014-01-20 14:20 ` [Qemu-devel] [v19 25/25] change back to original name from bdrv_create2 to bdrv_create Chunyan Liu
2014-01-22 14:35 ` [Qemu-devel] [v19 00/25] replace QEMUOptionParameter with QemuOpts Kevin Wolf
2014-01-22 16:11 ` 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=20140122143321.GN10065@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=cyliu@suse.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=wdongxu@linux.vnet.ibm.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).