|
|
9ae3a8 |
From cbf4a883b38edbd2740c0ed374e1101fe56513bf Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 4 Nov 2013 22:32:09 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 16/87] bdrv: Use "Error" for opening images
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383604354-12743-19-git-send-email-mreitz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55318
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 18/43] bdrv: Use "Error" for opening images
|
|
|
9ae3a8 |
Bugzilla: 1026524
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: 1026524
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Add an Error ** parameter to BlockDriver.bdrv_open and
|
|
|
9ae3a8 |
BlockDriver.bdrv_file_open to allow more specific error messages.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 015a1036a74ad29bb6916754911ce25587ff4db3)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
block/raw.c
|
|
|
9ae3a8 |
block/raw_bsd.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts because raw_bsd.c does not exist downstream; instead, there is
|
|
|
9ae3a8 |
raw.c.
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 4 ++--
|
|
|
9ae3a8 |
block/blkdebug.c | 3 ++-
|
|
|
9ae3a8 |
block/blkverify.c | 3 ++-
|
|
|
9ae3a8 |
block/bochs.c | 3 ++-
|
|
|
9ae3a8 |
block/cloop.c | 3 ++-
|
|
|
9ae3a8 |
block/cow.c | 3 ++-
|
|
|
9ae3a8 |
block/curl.c | 3 ++-
|
|
|
9ae3a8 |
block/dmg.c | 3 ++-
|
|
|
9ae3a8 |
block/gluster.c | 2 +-
|
|
|
9ae3a8 |
block/iscsi.c | 5 +++--
|
|
|
9ae3a8 |
block/nbd.c | 3 ++-
|
|
|
9ae3a8 |
block/parallels.c | 3 ++-
|
|
|
9ae3a8 |
block/qcow.c | 3 ++-
|
|
|
9ae3a8 |
block/qcow2.c | 5 +++--
|
|
|
9ae3a8 |
block/qed.c | 5 +++--
|
|
|
9ae3a8 |
block/raw-posix.c | 12 ++++++++----
|
|
|
9ae3a8 |
block/raw-win32.c | 6 ++++--
|
|
|
9ae3a8 |
block/raw.c | 3 ++-
|
|
|
9ae3a8 |
block/rbd.c | 3 ++-
|
|
|
9ae3a8 |
block/sheepdog.c | 3 ++-
|
|
|
9ae3a8 |
block/snapshot.c | 2 +-
|
|
|
9ae3a8 |
block/ssh.c | 3 ++-
|
|
|
9ae3a8 |
block/vdi.c | 3 ++-
|
|
|
9ae3a8 |
block/vhdx.c | 3 ++-
|
|
|
9ae3a8 |
block/vmdk.c | 3 ++-
|
|
|
9ae3a8 |
block/vpc.c | 3 ++-
|
|
|
9ae3a8 |
block/vvfat.c | 3 ++-
|
|
|
9ae3a8 |
include/block/block_int.h | 6 ++++--
|
|
|
9ae3a8 |
28 files changed, 67 insertions(+), 37 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 4 ++--
|
|
|
9ae3a8 |
block/blkdebug.c | 3 ++-
|
|
|
9ae3a8 |
block/blkverify.c | 3 ++-
|
|
|
9ae3a8 |
block/bochs.c | 3 ++-
|
|
|
9ae3a8 |
block/cloop.c | 3 ++-
|
|
|
9ae3a8 |
block/cow.c | 3 ++-
|
|
|
9ae3a8 |
block/curl.c | 3 ++-
|
|
|
9ae3a8 |
block/dmg.c | 3 ++-
|
|
|
9ae3a8 |
block/gluster.c | 2 +-
|
|
|
9ae3a8 |
block/iscsi.c | 5 +++--
|
|
|
9ae3a8 |
block/nbd.c | 3 ++-
|
|
|
9ae3a8 |
block/parallels.c | 3 ++-
|
|
|
9ae3a8 |
block/qcow.c | 3 ++-
|
|
|
9ae3a8 |
block/qcow2.c | 5 +++--
|
|
|
9ae3a8 |
block/qed.c | 5 +++--
|
|
|
9ae3a8 |
block/raw-posix.c | 12 ++++++++----
|
|
|
9ae3a8 |
block/raw-win32.c | 6 ++++--
|
|
|
9ae3a8 |
block/raw.c | 3 ++-
|
|
|
9ae3a8 |
block/rbd.c | 3 ++-
|
|
|
9ae3a8 |
block/sheepdog.c | 3 ++-
|
|
|
9ae3a8 |
block/snapshot.c | 2 +-
|
|
|
9ae3a8 |
block/ssh.c | 3 ++-
|
|
|
9ae3a8 |
block/vdi.c | 3 ++-
|
|
|
9ae3a8 |
block/vhdx.c | 3 ++-
|
|
|
9ae3a8 |
block/vmdk.c | 3 ++-
|
|
|
9ae3a8 |
block/vpc.c | 3 ++-
|
|
|
9ae3a8 |
block/vvfat.c | 3 ++-
|
|
|
9ae3a8 |
include/block/block_int.h | 6 ++++--
|
|
|
9ae3a8 |
28 files changed, 67 insertions(+), 37 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block.c b/block.c
|
|
|
9ae3a8 |
index 69b70d0..921fa33 100644
|
|
|
9ae3a8 |
--- a/block.c
|
|
|
9ae3a8 |
+++ b/block.c
|
|
|
9ae3a8 |
@@ -733,7 +733,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
|
|
9ae3a8 |
if (drv->bdrv_file_open) {
|
|
|
9ae3a8 |
assert(file == NULL);
|
|
|
9ae3a8 |
assert(drv->bdrv_parse_filename || filename != NULL);
|
|
|
9ae3a8 |
- ret = drv->bdrv_file_open(bs, options, open_flags);
|
|
|
9ae3a8 |
+ ret = drv->bdrv_file_open(bs, options, open_flags, NULL);
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
if (file == NULL) {
|
|
|
9ae3a8 |
qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a "
|
|
|
9ae3a8 |
@@ -744,7 +744,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
assert(file != NULL);
|
|
|
9ae3a8 |
bs->file = file;
|
|
|
9ae3a8 |
- ret = drv->bdrv_open(bs, options, open_flags);
|
|
|
9ae3a8 |
+ ret = drv->bdrv_open(bs, options, open_flags, NULL);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
diff --git a/block/blkdebug.c b/block/blkdebug.c
|
|
|
9ae3a8 |
index d659d38..114c4c9 100644
|
|
|
9ae3a8 |
--- a/block/blkdebug.c
|
|
|
9ae3a8 |
+++ b/block/blkdebug.c
|
|
|
9ae3a8 |
@@ -347,7 +347,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVBlkdebugState *s = bs->opaque;
|
|
|
9ae3a8 |
QemuOpts *opts;
|
|
|
9ae3a8 |
diff --git a/block/blkverify.c b/block/blkverify.c
|
|
|
9ae3a8 |
index 1d58cc3..5d716bb 100644
|
|
|
9ae3a8 |
--- a/block/blkverify.c
|
|
|
9ae3a8 |
+++ b/block/blkverify.c
|
|
|
9ae3a8 |
@@ -116,7 +116,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int blkverify_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVBlkverifyState *s = bs->opaque;
|
|
|
9ae3a8 |
QemuOpts *opts;
|
|
|
9ae3a8 |
diff --git a/block/bochs.c b/block/bochs.c
|
|
|
9ae3a8 |
index d7078c0..51d9a90 100644
|
|
|
9ae3a8 |
--- a/block/bochs.c
|
|
|
9ae3a8 |
+++ b/block/bochs.c
|
|
|
9ae3a8 |
@@ -108,7 +108,8 @@ static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int bochs_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVBochsState *s = bs->opaque;
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
diff --git a/block/cloop.c b/block/cloop.c
|
|
|
9ae3a8 |
index 6ea7cf4..b907023 100644
|
|
|
9ae3a8 |
--- a/block/cloop.c
|
|
|
9ae3a8 |
+++ b/block/cloop.c
|
|
|
9ae3a8 |
@@ -53,7 +53,8 @@ static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int cloop_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVCloopState *s = bs->opaque;
|
|
|
9ae3a8 |
uint32_t offsets_size, max_compressed_block_size = 1, i;
|
|
|
9ae3a8 |
diff --git a/block/cow.c b/block/cow.c
|
|
|
9ae3a8 |
index 6958808..ce8deb8 100644
|
|
|
9ae3a8 |
--- a/block/cow.c
|
|
|
9ae3a8 |
+++ b/block/cow.c
|
|
|
9ae3a8 |
@@ -58,7 +58,8 @@ static int cow_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int cow_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int cow_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVCowState *s = bs->opaque;
|
|
|
9ae3a8 |
struct cow_header_v2 cow_header;
|
|
|
9ae3a8 |
diff --git a/block/curl.c b/block/curl.c
|
|
|
9ae3a8 |
index b8935fd..1b0fcf1 100644
|
|
|
9ae3a8 |
--- a/block/curl.c
|
|
|
9ae3a8 |
+++ b/block/curl.c
|
|
|
9ae3a8 |
@@ -395,7 +395,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int curl_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int curl_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVCURLState *s = bs->opaque;
|
|
|
9ae3a8 |
CURLState *state = NULL;
|
|
|
9ae3a8 |
diff --git a/block/dmg.c b/block/dmg.c
|
|
|
9ae3a8 |
index 3141cb5..d5e9b1f 100644
|
|
|
9ae3a8 |
--- a/block/dmg.c
|
|
|
9ae3a8 |
+++ b/block/dmg.c
|
|
|
9ae3a8 |
@@ -92,7 +92,8 @@ static int read_uint32(BlockDriverState *bs, int64_t offset, uint32_t *result)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int dmg_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVDMGState *s = bs->opaque;
|
|
|
9ae3a8 |
uint64_t info_begin,info_end,last_in_offset,last_out_offset;
|
|
|
9ae3a8 |
diff --git a/block/gluster.c b/block/gluster.c
|
|
|
9ae3a8 |
index 90a51ca..fa46b6f 100644
|
|
|
9ae3a8 |
--- a/block/gluster.c
|
|
|
9ae3a8 |
+++ b/block/gluster.c
|
|
|
9ae3a8 |
@@ -297,7 +297,7 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
|
|
|
9ae3a8 |
- int bdrv_flags)
|
|
|
9ae3a8 |
+ int bdrv_flags, Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVGlusterState *s = bs->opaque;
|
|
|
9ae3a8 |
int open_flags = O_BINARY;
|
|
|
9ae3a8 |
diff --git a/block/iscsi.c b/block/iscsi.c
|
|
|
9ae3a8 |
index cc2017e..8d49e35 100644
|
|
|
9ae3a8 |
--- a/block/iscsi.c
|
|
|
9ae3a8 |
+++ b/block/iscsi.c
|
|
|
9ae3a8 |
@@ -1056,7 +1056,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
* We support iscsi url's on the form
|
|
|
9ae3a8 |
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
IscsiLun *iscsilun = bs->opaque;
|
|
|
9ae3a8 |
struct iscsi_context *iscsi = NULL;
|
|
|
9ae3a8 |
@@ -1271,7 +1272,7 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
bs_options = qdict_new();
|
|
|
9ae3a8 |
qdict_put(bs_options, "filename", qstring_from_str(filename));
|
|
|
9ae3a8 |
- ret = iscsi_open(bs, bs_options, 0);
|
|
|
9ae3a8 |
+ ret = iscsi_open(bs, bs_options, 0, NULL);
|
|
|
9ae3a8 |
QDECREF(bs_options);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret != 0) {
|
|
|
9ae3a8 |
diff --git a/block/nbd.c b/block/nbd.c
|
|
|
9ae3a8 |
index 9c480b8..48a759e 100644
|
|
|
9ae3a8 |
--- a/block/nbd.c
|
|
|
9ae3a8 |
+++ b/block/nbd.c
|
|
|
9ae3a8 |
@@ -463,7 +463,8 @@ static void nbd_teardown_connection(BlockDriverState *bs)
|
|
|
9ae3a8 |
closesocket(s->sock);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int nbd_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVNBDState *s = bs->opaque;
|
|
|
9ae3a8 |
int result;
|
|
|
9ae3a8 |
diff --git a/block/parallels.c b/block/parallels.c
|
|
|
9ae3a8 |
index 18b3ac0..2121e43 100644
|
|
|
9ae3a8 |
--- a/block/parallels.c
|
|
|
9ae3a8 |
+++ b/block/parallels.c
|
|
|
9ae3a8 |
@@ -68,7 +68,8 @@ static int parallels_probe(const uint8_t *buf, int buf_size, const char *filenam
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int parallels_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVParallelsState *s = bs->opaque;
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
diff --git a/block/qcow.c b/block/qcow.c
|
|
|
9ae3a8 |
index 4ab552e..b8887f0 100644
|
|
|
9ae3a8 |
--- a/block/qcow.c
|
|
|
9ae3a8 |
+++ b/block/qcow.c
|
|
|
9ae3a8 |
@@ -92,7 +92,8 @@ static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int qcow_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVQcowState *s = bs->opaque;
|
|
|
9ae3a8 |
int len, i, shift, ret;
|
|
|
9ae3a8 |
diff --git a/block/qcow2.c b/block/qcow2.c
|
|
|
9ae3a8 |
index 8a30863..2e7e9f5 100644
|
|
|
9ae3a8 |
--- a/block/qcow2.c
|
|
|
9ae3a8 |
+++ b/block/qcow2.c
|
|
|
9ae3a8 |
@@ -350,7 +350,8 @@ static QemuOptsList qcow2_runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVQcowState *s = bs->opaque;
|
|
|
9ae3a8 |
int len, i, ret = 0;
|
|
|
9ae3a8 |
@@ -1059,7 +1060,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)
|
|
|
9ae3a8 |
qbool_from_int(s->use_lazy_refcounts));
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
memset(s, 0, sizeof(BDRVQcowState));
|
|
|
9ae3a8 |
- qcow2_open(bs, options, flags);
|
|
|
9ae3a8 |
+ qcow2_open(bs, options, flags, NULL);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
QDECREF(options);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/qed.c b/block/qed.c
|
|
|
9ae3a8 |
index 815ee1c..d49e0cd 100644
|
|
|
9ae3a8 |
--- a/block/qed.c
|
|
|
9ae3a8 |
+++ b/block/qed.c
|
|
|
9ae3a8 |
@@ -373,7 +373,8 @@ static void bdrv_qed_rebind(BlockDriverState *bs)
|
|
|
9ae3a8 |
s->bs = bs;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVQEDState *s = bs->opaque;
|
|
|
9ae3a8 |
QEDHeader le_header;
|
|
|
9ae3a8 |
@@ -1547,7 +1548,7 @@ static void bdrv_qed_invalidate_cache(BlockDriverState *bs)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
bdrv_qed_close(bs);
|
|
|
9ae3a8 |
memset(s, 0, sizeof(BDRVQEDState));
|
|
|
9ae3a8 |
- bdrv_qed_open(bs, NULL, bs->open_flags);
|
|
|
9ae3a8 |
+ bdrv_qed_open(bs, NULL, bs->open_flags, NULL);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result,
|
|
|
9ae3a8 |
diff --git a/block/raw-posix.c b/block/raw-posix.c
|
|
|
9ae3a8 |
index c7ab908..5f4e824 100644
|
|
|
9ae3a8 |
--- a/block/raw-posix.c
|
|
|
9ae3a8 |
+++ b/block/raw-posix.c
|
|
|
9ae3a8 |
@@ -335,7 +335,8 @@ fail:
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -1330,7 +1331,8 @@ static int check_hdev_writable(BDRVRawState *s)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
@@ -1570,7 +1572,8 @@ static BlockDriver bdrv_host_device = {
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#ifdef __linux__
|
|
|
9ae3a8 |
-static int floppy_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int floppy_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
@@ -1692,7 +1695,8 @@ static BlockDriver bdrv_host_floppy = {
|
|
|
9ae3a8 |
.bdrv_eject = floppy_eject,
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int cdrom_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/raw-win32.c b/block/raw-win32.c
|
|
|
9ae3a8 |
index a324e5b..1cfec65 100644
|
|
|
9ae3a8 |
--- a/block/raw-win32.c
|
|
|
9ae3a8 |
+++ b/block/raw-win32.c
|
|
|
9ae3a8 |
@@ -234,7 +234,8 @@ static QemuOptsList raw_runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
int access_flags;
|
|
|
9ae3a8 |
@@ -530,7 +531,8 @@ static int hdev_probe_device(const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRawState *s = bs->opaque;
|
|
|
9ae3a8 |
int access_flags, create_flags;
|
|
|
9ae3a8 |
diff --git a/block/raw.c b/block/raw.c
|
|
|
9ae3a8 |
index 7d82cf3..801591d 100644
|
|
|
9ae3a8 |
--- a/block/raw.c
|
|
|
9ae3a8 |
+++ b/block/raw.c
|
|
|
9ae3a8 |
@@ -3,7 +3,8 @@
|
|
|
9ae3a8 |
#include "block/block_int.h"
|
|
|
9ae3a8 |
#include "qemu/module.h"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
bs->sg = bs->file->sg;
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
diff --git a/block/rbd.c b/block/rbd.c
|
|
|
9ae3a8 |
index 7b6e03b..8d4ae9f 100644
|
|
|
9ae3a8 |
--- a/block/rbd.c
|
|
|
9ae3a8 |
+++ b/block/rbd.c
|
|
|
9ae3a8 |
@@ -457,7 +457,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVRBDState *s = bs->opaque;
|
|
|
9ae3a8 |
char pool[RBD_MAX_POOL_NAME_SIZE];
|
|
|
9ae3a8 |
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
|
|
9ae3a8 |
index f7cc76e..a8ce933 100644
|
|
|
9ae3a8 |
--- a/block/sheepdog.c
|
|
|
9ae3a8 |
+++ b/block/sheepdog.c
|
|
|
9ae3a8 |
@@ -1259,7 +1259,8 @@ static QemuOptsList runtime_opts = {
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int sd_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int sd_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int ret, fd;
|
|
|
9ae3a8 |
uint32_t vid = 0;
|
|
|
9ae3a8 |
diff --git a/block/snapshot.c b/block/snapshot.c
|
|
|
9ae3a8 |
index 6c6d9de..51b4b96 100644
|
|
|
9ae3a8 |
--- a/block/snapshot.c
|
|
|
9ae3a8 |
+++ b/block/snapshot.c
|
|
|
9ae3a8 |
@@ -97,7 +97,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
|
|
9ae3a8 |
if (bs->file) {
|
|
|
9ae3a8 |
drv->bdrv_close(bs);
|
|
|
9ae3a8 |
ret = bdrv_snapshot_goto(bs->file, snapshot_id);
|
|
|
9ae3a8 |
- open_ret = drv->bdrv_open(bs, NULL, bs->open_flags);
|
|
|
9ae3a8 |
+ open_ret = drv->bdrv_open(bs, NULL, bs->open_flags, NULL);
|
|
|
9ae3a8 |
if (open_ret < 0) {
|
|
|
9ae3a8 |
bdrv_delete(bs->file);
|
|
|
9ae3a8 |
bs->drv = NULL;
|
|
|
9ae3a8 |
diff --git a/block/ssh.c b/block/ssh.c
|
|
|
9ae3a8 |
index d7e7bf8..f950fcc 100644
|
|
|
9ae3a8 |
--- a/block/ssh.c
|
|
|
9ae3a8 |
+++ b/block/ssh.c
|
|
|
9ae3a8 |
@@ -608,7 +608,8 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags)
|
|
|
9ae3a8 |
+static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVSSHState *s = bs->opaque;
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
diff --git a/block/vdi.c b/block/vdi.c
|
|
|
9ae3a8 |
index bc97c39..661c3f0 100644
|
|
|
9ae3a8 |
--- a/block/vdi.c
|
|
|
9ae3a8 |
+++ b/block/vdi.c
|
|
|
9ae3a8 |
@@ -364,7 +364,8 @@ static int vdi_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return result;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int vdi_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVVdiState *s = bs->opaque;
|
|
|
9ae3a8 |
VdiHeader header;
|
|
|
9ae3a8 |
diff --git a/block/vhdx.c b/block/vhdx.c
|
|
|
9ae3a8 |
index 11d923f..6cb0412 100644
|
|
|
9ae3a8 |
--- a/block/vhdx.c
|
|
|
9ae3a8 |
+++ b/block/vhdx.c
|
|
|
9ae3a8 |
@@ -717,7 +717,8 @@ exit:
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int vhdx_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVVHDXState *s = bs->opaque;
|
|
|
9ae3a8 |
int ret = 0;
|
|
|
9ae3a8 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
9ae3a8 |
index 7456f9b..d9e2545 100644
|
|
|
9ae3a8 |
--- a/block/vmdk.c
|
|
|
9ae3a8 |
+++ b/block/vmdk.c
|
|
|
9ae3a8 |
@@ -806,7 +806,8 @@ exit:
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int vmdk_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int vmdk_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
BDRVVmdkState *s = bs->opaque;
|
|
|
9ae3a8 |
diff --git a/block/vpc.c b/block/vpc.c
|
|
|
9ae3a8 |
index 3cad52e..cf5e751 100644
|
|
|
9ae3a8 |
--- a/block/vpc.c
|
|
|
9ae3a8 |
+++ b/block/vpc.c
|
|
|
9ae3a8 |
@@ -155,7 +155,8 @@ static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int vpc_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVVPCState *s = bs->opaque;
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
diff --git a/block/vvfat.c b/block/vvfat.c
|
|
|
9ae3a8 |
index dd0efca..bb3b0b6 100644
|
|
|
9ae3a8 |
--- a/block/vvfat.c
|
|
|
9ae3a8 |
+++ b/block/vvfat.c
|
|
|
9ae3a8 |
@@ -1065,7 +1065,8 @@ static void vvfat_parse_filename(const char *filename, QDict *options,
|
|
|
9ae3a8 |
qdict_put(options, "rw", qbool_from_int(rw));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int vvfat_open(BlockDriverState *bs, QDict *options, int flags)
|
|
|
9ae3a8 |
+static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
BDRVVVFATState *s = bs->opaque;
|
|
|
9ae3a8 |
int cyls, heads, secs;
|
|
|
9ae3a8 |
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
|
|
9ae3a8 |
index ea2c811..3450b46 100644
|
|
|
9ae3a8 |
--- a/include/block/block_int.h
|
|
|
9ae3a8 |
+++ b/include/block/block_int.h
|
|
|
9ae3a8 |
@@ -86,8 +86,10 @@ struct BlockDriver {
|
|
|
9ae3a8 |
void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
|
|
|
9ae3a8 |
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags);
|
|
|
9ae3a8 |
- int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags);
|
|
|
9ae3a8 |
+ int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp);
|
|
|
9ae3a8 |
+ int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
+ Error **errp);
|
|
|
9ae3a8 |
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
|
|
|
9ae3a8 |
uint8_t *buf, int nb_sectors);
|
|
|
9ae3a8 |
int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|