Merge remote-tracking branch 'remotes/elmarco/tags/leak-pull-request' into staging
[qemu/ar7.git] / include / block / dirty-bitmap.h
blob9dea14ba03e3424e5996c522d5d7b67643bd90ff
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,
8 uint32_t granularity,
9 const char *name,
10 Error **errp);
11 void bdrv_create_meta_dirty_bitmap(BdrvDirtyBitmap *bitmap,
12 int chunk_size);
13 void bdrv_release_meta_dirty_bitmap(BdrvDirtyBitmap *bitmap);
14 int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
15 BdrvDirtyBitmap *bitmap,
16 Error **errp);
17 BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,
18 BdrvDirtyBitmap *bitmap,
19 Error **errp);
20 BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap(BlockDriverState *bs,
21 BdrvDirtyBitmap *bitmap,
22 Error **errp);
23 BdrvDirtyBitmap *bdrv_find_dirty_bitmap(BlockDriverState *bs,
24 const char *name);
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,
40 int64_t sector);
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,
47 int nb_sectors);
48 void bdrv_dirty_bitmap_reset_meta(BlockDriverState *bs,
49 BdrvDirtyBitmap *bitmap, int64_t sector,
50 int nb_sectors);
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,
66 uint64_t count);
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,
72 bool finish);
73 void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);
75 #endif