From 83d0521a1e35989b0cb7235aef48455fedda3ca4 Mon Sep 17 00:00:00 2001 From: Chunyan Liu Date: Thu, 5 Jun 2014 17:20:51 +0800 Subject: change block layer to support both QemuOpts and QEMUOptionParamter Change block layer to support both QemuOpts and QEMUOptionParameter. After this patch, it will change backend drivers one by one. At the end, QEMUOptionParameter will be removed and only QemuOpts is kept. Signed-off-by: Dong Xu Wang Signed-off-by: Chunyan Liu Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- include/block/block.h | 7 ++++--- include/block/block_int.h | 13 ++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'include/block') diff --git a/include/block/block.h b/include/block/block.h index 7d86e29cf4..4312b8176e 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -204,9 +204,9 @@ BlockDriver *bdrv_find_format(const char *format_name); BlockDriver *bdrv_find_whitelisted_format(const char *format_name, bool readonly); int bdrv_create(BlockDriver *drv, const char* filename, - QEMUOptionParameter *options, Error **errp); + QEMUOptionParameter *options, QemuOpts *opts, Error **errp); int bdrv_create_file(const char* filename, QEMUOptionParameter *options, - Error **errp); + QemuOpts *opts, Error **errp); BlockDriverState *bdrv_new(const char *device_name, Error **errp); void bdrv_make_anon(BlockDriverState *bs); void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old); @@ -312,7 +312,8 @@ typedef enum { int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix); -int bdrv_amend_options(BlockDriverState *bs_new, QEMUOptionParameter *options); +int bdrv_amend_options(BlockDriverState *bs_new, QEMUOptionParameter *options, + QemuOpts *opts); /* external snapshots */ bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs, diff --git a/include/block/block_int.h b/include/block/block_int.h index 8d58334c1d..8a77d79f41 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -118,6 +118,8 @@ struct BlockDriver { void (*bdrv_rebind)(BlockDriverState *bs); int (*bdrv_create)(const char *filename, QEMUOptionParameter *options, Error **errp); + /* FIXME: will remove the duplicate and rename back to bdrv_create later */ + int (*bdrv_create2)(const char *filename, QemuOpts *opts, Error **errp); int (*bdrv_set_key)(BlockDriverState *bs, const char *key); int (*bdrv_make_empty)(BlockDriverState *bs); /* aio */ @@ -217,7 +219,12 @@ struct BlockDriver { /* List of options for creating images, terminated by name == NULL */ QEMUOptionParameter *create_options; - + /* FIXME: will replace create_options. + * These two fields are mutually exclusive. At most one is non-NULL. + * create_options should only be set with bdrv_create, and create_opts + * should only be set with bdrv_create2. + */ + QemuOptsList *create_opts; /* * Returns 0 for completed check, -errno for internal errors. @@ -228,6 +235,10 @@ struct BlockDriver { int (*bdrv_amend_options)(BlockDriverState *bs, QEMUOptionParameter *options); + /* FIXME: will remove the duplicate and rename back to + * bdrv_amend_options later + */ + int (*bdrv_amend_options2)(BlockDriverState *bs, QemuOpts *opts); void (*bdrv_debug_event)(BlockDriverState *bs, BlkDebugEvent event); -- cgit v1.2.3