Am 07.12.2010 12:31, schrieb jes.soren...@redhat.com: > From: Jes Sorensen <jes.soren...@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.soren...@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