1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef BLOCK_COPY_H
16#define BLOCK_COPY_H
17
18#include "block/block.h"
19#include "qemu/co-shared-resource.h"
20
21typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque);
22typedef struct BlockCopyState BlockCopyState;
23
24BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
25 int64_t cluster_size,
26 BdrvRequestFlags write_flags,
27 Error **errp);
28
29void block_copy_set_progress_callback(
30 BlockCopyState *s,
31 ProgressBytesCallbackFunc progress_bytes_callback,
32 void *progress_opaque);
33
34void block_copy_set_progress_meter(BlockCopyState *s, ProgressMeter *pm);
35
36void block_copy_state_free(BlockCopyState *s);
37
38int64_t block_copy_reset_unallocated(BlockCopyState *s,
39 int64_t offset, int64_t *count);
40
41int coroutine_fn block_copy(BlockCopyState *s, int64_t offset, int64_t bytes,
42 bool *error_is_read);
43
44BdrvDirtyBitmap *block_copy_dirty_bitmap(BlockCopyState *s);
45void block_copy_set_skip_unallocated(BlockCopyState *s, bool skip);
46
47#endif
48