qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>
Subject: [Qemu-devel] [PATCH v3 3/5] block/null: Implement bdrv_refresh_filename()
Date: Fri, 10 Jun 2016 20:57:48 +0200	[thread overview]
Message-ID: <20160610185750.30956-4-mreitz@redhat.com> (raw)
In-Reply-To: <20160610185750.30956-1-mreitz@redhat.com>

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 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");
+
+    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

  parent reply	other threads:[~2016-06-10 18:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 18:57 [Qemu-devel] [PATCH v3 0/5] block/mirror: Fix (?) target backing BDS Max Reitz
2016-06-10 18:57 ` [Qemu-devel] [PATCH v3 1/5] block: Allow replacement of a BDS by its overlay Max Reitz
2016-06-12  3:15   ` Fam Zheng
2016-06-13 15:13     ` Kevin Wolf
2016-06-10 18:57 ` [Qemu-devel] [PATCH v3 2/5] block/mirror: Fix target backing BDS Max Reitz
2016-06-10 18:57 ` Max Reitz [this message]
2016-06-12  4:08   ` [Qemu-devel] [PATCH v3 3/5] block/null: Implement bdrv_refresh_filename() Fam Zheng
2016-06-14 12:59     ` Max Reitz
2016-06-10 18:57 ` [Qemu-devel] [PATCH v3 4/5] iotests: Add test for post-mirror backing chains Max Reitz
2016-06-12  4:17   ` Fam Zheng
2016-06-14 13:01     ` Max Reitz
2016-06-10 18:57 ` [Qemu-devel] [PATCH v3 5/5] iotests: Add test for oVirt-like storage migration Max Reitz
2016-06-12  4:23 ` [Qemu-devel] [PATCH v3 0/5] block/mirror: Fix (?) target backing BDS Fam Zheng
2016-06-13 15:16 ` Kevin Wolf
2016-06-14 15:53 ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160610185750.30956-4-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).