From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtlQ-0000bn-6y for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:31:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCtlI-0001x3-NE for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:31:20 -0500 Received: from paradis.irqsave.net ([62.212.105.220]:49589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtlI-0001wz-59 for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:31:12 -0500 Date: Mon, 10 Feb 2014 17:31:12 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140210163112.GC6347@irqsave.net> References: <1391881159-13585-1-git-send-email-mreitz@redhat.com> <1391881159-13585-9-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1391881159-13585-9-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 8/8] block: Remove bdrv_open_image()'s force_raw option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Stefan Hajnoczi Le Saturday 08 Feb 2014 =E0 18:39:19 (+0100), Max Reitz a =E9crit : > This option is now unnecessary since specifying BDRV_O_PROTOCOL as flag > will do exactly the same. >=20 > Signed-off-by: Max Reitz > --- > block.c | 28 ++++------------------------ > block/blkdebug.c | 2 +- > block/blkverify.c | 4 ++-- > include/block/block.h | 2 +- > 4 files changed, 8 insertions(+), 28 deletions(-) >=20 > diff --git a/block.c b/block.c > index 22e5a44..a1630e9 100644 > --- a/block.c > +++ b/block.c > @@ -1107,10 +1107,6 @@ int bdrv_open_backing_file(BlockDriverState *bs,= QDict *options, Error **errp) > * Opens a disk image whose options are given as BlockdevRef in anothe= r block > * device's options. > * > - * If force_raw is true, bdrv_file_open() will be used, thereby preven= ting any > - * image format auto-detection. If it is false and a filename is given= , > - * bdrv_open() will be used for auto-detection. > - * > * If allow_none is true, no image will be opened if filename is false= and no > * BlockdevRef is given. *pbs will remain unchanged and 0 will be retu= rned. > * > @@ -1127,7 +1123,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, = QDict *options, Error **errp) > */ > int bdrv_open_image(BlockDriverState **pbs, const char *filename, > QDict *options, const char *bdref_key, int flags, > - bool force_raw, bool allow_none, Error **errp) > + bool allow_none, Error **errp) > { > QDict *image_options; > int ret; > @@ -1150,23 +1146,7 @@ int bdrv_open_image(BlockDriverState **pbs, cons= t char *filename, > goto done; > } > =20 > - if (filename && !force_raw) { > - /* If a filename is given and the block driver should be detec= ted > - automatically (instead of using none), use bdrv_open() in o= rder to do > - that auto-detection. */ > - if (reference) { > - error_setg(errp, "Cannot reference an existing block devic= e while " > - "giving a filename"); > - ret =3D -EINVAL; > - goto done; > - } > - > - ret =3D bdrv_open(pbs, filename, NULL, image_options, flags, N= ULL, errp); > - } else { > - *pbs =3D NULL; > - ret =3D bdrv_open(pbs, filename, reference, image_options, > - flags | BDRV_O_PROTOCOL, NULL, errp); > - } > + ret =3D bdrv_open(pbs, filename, reference, image_options, flags, = NULL, errp); > =20 > done: > qdict_del(options, bdref_key); > @@ -1324,8 +1304,8 @@ int bdrv_open(BlockDriverState **pbs, const char = *filename, > =20 > assert(file =3D=3D NULL); > ret =3D bdrv_open_image(&file, filename, options, "file", > - bdrv_open_flags(bs, flags | BDRV_O_UNMAP), t= rue, true, > - &local_err); > + bdrv_open_flags(bs, flags | BDRV_O_UNMAP) | > + BDRV_O_PROTOCOL, true, &local_err); > if (ret < 0) { > goto fail; > } > diff --git a/block/blkdebug.c b/block/blkdebug.c > index 053fa4c..6707f49 100644 > --- a/block/blkdebug.c > +++ b/block/blkdebug.c > @@ -412,7 +412,7 @@ static int blkdebug_open(BlockDriverState *bs, QDic= t *options, int flags, > /* Open the backing file */ > assert(bs->file =3D=3D NULL); > ret =3D bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-image"), = options, "image", > - flags, true, false, &local_err); > + flags | BDRV_O_PROTOCOL, false, &local_err); > if (ret < 0) { > error_propagate(errp, local_err); > goto out; > diff --git a/block/blkverify.c b/block/blkverify.c > index 86585e7..b57da59 100644 > --- a/block/blkverify.c > +++ b/block/blkverify.c > @@ -137,7 +137,7 @@ static int blkverify_open(BlockDriverState *bs, QDi= ct *options, int flags, > /* Open the raw file */ > assert(bs->file =3D=3D NULL); > ret =3D bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-raw"), op= tions, > - "raw", flags, true, false, &local_err); > + "raw", flags | BDRV_O_PROTOCOL, false, &loca= l_err); > if (ret < 0) { > error_propagate(errp, local_err); > goto fail; > @@ -146,7 +146,7 @@ static int blkverify_open(BlockDriverState *bs, QDi= ct *options, int flags, > /* Open the test file */ > assert(s->test_file =3D=3D NULL); > ret =3D bdrv_open_image(&s->test_file, qemu_opt_get(opts, "x-image= "), options, > - "test", flags, false, false, &local_err); > + "test", flags, false, &local_err); > if (ret < 0) { > error_propagate(errp, local_err); > s->test_file =3D NULL; > diff --git a/include/block/block.h b/include/block/block.h > index bf78db5..780f48b 100644 > --- a/include/block/block.h > +++ b/include/block/block.h > @@ -188,7 +188,7 @@ int bdrv_parse_cache_flags(const char *mode, int *f= lags); > int bdrv_parse_discard_flags(const char *mode, int *flags); > int bdrv_open_image(BlockDriverState **pbs, const char *filename, > QDict *options, const char *bdref_key, int flags, > - bool force_raw, bool allow_none, Error **errp); > + bool allow_none, Error **errp); > int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error= **errp); > int bdrv_open(BlockDriverState **pbs, const char *filename, > const char *reference, QDict *options, int flags, > --=20 > 1.8.5.4 >=20 Reviewed-by: Benoit Canet