blob: 23aa86c0fb0059547b455281756b4b03b8c9c648 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From 683d0c525765415be34c269edf9cc066276f9f65 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 18 Dec 2022 13:53:51 -0800
4Subject: [PATCH] Replace off64_t with off_t
5
6AC_SYS_LARGEFILE autoconf macro is in use in configure script which will
7add needed feature macros on commandline to enable 64bit off_t.
8
9Also replace lseek64 with lseek, since it will be same when
10_FILE_OFFSET_BITS=64 is defined on relevant platforms via AC_SYS_LARGEFILE
11
12Upstream-Status: Submitted [https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/467]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 lib/utils.c | 4 ++--
16 lib/utils_wipe.c | 4 ++--
17 src/utils_reencrypt_luks1.c | 12 ++++++------
18 3 files changed, 10 insertions(+), 10 deletions(-)
19
20diff --git a/lib/utils.c b/lib/utils.c
21index 9d79ee29..be5f5287 100644
22--- a/lib/utils.c
23+++ b/lib/utils.c
24@@ -102,9 +102,9 @@ static int keyfile_seek(int fd, uint64_t bytes)
25 char tmp[BUFSIZ];
26 size_t next_read;
27 ssize_t bytes_r;
28- off64_t r;
29+ off_t r;
30
31- r = lseek64(fd, bytes, SEEK_CUR);
32+ r = lseek(fd, bytes, SEEK_CUR);
33 if (r > 0)
34 return 0;
35 if (r < 0 && errno != ESPIPE)
36diff --git a/lib/utils_wipe.c b/lib/utils_wipe.c
37index 285a9e77..0c376f44 100644
38--- a/lib/utils_wipe.c
39+++ b/lib/utils_wipe.c
40@@ -150,7 +150,7 @@ static int wipe_block(struct crypt_device *cd, int devfd, crypt_wipe_pattern pat
41 if (blockdev && pattern == CRYPT_WIPE_ZERO &&
42 !wipe_zeroout(cd, devfd, offset, wipe_block_size)) {
43 /* zeroout ioctl does not move offset */
44- if (lseek64(devfd, offset + wipe_block_size, SEEK_SET) < 0) {
45+ if (lseek(devfd, offset + wipe_block_size, SEEK_SET) < 0) {
46 log_err(cd, _("Cannot seek to device offset."));
47 return -EINVAL;
48 }
49@@ -221,7 +221,7 @@ int crypt_wipe_device(struct crypt_device *cd,
50 if (r)
51 goto out;
52
53- if (lseek64(devfd, offset, SEEK_SET) < 0) {
54+ if (lseek(devfd, offset, SEEK_SET) < 0) {
55 log_err(cd, _("Cannot seek to device offset."));
56 r = -EINVAL;
57 goto out;
58diff --git a/src/utils_reencrypt_luks1.c b/src/utils_reencrypt_luks1.c
59index 96368bdb..d83a1da4 100644
60--- a/src/utils_reencrypt_luks1.c
61+++ b/src/utils_reencrypt_luks1.c
62@@ -729,8 +729,8 @@ static int copy_data_forward(struct reenc_ctx *rc, int fd_old, int fd_new,
63
64 log_dbg("Reencrypting in forward direction.");
65
66- if (lseek64(fd_old, rc->device_offset, SEEK_SET) < 0 ||
67- lseek64(fd_new, rc->device_offset, SEEK_SET) < 0) {
68+ if (lseek(fd_old, rc->device_offset, SEEK_SET) < 0 ||
69+ lseek(fd_new, rc->device_offset, SEEK_SET) < 0) {
70 log_err(_("Cannot seek to device offset."));
71 goto out;
72 }
73@@ -788,7 +788,7 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new,
74 size_t block_size, void *buf, uint64_t *bytes)
75 {
76 ssize_t s1, s2, working_block;
77- off64_t working_offset;
78+ off_t working_offset;
79 int r = -EIO;
80 char *backing_file = NULL;
81 struct tools_progress_params prog_parms = {
82@@ -827,8 +827,8 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new,
83 working_block = block_size;
84 }
85
86- if (lseek64(fd_old, working_offset, SEEK_SET) < 0 ||
87- lseek64(fd_new, working_offset, SEEK_SET) < 0) {
88+ if (lseek(fd_old, working_offset, SEEK_SET) < 0 ||
89+ lseek(fd_new, working_offset, SEEK_SET) < 0) {
90 log_err(_("Cannot seek to device offset."));
91 goto out;
92 }
93@@ -874,7 +874,7 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf,
94
95 log_dbg("Zeroing rest of device.");
96
97- if (lseek64(fd, offset, SEEK_SET) < 0) {
98+ if (lseek(fd, offset, SEEK_SET) < 0) {
99 log_dbg("Cannot seek to device offset.");
100 return;
101 }