From patchwork Tue Apr 26 21:32:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 8945831 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 40B169F441 for ; Tue, 26 Apr 2016 21:35:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A088420166 for ; Tue, 26 Apr 2016 21:35:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E71D420115 for ; Tue, 26 Apr 2016 21:35:04 +0000 (UTC) Received: from localhost ([::1]:39706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avAdM-0002u9-7L for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Apr 2016 17:35:04 -0400 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 Received: from mx1.redhat.com ([209.132.183.28]:56900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avAax-0003uM-Fj; Tue, 26 Apr 2016 17:32:35 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2676062664; Tue, 26 Apr 2016 21:32:35 +0000 (UTC) Received: from localhost (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3QLWXhq013600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 26 Apr 2016 17:32:34 -0400 From: Max Reitz To: qemu-block@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 26 Apr 2016 21:32:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 06/19] block: Make bdrv_default_refresh_format_filename public X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: