summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2020-03-11 13:30:01 +0300
committerMax Reitz <mreitz@redhat.com>2020-03-11 12:42:30 +0100
commitdafaf13593de240724a210e72da66f9d162735c3 (patch)
treef5cab9399e367e1ae2dc4e41a5a19adeca9a0140 /include
parent17187cb646913356bbd434bebdcddf43f92ce31a (diff)
downloadqemu-dafaf13593de240724a210e72da66f9d162735c3.zip
block/block-copy: refactor interfaces to use bytes instead of end
We have a lot of "chunk_end - start" invocations, let's switch to bytes/cur_bytes scheme instead. While being here, improve check on block_copy_do_copy parameters to not overflow when calculating nbytes and use int64_t for bytes in block_copy for consistency. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200311103004.7649-7-vsementsov@virtuozzo.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block-copy.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/block/block-copy.h b/include/block/block-copy.h
index 9def00068c..7fd36e528b 100644
--- a/include/block/block-copy.h
+++ b/include/block/block-copy.h
@@ -19,8 +19,8 @@
#include "qemu/co-shared-resource.h"
typedef struct BlockCopyInFlightReq {
- int64_t start_byte;
- int64_t end_byte;
+ int64_t start;
+ int64_t bytes;
QLIST_ENTRY(BlockCopyInFlightReq) list;
CoQueue wait_queue; /* coroutines blocked on this request */
} BlockCopyInFlightReq;
@@ -85,7 +85,7 @@ void block_copy_state_free(BlockCopyState *s);
int64_t block_copy_reset_unallocated(BlockCopyState *s,
int64_t offset, int64_t *count);
-int coroutine_fn block_copy(BlockCopyState *s, int64_t start, uint64_t bytes,
+int coroutine_fn block_copy(BlockCopyState *s, int64_t start, int64_t bytes,
bool *error_is_read);
#endif /* BLOCK_COPY_H */