summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2013-08-23 09:14:46 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:08 +0200
commit9fcb025146676ab376e6159b58f5a5ddb67bf03c (patch)
tree1b642880bf42f0943ae9533b1fa78f933022b183 /include
parent13c91cb7e28b47f5c4227f7e88a1378570117704 (diff)
downloadqemu-9fcb025146676ab376e6159b58f5a5ddb67bf03c.tar.gz
block: implement reference count for BlockDriverState
Introduce bdrv_ref/bdrv_unref to manage the lifecycle of BlockDriverState. They are unused for now but will used to replace bdrv_delete() later. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h2
-rw-r--r--include/block/block_int.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/block/block.h b/include/block/block.h
index 6207ff2cec..f24e1fffe2 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -355,6 +355,8 @@ int64_t bdrv_get_dirty_count(BlockDriverState *bs);
void bdrv_enable_copy_on_read(BlockDriverState *bs);
void bdrv_disable_copy_on_read(BlockDriverState *bs);
+void bdrv_ref(BlockDriverState *bs);
+void bdrv_unref(BlockDriverState *bs);
void bdrv_set_in_use(BlockDriverState *bs, int in_use);
int bdrv_in_use(BlockDriverState *bs);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index c3c9c61fa5..b9212b8331 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -277,6 +277,7 @@ struct BlockDriverState {
BlockDeviceIoStatus iostatus;
char device_name[32];
HBitmap *dirty_bitmap;
+ int refcnt;
int in_use; /* users other than guest access, eg. block migration */
QTAILQ_ENTRY(BlockDriverState) list;