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_release_persistent_dirty_bitmaps(BlockDriverState
*bs
);
29 void bdrv_remove_persistent_dirty_bitmap(BlockDriverState
*bs
,
32 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap
*bitmap
);
33 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap
*bitmap
);
34 BlockDirtyInfoList
*bdrv_query_dirty_bitmaps(BlockDriverState
*bs
);
35 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState
*bs
);
36 uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap
*bitmap
);
37 bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap
*bitmap
);
38 bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap
*bitmap
);
39 const char *bdrv_dirty_bitmap_name(const BdrvDirtyBitmap
*bitmap
);
40 int64_t bdrv_dirty_bitmap_size(const BdrvDirtyBitmap
*bitmap
);
41 DirtyBitmapStatus
bdrv_dirty_bitmap_status(BdrvDirtyBitmap
*bitmap
);
42 void bdrv_set_dirty_bitmap(BdrvDirtyBitmap
*bitmap
,
43 int64_t offset
, int64_t bytes
);
44 void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap
*bitmap
,
45 int64_t offset
, int64_t bytes
);
46 BdrvDirtyBitmapIter
*bdrv_dirty_meta_iter_new(BdrvDirtyBitmap
*bitmap
);
47 BdrvDirtyBitmapIter
*bdrv_dirty_iter_new(BdrvDirtyBitmap
*bitmap
);
48 void bdrv_dirty_iter_free(BdrvDirtyBitmapIter
*iter
);
50 uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap
*bitmap
,
51 uint64_t offset
, uint64_t bytes
);
52 uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap
*bitmap
);
53 void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap
*bitmap
,
54 uint8_t *buf
, uint64_t offset
,
56 void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap
*bitmap
,
57 uint8_t *buf
, uint64_t offset
,
58 uint64_t bytes
, bool finish
);
59 void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap
*bitmap
,
60 uint64_t offset
, uint64_t bytes
,
62 void bdrv_dirty_bitmap_deserialize_ones(BdrvDirtyBitmap
*bitmap
,
63 uint64_t offset
, uint64_t bytes
,
65 void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap
*bitmap
);
67 void bdrv_dirty_bitmap_set_readonly(BdrvDirtyBitmap
*bitmap
, bool value
);
68 void bdrv_dirty_bitmap_set_autoload(BdrvDirtyBitmap
*bitmap
, bool autoload
);
69 void bdrv_dirty_bitmap_set_persistance(BdrvDirtyBitmap
*bitmap
,
72 /* Functions that require manual locking. */
73 void bdrv_dirty_bitmap_lock(BdrvDirtyBitmap
*bitmap
);
74 void bdrv_dirty_bitmap_unlock(BdrvDirtyBitmap
*bitmap
);
75 bool bdrv_get_dirty_locked(BlockDriverState
*bs
, BdrvDirtyBitmap
*bitmap
,
77 void bdrv_set_dirty_bitmap_locked(BdrvDirtyBitmap
*bitmap
,
78 int64_t offset
, int64_t bytes
);
79 void bdrv_reset_dirty_bitmap_locked(BdrvDirtyBitmap
*bitmap
,
80 int64_t offset
, int64_t bytes
);
81 int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter
*iter
);
82 void bdrv_set_dirty_iter(BdrvDirtyBitmapIter
*hbi
, int64_t offset
);
83 int64_t bdrv_get_dirty_count(BdrvDirtyBitmap
*bitmap
);
84 int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap
*bitmap
);
85 void bdrv_dirty_bitmap_truncate(BlockDriverState
*bs
, int64_t bytes
);
86 bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap
*bitmap
);
87 bool bdrv_has_readonly_bitmaps(BlockDriverState
*bs
);
88 bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap
*bitmap
);
89 bool bdrv_dirty_bitmap_get_persistance(BdrvDirtyBitmap
*bitmap
);
90 bool bdrv_has_changed_persistent_bitmaps(BlockDriverState
*bs
);
91 BdrvDirtyBitmap
*bdrv_dirty_bitmap_next(BlockDriverState
*bs
,
92 BdrvDirtyBitmap
*bitmap
);
93 char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap
*bitmap
, Error
**errp
);