From 59f2689d9082f2f631253c810f73cd22290144a9 Mon Sep 17 00:00:00 2001 From: Naphtali Sprei Date: Mon, 26 Oct 2009 16:25:16 +0200 Subject: Added readonly flag to -drive command This is a slightly revised patch for adding readonly flag to the -drive command. Even though this patch is "stand-alone", it assumes a previous related patch (in Anthony staging tree), that passes the readonly attribute of the drive to the guest OS, applied first. This enables sharing same image between guests, with readonly access. Implementaion mark the drive as read_only and changes the flags when actually opening the file. The readonly attribute of a qcow also passed to it's base file. For ide that cannot pass the readonly attribute to the guest OS, disallow the readonly flag. Also, return error code from bdrv_truncate for readonly drive. Signed-off-by: Naphtali Sprei Signed-off-by: Anthony Liguori --- block.h | 1 + 1 file changed, 1 insertion(+) (limited to 'block.h') diff --git a/block.h b/block.h index a966afb..302010d 100644 --- a/block.h +++ b/block.h @@ -136,6 +136,7 @@ int bdrv_get_type_hint(BlockDriverState *bs); int bdrv_get_translation_hint(BlockDriverState *bs); int bdrv_is_removable(BlockDriverState *bs); int bdrv_is_read_only(BlockDriverState *bs); +int bdrv_set_read_only(BlockDriverState *bs, int read_only); int bdrv_is_sg(BlockDriverState *bs); int bdrv_enable_write_cache(BlockDriverState *bs); int bdrv_is_inserted(BlockDriverState *bs); -- cgit v1.1