From b64ec4e4ade581d662753cdeb0d7e0e27aafbf81 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Wed, 29 May 2013 19:35:40 +0800 Subject: block: add block driver read only whitelist We may want to include a driver in the whitelist for read only tasks such as diagnosing or exporting guest data (with libguestfs as a good example). This patch introduces a readonly whitelist option, and for backward compatibility, the old configure option --block-drv-whitelist is now an alias to rw whitelist. Drivers in readonly list is only permitted to open file readonly, and returns -ENOTSUP for RW opening. E.g. To include vmdk readonly, and others read+write: ./configure --target-list=x86_64-softmmu \ --block-drv-rw-whitelist=qcow2,raw,file,qed \ --block-drv-ro-whitelist=vmdk Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- include/block/block.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/block/block.h') diff --git a/include/block/block.h b/include/block/block.h index 1251c5cf9f..5604418a6a 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -124,7 +124,8 @@ void bdrv_init(void); void bdrv_init_with_whitelist(void); BlockDriver *bdrv_find_protocol(const char *filename); BlockDriver *bdrv_find_format(const char *format_name); -BlockDriver *bdrv_find_whitelisted_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); int bdrv_create_file(const char* filename, QEMUOptionParameter *options); -- cgit v1.2.3