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
21
22
23typedef void (*BlockCopyAsyncCallbackFunc)(void *opaque);
24typedef struct BlockCopyState BlockCopyState;
25typedef struct BlockCopyCallState BlockCopyCallState;
26
27BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
28 const BdrvDirtyBitmap *bitmap,
29 Error **errp);
30
31
32void block_copy_set_copy_opts(BlockCopyState *s, bool use_copy_range,
33 bool compress);
34void block_copy_set_progress_meter(BlockCopyState *s, ProgressMeter *pm);
35
36void block_copy_state_free(BlockCopyState *s);
37
38void block_copy_reset(BlockCopyState *s, int64_t offset, int64_t bytes);
39int64_t block_copy_reset_unallocated(BlockCopyState *s,
40 int64_t offset, int64_t *count);
41
42int coroutine_fn block_copy(BlockCopyState *s, int64_t offset, int64_t bytes,
43 bool ignore_ratelimit, uint64_t timeout_ns,
44 BlockCopyAsyncCallbackFunc cb,
45 void *cb_opaque);
46
47
48
49
50
51
52
53
54
55
56
57
58
59BlockCopyCallState *block_copy_async(BlockCopyState *s,
60 int64_t offset, int64_t bytes,
61 int max_workers, int64_t max_chunk,
62 BlockCopyAsyncCallbackFunc cb,
63 void *cb_opaque);
64
65
66
67
68
69void block_copy_call_free(BlockCopyCallState *call_state);
70
71
72
73
74
75bool block_copy_call_finished(BlockCopyCallState *call_state);
76bool block_copy_call_succeeded(BlockCopyCallState *call_state);
77bool block_copy_call_failed(BlockCopyCallState *call_state);
78bool block_copy_call_cancelled(BlockCopyCallState *call_state);
79int block_copy_call_status(BlockCopyCallState *call_state, bool *error_is_read);
80
81void block_copy_set_speed(BlockCopyState *s, uint64_t speed);
82void block_copy_kick(BlockCopyCallState *call_state);
83
84
85
86
87
88
89
90
91
92
93
94void block_copy_call_cancel(BlockCopyCallState *call_state);
95
96BdrvDirtyBitmap *block_copy_dirty_bitmap(BlockCopyState *s);
97int64_t block_copy_cluster_size(BlockCopyState *s);
98void block_copy_set_skip_unallocated(BlockCopyState *s, bool skip);
99
100#endif
101