qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Jes.Sorensen@redhat.com
Cc: stefanha@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/1] qemu-img: Deprecate obsolete -6 and -e options
Date: Tue, 07 Dec 2010 17:02:01 +0100	[thread overview]
Message-ID: <4CFE5A79.8000909@redhat.com> (raw)
In-Reply-To: <1291721514-7354-1-git-send-email-Jes.Sorensen@redhat.com>

Am 07.12.2010 12:31, schrieb Jes.Sorensen@redhat.com:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> If -6 or -e is specified, an error message is printed and we exit. It
> does not print help() to avoid the error message getting lost in the
> noise.
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  block_int.h |    1 -
>  qemu-img.c  |   53 ++++++++++++++++++++++-------------------------------
>  2 files changed, 22 insertions(+), 32 deletions(-)
> 
> diff --git a/block_int.h b/block_int.h
> index 3c3adb5..3ceed47 100644
> --- a/block_int.h
> +++ b/block_int.h
> @@ -29,7 +29,6 @@
>  #include "qemu-queue.h"
>  
>  #define BLOCK_FLAG_ENCRYPT	1
> -#define BLOCK_FLAG_COMPRESS	2
>  #define BLOCK_FLAG_COMPAT6	4
>  
>  #define BLOCK_OPT_SIZE          "size"
> diff --git a/qemu-img.c b/qemu-img.c
> index 5b6e648..16fec40 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -261,21 +261,9 @@ fail:
>  }
>  
>  static int add_old_style_options(const char *fmt, QEMUOptionParameter *list,
> -    int flags, const char *base_filename, const char *base_fmt)
> +                                 const char *base_filename,
> +                                 const char *base_fmt)
>  {
> -    if (flags & BLOCK_FLAG_ENCRYPT) {
> -        if (set_option_parameter(list, BLOCK_OPT_ENCRYPT, "on")) {
> -            error("Encryption not supported for file format '%s'", fmt);
> -            return -1;
> -        }
> -    }
> -    if (flags & BLOCK_FLAG_COMPAT6) {
> -        if (set_option_parameter(list, BLOCK_OPT_COMPAT6, "on")) {
> -            error("VMDK version 6 not supported for file format '%s'", fmt);
> -            return -1;
> -        }
> -    }
> -
>      if (base_filename) {
>          if (set_option_parameter(list, BLOCK_OPT_BACKING_FILE, base_filename)) {
>              error("Backing file not supported for file format '%s'", fmt);
> @@ -293,7 +281,7 @@ static int add_old_style_options(const char *fmt, QEMUOptionParameter *list,
>  
>  static int img_create(int argc, char **argv)
>  {
> -    int c, ret = 0, flags;
> +    int c, ret = 0;
>      const char *fmt = "raw";
>      const char *base_fmt = NULL;
>      const char *filename;
> @@ -302,7 +290,6 @@ static int img_create(int argc, char **argv)
>      QEMUOptionParameter *param = NULL, *create_options = NULL;
>      char *options = NULL;
>  
> -    flags = 0;
>      for(;;) {
>          c = getopt(argc, argv, "F:b:f:he6o:");
>          if (c == -1) {
> @@ -323,11 +310,13 @@ static int img_create(int argc, char **argv)
>              fmt = optarg;
>              break;
>          case 'e':
> -            flags |= BLOCK_FLAG_ENCRYPT;
> -            break;
> +            printf("qemu-img: option -e is deprecated, please use \'-o "
> +                   "encryption\' instead!\n");
> +            return -1;

The return value of this function is used as exit code of qemu-img, so 1
is probably better than -1.

Also, is there a reason why you use printf and not error (which writes
the message to stderr)?

Kevin

  reply	other threads:[~2010-12-07 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 11:31 [Qemu-devel] [PATCH 1/1] qemu-img: Deprecate obsolete -6 and -e options Jes.Sorensen
2010-12-07 16:02 ` Kevin Wolf [this message]
2010-12-07 16:17   ` [Qemu-devel] " Jes Sorensen

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=4CFE5A79.8000909@redhat.com \
    --to=kwolf@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).