qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 3/6] blkverify: Implement bdrv_refresh_filename()
Date: Fri, 18 Jul 2014 20:24:58 +0200	[thread overview]
Message-ID: <1405707901-8253-4-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1405707901-8253-1-git-send-email-mreitz@redhat.com>

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/blkverify.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/block/blkverify.c b/block/blkverify.c
index 621b785..7c78ca4 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -10,6 +10,8 @@
 #include <stdarg.h>
 #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
 #include "block/block_int.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qstring.h"
 
 typedef struct {
     BlockDriverState *test_file;
@@ -320,6 +322,32 @@ static void blkverify_attach_aio_context(BlockDriverState *bs,
     bdrv_attach_aio_context(s->test_file, new_context);
 }
 
+static void blkverify_refresh_filename(BlockDriverState *bs)
+{
+    BDRVBlkverifyState *s = bs->opaque;
+
+    /* bs->file has already been refreshed */
+    bdrv_refresh_filename(s->test_file);
+
+    if (bs->file->full_open_options && s->test_file->full_open_options) {
+        QDict *opts = qdict_new();
+        qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkverify")));
+
+        QINCREF(bs->file->full_open_options);
+        qdict_put_obj(opts, "raw", QOBJECT(bs->file->full_open_options));
+        QINCREF(s->test_file->full_open_options);
+        qdict_put_obj(opts, "test", QOBJECT(s->test_file->full_open_options));
+
+        bs->full_open_options = opts;
+    }
+
+    if (bs->file->exact_filename[0] && s->test_file->exact_filename[0]) {
+        snprintf(bs->exact_filename, sizeof(bs->exact_filename),
+                 "blkverify:%s:%s",
+                 bs->file->exact_filename, s->test_file->exact_filename);
+    }
+}
+
 static BlockDriver bdrv_blkverify = {
     .format_name                      = "blkverify",
     .protocol_name                    = "blkverify",
@@ -329,6 +357,7 @@ static BlockDriver bdrv_blkverify = {
     .bdrv_file_open                   = blkverify_open,
     .bdrv_close                       = blkverify_close,
     .bdrv_getlength                   = blkverify_getlength,
+    .bdrv_refresh_filename            = blkverify_refresh_filename,
 
     .bdrv_aio_readv                   = blkverify_aio_readv,
     .bdrv_aio_writev                  = blkverify_aio_writev,
-- 
2.0.1

  parent reply	other threads:[~2014-07-18 18:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 18:24 [Qemu-devel] [PATCH 0/6] block: Let drivers reconstruct the filename Max Reitz
2014-07-18 18:24 ` [Qemu-devel] [PATCH 1/6] block: Add bdrv_refresh_filename() Max Reitz
2014-08-20 15:07   ` Kevin Wolf
2014-08-20 19:06     ` Max Reitz
2014-08-21  8:26       ` Kevin Wolf
2014-07-18 18:24 ` [Qemu-devel] [PATCH 2/6] blkdebug: Implement bdrv_refresh_filename() Max Reitz
2014-08-20 15:14   ` Kevin Wolf
2014-08-20 19:08     ` Max Reitz
2014-07-18 18:24 ` Max Reitz [this message]
2014-07-18 18:24 ` [Qemu-devel] [PATCH 4/6] nbd: " Max Reitz
2014-07-18 18:25 ` [Qemu-devel] [PATCH 5/6] quorum: " Max Reitz
2014-07-18 18:25 ` [Qemu-devel] [PATCH 6/6] iotests: Add test for image filename construction Max Reitz
2014-08-15 15:22 ` [Qemu-devel] [PATCH 0/6] block: Let drivers reconstruct the filename Max Reitz
2014-08-20 15:29 ` Kevin Wolf

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=1405707901-8253-4-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).