mirror of https://github.com/xemu-project/xemu.git
block: Add options QDict to .bdrv_open()
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
4f30649618
commit
1a86938f04
4
block.c
4
block.c
|
@ -710,7 +710,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||||
} else {
|
} else {
|
||||||
assert(file != NULL);
|
assert(file != NULL);
|
||||||
bs->file = file;
|
bs->file = file;
|
||||||
ret = drv->bdrv_open(bs, open_flags);
|
ret = drv->bdrv_open(bs, NULL, open_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -3190,7 +3190,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
||||||
if (bs->file) {
|
if (bs->file) {
|
||||||
drv->bdrv_close(bs);
|
drv->bdrv_close(bs);
|
||||||
ret = bdrv_snapshot_goto(bs->file, snapshot_id);
|
ret = bdrv_snapshot_goto(bs->file, snapshot_id);
|
||||||
open_ret = drv->bdrv_open(bs, bs->open_flags);
|
open_ret = drv->bdrv_open(bs, NULL, bs->open_flags);
|
||||||
if (open_ret < 0) {
|
if (open_ret < 0) {
|
||||||
bdrv_delete(bs->file);
|
bdrv_delete(bs->file);
|
||||||
bs->drv = NULL;
|
bs->drv = NULL;
|
||||||
|
|
|
@ -108,7 +108,7 @@ static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bochs_open(BlockDriverState *bs, int flags)
|
static int bochs_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVBochsState *s = bs->opaque;
|
BDRVBochsState *s = bs->opaque;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cloop_open(BlockDriverState *bs, int flags)
|
static int cloop_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVCloopState *s = bs->opaque;
|
BDRVCloopState *s = bs->opaque;
|
||||||
uint32_t offsets_size, max_compressed_block_size = 1, i;
|
uint32_t offsets_size, max_compressed_block_size = 1, i;
|
||||||
|
|
|
@ -58,7 +58,7 @@ static int cow_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cow_open(BlockDriverState *bs, int flags)
|
static int cow_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVCowState *s = bs->opaque;
|
BDRVCowState *s = bs->opaque;
|
||||||
struct cow_header_v2 cow_header;
|
struct cow_header_v2 cow_header;
|
||||||
|
|
|
@ -85,7 +85,7 @@ static int read_uint32(BlockDriverState *bs, int64_t offset, uint32_t *result)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dmg_open(BlockDriverState *bs, int flags)
|
static int dmg_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVDMGState *s = bs->opaque;
|
BDRVDMGState *s = bs->opaque;
|
||||||
uint64_t info_begin,info_end,last_in_offset,last_out_offset;
|
uint64_t info_begin,info_end,last_in_offset,last_out_offset;
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int parallels_probe(const uint8_t *buf, int buf_size, const char *filenam
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parallels_open(BlockDriverState *bs, int flags)
|
static int parallels_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVParallelsState *s = bs->opaque;
|
BDRVParallelsState *s = bs->opaque;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -92,7 +92,7 @@ static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qcow_open(BlockDriverState *bs, int flags)
|
static int qcow_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVQcowState *s = bs->opaque;
|
BDRVQcowState *s = bs->opaque;
|
||||||
int len, i, shift, ret;
|
int len, i, shift, ret;
|
||||||
|
|
|
@ -285,7 +285,7 @@ static int qcow2_check(BlockDriverState *bs, BdrvCheckResult *result,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qcow2_open(BlockDriverState *bs, int flags)
|
static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVQcowState *s = bs->opaque;
|
BDRVQcowState *s = bs->opaque;
|
||||||
int len, i, ret = 0;
|
int len, i, ret = 0;
|
||||||
|
@ -912,7 +912,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)
|
||||||
qcow2_close(bs);
|
qcow2_close(bs);
|
||||||
|
|
||||||
memset(s, 0, sizeof(BDRVQcowState));
|
memset(s, 0, sizeof(BDRVQcowState));
|
||||||
qcow2_open(bs, flags);
|
qcow2_open(bs, NULL, flags);
|
||||||
|
|
||||||
if (crypt_method) {
|
if (crypt_method) {
|
||||||
s->crypt_method = crypt_method;
|
s->crypt_method = crypt_method;
|
||||||
|
|
|
@ -373,7 +373,7 @@ static void bdrv_qed_rebind(BlockDriverState *bs)
|
||||||
s->bs = bs;
|
s->bs = bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bdrv_qed_open(BlockDriverState *bs, int flags)
|
static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVQEDState *s = bs->opaque;
|
BDRVQEDState *s = bs->opaque;
|
||||||
QEDHeader le_header;
|
QEDHeader le_header;
|
||||||
|
@ -1526,7 +1526,7 @@ static void bdrv_qed_invalidate_cache(BlockDriverState *bs)
|
||||||
|
|
||||||
bdrv_qed_close(bs);
|
bdrv_qed_close(bs);
|
||||||
memset(s, 0, sizeof(BDRVQEDState));
|
memset(s, 0, sizeof(BDRVQEDState));
|
||||||
bdrv_qed_open(bs, bs->open_flags);
|
bdrv_qed_open(bs, NULL, bs->open_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result,
|
static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
||||||
static int raw_open(BlockDriverState *bs, int flags)
|
static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
bs->sg = bs->file->sg;
|
bs->sg = bs->file->sg;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -364,7 +364,7 @@ static int vdi_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vdi_open(BlockDriverState *bs, int flags)
|
static int vdi_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVVdiState *s = bs->opaque;
|
BDRVVdiState *s = bs->opaque;
|
||||||
VdiHeader header;
|
VdiHeader header;
|
||||||
|
|
|
@ -723,7 +723,7 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags,
|
||||||
return vmdk_parse_extents(buf, bs, bs->file->filename);
|
return vmdk_parse_extents(buf, bs, bs->file->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vmdk_open(BlockDriverState *bs, int flags)
|
static int vmdk_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
BDRVVmdkState *s = bs->opaque;
|
BDRVVmdkState *s = bs->opaque;
|
||||||
|
|
|
@ -155,7 +155,7 @@ static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vpc_open(BlockDriverState *bs, int flags)
|
static int vpc_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
{
|
{
|
||||||
BDRVVPCState *s = bs->opaque;
|
BDRVVPCState *s = bs->opaque;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct BlockDriver {
|
||||||
void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
|
void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
|
||||||
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
||||||
|
|
||||||
int (*bdrv_open)(BlockDriverState *bs, int flags);
|
int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags);
|
||||||
int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags);
|
int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags);
|
||||||
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
|
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
|
||||||
uint8_t *buf, int nb_sectors);
|
uint8_t *buf, int nb_sectors);
|
||||||
|
|
Loading…
Reference in New Issue