From 193cf9be4bed56e47797baa1774cc81d7d76e242 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 31 Dec 2019 17:16:25 -0500 Subject: [PATCH] libext2fs: use __u64 instead of ext2_off64_t in qcow.c The type ext2_off64_t should only be used in the context of the ext2fs library's llseek() and ftruncate() analogs, ext2_file_llseek() and ext2_inode_set_size(). That's because like the POSIX.1's off_t, it needs to be a signed integer value so that SEEK_END will work correctly. qcow.c's use of ext2_off64_t is only internal, and not in any exposed interfaces, so changes nothing; it just prepares us to be able to change the type of ext2_off64_t. Signed-off-by: Theodore Ts'o --- lib/ext2fs/qcow2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c index 71a4792..ee701f7 100644 --- a/lib/ext2fs/qcow2.c +++ b/lib/ext2fs/qcow2.c @@ -114,7 +114,7 @@ static int qcow2_read_l1_table(struct ext2_qcow2_image *img) } static int qcow2_read_l2_table(struct ext2_qcow2_image *img, - ext2_off64_t offset, blk64_t **l2_table) + __u64 offset, blk64_t **l2_table) { int fd = img->fd; size_t size; @@ -131,8 +131,8 @@ static int qcow2_read_l2_table(struct ext2_qcow2_image *img, return 0; } -static int qcow2_copy_data(int fdin, int fdout, ext2_off64_t off_in, - ext2_off64_t off_out, void *buf, size_t count) +static int qcow2_copy_data(int fdin, int fdout, __u64 off_in, + __u64 off_out, void *buf, size_t count) { size_t size; @@ -162,7 +162,7 @@ int qcow2_write_raw_image(int qcow2_fd, int raw_fd, struct ext2_qcow2_image img; errcode_t ret = 0; unsigned int l1_index, l2_index; - ext2_off64_t offset; + __u64 offset; blk64_t *l1_table, *l2_table = NULL; void *copy_buf = NULL; size_t size; @@ -212,7 +212,7 @@ int qcow2_write_raw_image(int qcow2_fd, int raw_fd, l1_table = img.l1_table; /* Walk through l1 table */ for (l1_index = 0; l1_index < img.l1_size; l1_index++) { - ext2_off64_t off_out; + __u64 off_out; offset = ext2fs_be64_to_cpu(l1_table[l1_index]) & ~QCOW_OFLAG_COPIED; -- 1.8.3.1