[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/12] block: allow to call bdrv_open() with an opaq
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 11/12] block: allow to call bdrv_open() with an opaque |
Date: |
Thu, 20 Jun 2013 19:46:10 +0200 |
If the block driver already has a bs->opaque when calling bdrv_open(),
pass it down to the file driver.
Signed-off-by: Marc-André Lureau <address@hidden>
---
block.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index bdffb42..ff9cb0b 100644
--- a/block.c
+++ b/block.c
@@ -1041,6 +1041,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
QDict *options,
int ret;
BlockDriverState *file = NULL;
QDict *file_options = NULL;
+ void *backing_opaque = NULL;
/* NULL means an empty set of options */
if (options == NULL) {
@@ -1064,6 +1065,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
QDict *options,
goto fail;
}
+ backing_opaque = bs->opaque;
+ bs->opaque = NULL;
if (total_size == -1) {
bs1 = bdrv_new_int("", NULL, NULL);
ret = bdrv_open(bs1, filename, NULL, 0, drv);
@@ -1088,7 +1091,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
QDict *options,
extract_subqdict(options, &file_options, "file.");
ret = bdrv_file_open_int(&file, filename, file_options,
- bdrv_open_flags(bs, flags), bs, NULL);
+ bdrv_open_flags(bs, flags), bs, bs->opaque);
+ bs->opaque = NULL;
if (ret < 0) {
goto fail;
}
@@ -1118,7 +1122,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
QDict *options,
QDict *backing_options;
extract_subqdict(options, &backing_options, "backing.");
- ret = bdrv_open_backing_file_int(bs, backing_options, NULL);
+ ret = bdrv_open_backing_file_int(bs, backing_options, backing_opaque);
if (ret < 0) {
goto close_and_fail;
}
--
1.8.3.rc1.49.g8d97506
- [Qemu-devel] [PATCH 01/12] include: add missing config-host.h include, (continued)
- [Qemu-devel] [PATCH 01/12] include: add missing config-host.h include, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 10/12] block: learn to open a driver with a given opaque, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 08/12] block: extract make_snapshot() from bdrv_open(), Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 12/12] block: add spice block device backend, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 06/12] nbd: make session_close() idempotent, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 04/12] Split nbd block client code, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 03/12] nbd: don't change socket block during negotiate, Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 02/12] char: add qemu_chr_fe_event(), Marc-André Lureau, 2013/06/20
- [Qemu-devel] [PATCH 11/12] block: allow to call bdrv_open() with an opaque,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 07/12] block: save the associated child in BlockDriverState, Marc-André Lureau, 2013/06/20
[Qemu-devel] [PATCH 09/12] block: add "snapshot.size" option to avoid extra bdrv_open(), Marc-André Lureau, 2013/06/20
[Qemu-devel] [PATCH 05/12] nbd: pass export name as init argument, Marc-André Lureau, 2013/06/20