Skip to content

Commit

Permalink
block: Make essential BlockDriver objects public
Browse files Browse the repository at this point in the history
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 5f535a9)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
XanClic authored and mdroth committed Jan 7, 2015
1 parent b28d7b5 commit cdeb85c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion block/qcow2.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion block/raw-posix.c
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion block/raw-win32.c
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion block/raw_bsd.c
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions include/block/block_int.h
Expand Up @@ -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,
Expand Down

0 comments on commit cdeb85c

Please sign in to comment.