Received: from eggs.gnu.org ([2001:4830:134:3::10]:39964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avAb0-0006kX-AY for qemu-devel@nongnu.org; Tue, 26 Apr 2016 17:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avAaz-0003vb-By for qemu-devel@nongnu.org; Tue, 26 Apr 2016 17:32:38 -0400 From: Max Reitz Date: Tue, 26 Apr 2016 23:32:05 +0200 Message-Id: <1461706338-20219-7-git-send-email-mreitz@redhat.com> In-Reply-To: <1461706338-20219-1-git-send-email-mreitz@redhat.com> References: <1461706338-20219-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 06/19] block: Make bdrv_default_refresh_format_filename public List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Max Reitz , Alberto Garcia , Eric Blake , Kevin Wolf In order to allow block drivers to use that function, it needs to be public. In order to be useful, it needs to take a parameter which allows the caller to specify whether the runtime options allowed by the block driver are actually significant for the guest-visible BDS content. Signed-off-by: Max Reitz --- block.c | 9 ++++++--- include/block/block_int.h | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 511a0b1..b3ff08f 100644 --- a/block.c +++ b/block.c @@ -3872,7 +3872,10 @@ static bool append_open_options(QDict *d, BlockDriverState *bs) return found_any; } -static void bdrv_default_refresh_format_filename(BlockDriverState *bs) +/* @options_significant must be true if any of the driver-specific runtime + * options may change the guest-visible content of the BDS */ +void bdrv_default_refresh_format_filename(BlockDriverState *bs, + bool options_significant) { BlockDriver *drv = bs->drv; QDict *opts; @@ -3885,7 +3888,7 @@ static void bdrv_default_refresh_format_filename(BlockDriverState *bs) } opts = qdict_new(); - has_open_options = append_open_options(opts, bs); + has_open_options = append_open_options(opts, bs) && options_significant; has_open_options |= bs->backing_overridden; /* If no specific options have been given for this BDS, the filename of @@ -3997,7 +4000,7 @@ void bdrv_refresh_filename(BlockDriverState *bs) QDECREF(opts); } else if (bs->file) { /* Try to reconstruct valid information from the underlying file */ - bdrv_default_refresh_format_filename(bs); + bdrv_default_refresh_format_filename(bs, true); } else if (!bs->full_open_options && qdict_size(bs->options)) { bdrv_default_refresh_protocol_filename(bs); } diff --git a/include/block/block_int.h b/include/block/block_int.h index d73e9ce..eb3665a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -532,6 +532,9 @@ BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size, void bdrv_set_io_limits(BlockDriverState *bs, ThrottleConfig *cfg); +void bdrv_default_refresh_format_filename(BlockDriverState *bs, + bool options_significant); + /** * bdrv_add_before_write_notifier: -- 2.8.0