From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBwht-0005yF-Dv for qemu-devel@nongnu.org; Sun, 12 Jun 2016 00:09:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBwhr-0001mH-8T for qemu-devel@nongnu.org; Sun, 12 Jun 2016 00:09:04 -0400 Date: Sun, 12 Jun 2016 12:08:50 +0800 From: Fam Zheng Message-ID: <20160612040850.GG27167@ad.usersys.redhat.com> References: <20160610185750.30956-1-mreitz@redhat.com> <20160610185750.30956-4-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160610185750.30956-4-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 3/5] block/null: Implement bdrv_refresh_filename() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Kevin Wolf On Fri, 06/10 20:57, Max Reitz wrote: > Signed-off-by: Max Reitz The commit message could go a little more informative. Seems nothing special in the added callback, aren't things supposed to just work without this patch? What is missing? > --- > block/null.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/block/null.c b/block/null.c > index 396500b..b511010 100644 > --- a/block/null.c > +++ b/block/null.c > @@ -12,6 +12,8 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qmp/qdict.h" > +#include "qapi/qmp/qstring.h" > #include "block/block_int.h" > > #define NULL_OPT_LATENCY "latency-ns" > @@ -223,6 +225,20 @@ static int64_t coroutine_fn null_co_get_block_status(BlockDriverState *bs, > } > } > > +static void null_refresh_filename(BlockDriverState *bs, QDict *opts) > +{ > + QINCREF(opts); > + qdict_del(opts, "filename"); Why is this qdict_del necessary? > + > + if (!qdict_size(opts)) { > + snprintf(bs->exact_filename, sizeof(bs->exact_filename), "%s://", > + bs->drv->format_name); > + } > + > + qdict_put(opts, "driver", qstring_from_str(bs->drv->format_name)); > + bs->full_open_options = opts; > +} > + > static BlockDriver bdrv_null_co = { > .format_name = "null-co", > .protocol_name = "null-co", > @@ -238,6 +254,8 @@ static BlockDriver bdrv_null_co = { > .bdrv_reopen_prepare = null_reopen_prepare, > > .bdrv_co_get_block_status = null_co_get_block_status, > + > + .bdrv_refresh_filename = null_refresh_filename, > }; > > static BlockDriver bdrv_null_aio = { > @@ -255,6 +273,8 @@ static BlockDriver bdrv_null_aio = { > .bdrv_reopen_prepare = null_reopen_prepare, > > .bdrv_co_get_block_status = null_co_get_block_status, > + > + .bdrv_refresh_filename = null_refresh_filename, > }; > > static void bdrv_null_init(void) > -- > 2.8.3 >