]> 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>
Wed, 7 Jan 2015 21:07:12 +0000 (15:07 -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 1e3ab6bd029c63a9fd0a4596fcfde2277fe144f7..2695e2bbb58e3ce52a2cc318fd126c41f50ddf27 100644 (file)
@@ -2404,7 +2404,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 87fc17003791a22718f80cf24d40b772ac9609f6..2d51f2635c4d1061b06cf702e0f06226cbfd157c 100644 (file)
@@ -1585,7 +1585,7 @@ static QemuOptsList raw_create_opts = {
     }
 };
 
-static BlockDriver bdrv_file = {
+BlockDriver bdrv_file = {
     .format_name = "file",
     .protocol_name = "file",
     .instance_size = sizeof(BDRVRawState),
index 902eab6100ad5b1676be46fb4115e52d16448825..0f24dd8aa813c239af8c775ac060d018644f5413 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 f82f4c25df8a476d25ae380cdf6a2bde37fd70d9..431af8f6ea83c52f28902069619512227288e6dc 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 7b541a06910ecf73242c75a5ba92f92e75ed31b9..21b871833f9c9fd7595b7bf644c0301a20972938 100644 (file)
@@ -395,6 +395,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,