qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/1] qemu-img: Deprecate obsolete -6 and -e opti


From: Kevin Wolf
Subject: [Qemu-devel] Re: [PATCH 1/1] qemu-img: Deprecate obsolete -6 and -e options
Date: Tue, 07 Dec 2010 17:02:01 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10

Am 07.12.2010 12:31, schrieb address@hidden:
> From: Jes Sorensen <address@hidden>
> 
> 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 <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]