From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50329 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPzyO-0002Tm-PY for qemu-devel@nongnu.org; Tue, 07 Dec 2010 11:01:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPzyN-0002aa-JI for qemu-devel@nongnu.org; Tue, 07 Dec 2010 11:01:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPzyN-0002a6-C7 for qemu-devel@nongnu.org; Tue, 07 Dec 2010 11:00:59 -0500 Message-ID: <4CFE5A79.8000909@redhat.com> Date: Tue, 07 Dec 2010 17:02:01 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1291721514-7354-1-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1291721514-7354-1-git-send-email-Jes.Sorensen@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/1] qemu-img: Deprecate obsolete -6 and -e options List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes.Sorensen@redhat.com Cc: stefanha@linux.vnet.ibm.com, qemu-devel@nongnu.org Am 07.12.2010 12:31, schrieb Jes.Sorensen@redhat.com: > From: Jes Sorensen > > 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 > --- > 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