xref: /openbmc/qemu/include/block/dirty-bitmap.h (revision e09484ef)
1 #ifndef BLOCK_DIRTY_BITMAP_H
2 #define BLOCK_DIRTY_BITMAP_H
3 
4 #include "qemu-common.h"
5 #include "qemu/hbitmap.h"
6 
7 BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
8                                           uint32_t granularity,
9                                           const char *name,
10                                           Error **errp);
11 int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
12                                        BdrvDirtyBitmap *bitmap,
13                                        Error **errp);
14 BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,
15                                             BdrvDirtyBitmap *bitmap,
16                                             Error **errp);
17 BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap(BlockDriverState *bs,
18                                            BdrvDirtyBitmap *bitmap,
19                                            Error **errp);
20 BdrvDirtyBitmap *bdrv_find_dirty_bitmap(BlockDriverState *bs,
21                                         const char *name);
22 void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap *bitmap);
23 void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap);
24 void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs);
25 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
26 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
27 BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
28 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
29 uint32_t bdrv_dirty_bitmap_granularity(BdrvDirtyBitmap *bitmap);
30 bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap);
31 bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap *bitmap);
32 DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap);
33 int bdrv_get_dirty(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
34                    int64_t sector);
35 void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap,
36                            int64_t cur_sector, int64_t nr_sectors);
37 void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap,
38                              int64_t cur_sector, int64_t nr_sectors);
39 void bdrv_dirty_iter_init(BdrvDirtyBitmap *bitmap, struct HBitmapIter *hbi);
40 void bdrv_set_dirty_iter(struct HBitmapIter *hbi, int64_t offset);
41 int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap);
42 void bdrv_dirty_bitmap_truncate(BlockDriverState *bs);
43 
44 #endif
45