1 #ifndef BLOCK_DIRTY_BITMAP_H
2 #define BLOCK_DIRTY_BITMAP_H
4 #include "qemu-common.h"
5 #include "qemu/hbitmap.h"
7 BdrvDirtyBitmap
*bdrv_create_dirty_bitmap(BlockDriverState
*bs
,
11 void bdrv_create_meta_dirty_bitmap(BdrvDirtyBitmap
*bitmap
,
13 void bdrv_release_meta_dirty_bitmap(BdrvDirtyBitmap
*bitmap
);
14 int bdrv_dirty_bitmap_create_successor(BlockDriverState
*bs
,
15 BdrvDirtyBitmap
*bitmap
,
17 BdrvDirtyBitmap
*bdrv_dirty_bitmap_abdicate(BlockDriverState
*bs
,
18 BdrvDirtyBitmap
*bitmap
,
20 BdrvDirtyBitmap
*bdrv_reclaim_dirty_bitmap(BlockDriverState
*bs
,
21 BdrvDirtyBitmap
*bitmap
,
23 BdrvDirtyBitmap
*bdrv_find_dirty_bitmap(BlockDriverState
*bs
,
25 void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap
*bitmap
);
26 void bdrv_release_dirty_bitmap(BlockDriverState
*bs
, BdrvDirtyBitmap
*bitmap
);
27 void bdrv_release_named_dirty_bitmaps(BlockDriverState
*bs
);
28 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap
*bitmap
);
29 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap
*bitmap
);
30 BlockDirtyInfoList
*bdrv_query_dirty_bitmaps(BlockDriverState
*bs
);
31 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState
*bs
);
32 uint32_t bdrv_dirty_bitmap_granularity(BdrvDirtyBitmap
*bitmap
);
33 uint32_t bdrv_dirty_bitmap_meta_granularity(BdrvDirtyBitmap
*bitmap
);
34 bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap
*bitmap
);
35 bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap
*bitmap
);
36 const char *bdrv_dirty_bitmap_name(const BdrvDirtyBitmap
*bitmap
);
37 int64_t bdrv_dirty_bitmap_size(const BdrvDirtyBitmap
*bitmap
);
38 DirtyBitmapStatus
bdrv_dirty_bitmap_status(BdrvDirtyBitmap
*bitmap
);
39 int bdrv_get_dirty(BlockDriverState
*bs
, BdrvDirtyBitmap
*bitmap
,
41 void bdrv_set_dirty_bitmap(BdrvDirtyBitmap
*bitmap
,
42 int64_t cur_sector
, int64_t nr_sectors
);
43 void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap
*bitmap
,
44 int64_t cur_sector
, int64_t nr_sectors
);
45 int bdrv_dirty_bitmap_get_meta(BlockDriverState
*bs
,
46 BdrvDirtyBitmap
*bitmap
, int64_t sector
,
48 void bdrv_dirty_bitmap_reset_meta(BlockDriverState
*bs
,
49 BdrvDirtyBitmap
*bitmap
, int64_t sector
,
51 BdrvDirtyBitmapIter
*bdrv_dirty_meta_iter_new(BdrvDirtyBitmap
*bitmap
);
52 BdrvDirtyBitmapIter
*bdrv_dirty_iter_new(BdrvDirtyBitmap
*bitmap
,
53 uint64_t first_sector
);
54 void bdrv_dirty_iter_free(BdrvDirtyBitmapIter
*iter
);
55 int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter
*iter
);
56 void bdrv_set_dirty_iter(BdrvDirtyBitmapIter
*hbi
, int64_t sector_num
);
57 int64_t bdrv_get_dirty_count(BdrvDirtyBitmap
*bitmap
);
58 int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap
*bitmap
);
59 void bdrv_dirty_bitmap_truncate(BlockDriverState
*bs
);
61 uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap
*bitmap
,
62 uint64_t start
, uint64_t count
);
63 uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap
*bitmap
);
64 void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap
*bitmap
,
65 uint8_t *buf
, uint64_t start
,
67 void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap
*bitmap
,
68 uint8_t *buf
, uint64_t start
,
69 uint64_t count
, bool finish
);
70 void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap
*bitmap
,
71 uint64_t start
, uint64_t count
,
73 void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap
*bitmap
);