]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block: Make essential BlockDriver objects public
authorMax Reitz <mreitz@redhat.com>
Tue, 2 Dec 2014 17:32:41 +0000 (18:32 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sun, 22 Feb 2015 18:03:18 +0000 (12:03 -0600)
There are some block drivers which are essential to QEMU and may not be
removed: These are raw, file and qcow2 (as the default non-raw format).
Make their BlockDriver objects public so they can be directly referenced
throughout the block layer without needing to call bdrv_find_format()
and having to deal with an error at runtime, while the real problem
occurred during linking (where raw, file or qcow2 were not linked into
qemu).

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 5f535a941e52229d81e55603eb69b2bd449b937a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2.c
block/raw-posix.c
block/raw-win32.c
block/raw_bsd.c
include/block/block_int.h

index d12049451a10de8b67001184c604f4e44a7e6203..48aca2a2ac84461c8def534a4aa835dfc800f4cb 100644 (file)
@@ -2847,7 +2847,7 @@ static QemuOptsList qcow2_create_opts = {
     }
 };
 
-static BlockDriver bdrv_qcow2 = {
+BlockDriver bdrv_qcow2 = {
     .format_name        = "qcow2",
     .instance_size      = sizeof(BDRVQcowState),
     .bdrv_probe         = qcow2_probe,
index b1af77e47fc2e1aad55127b6383fc57e3540b6d3..d8bbed06766265b94596af8cbff40000470b351e 100644 (file)
@@ -1684,7 +1684,7 @@ static QemuOptsList raw_create_opts = {
     }
 };
 
-static BlockDriver bdrv_file = {
+BlockDriver bdrv_file = {
     .format_name = "file",
     .protocol_name = "file",
     .instance_size = sizeof(BDRVRawState),
index 7b588815b933ab4b7962dc203714dba742dc6693..06243d76df61d3dff9a134a4c32b05fd49955cbc 100644 (file)
@@ -540,7 +540,7 @@ static QemuOptsList raw_create_opts = {
     }
 };
 
-static BlockDriver bdrv_file = {
+BlockDriver bdrv_file = {
     .format_name       = "file",
     .protocol_name     = "file",
     .instance_size     = sizeof(BDRVRawState),
index 401b967e85e6285b74b9d3bd43caf2a0eb627329..ea2b86493f878bb784c8381ed172a1b4b114caae 100644 (file)
@@ -173,7 +173,7 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)
     return 1;
 }
 
-static BlockDriver bdrv_raw = {
+BlockDriver bdrv_raw = {
     .format_name          = "raw",
     .bdrv_probe           = &raw_probe,
     .bdrv_reopen_prepare  = &raw_reopen_prepare,
index a1c17b95788f2ea2bde110f9ccba51176753aa1c..2ae82c5bff8d660afce22f599fffcb8b6bbb2f9c 100644 (file)
@@ -411,6 +411,14 @@ struct BlockDriverState {
     Error *backing_blocker;
 };
 
+
+/* Essential block drivers which must always be statically linked into qemu, and
+ * which therefore can be accessed without using bdrv_find_format() */
+extern BlockDriver bdrv_file;
+extern BlockDriver bdrv_raw;
+extern BlockDriver bdrv_qcow2;
+
+
 int get_tmp_filename(char *filename, int size);
 
 void bdrv_set_io_limits(BlockDriverState *bs,