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