qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 06/19] block: Make bdrv_default_refresh_format_filen


From: Max Reitz
Subject: [Qemu-devel] [PATCH 06/19] block: Make bdrv_default_refresh_format_filename public
Date: Tue, 26 Apr 2016 23:32:05 +0200

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]