Skip to contentSkip to conversation

mdadm: Use _FILE_OFFSET_BITS to use largefile support

PATCH In review Khem Raj 4 participants 16 messages Dec 1, 2022 – Dec 6, 2022 1 message not in the archive

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/6 mdadm: Use _FILE_OFFSET_BITS to use largefile support

---
 ...FILE_OFFSET_BITS-to-enable-largefile.patch | 147 ++++++++++++++++++
 meta/recipes-extended/mdadm/mdadm_4.2.bb      |   1 +
 2 files changed, 148 insertions(+)
 create mode 100644 meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch
meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch new file +147 -0
new file mode 100644
index 0000000000..142ed355ef
@@ -0,0 +1,147 @@
+From 6b861a267a6ef6f60f6cc21e4c8e6d7cdd2451dc Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 10 Nov 2022 12:31:22 -0800
+Subject: [PATCH] restripe.c: Use _FILE_OFFSET_BITS to enable largefile support
+
+Instead of using the lseek64 and friends, its better to enable it via
+the feature macro _FILE_OFFSET_BITS = 64 and let the C library deal with
+the width of types
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-raid/[email protected]/]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ restripe.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/restripe.c
++++ b/restripe.c
+@@ -22,6 +22,9 @@
+  *    Email: <[email protected]>
+  */
+ 
++/* Enable largefile support */
++#define _FILE_OFFSET_BITS 64
++
+ #include "mdadm.h"
+ #include <stdint.h>
+ 
+@@ -581,7 +584,7 @@ int save_stripes(int *source, unsigned l
+ 				       raid_disks, level, layout);
+ 			if (dnum < 0) abort();
+ 			if (source[dnum] < 0 ||
+-			    lseek64(source[dnum],
++			    lseek(source[dnum],
+ 				    offsets[dnum] + offset, 0) < 0 ||
+ 			    read(source[dnum], buf+disk * chunk_size,
+ 				 chunk_size) != chunk_size) {
+@@ -754,8 +757,8 @@ int restore_stripes(int *dest, unsigned
+ 					   raid_disks, level, layout);
+ 			if (src_buf == NULL) {
+ 				/* read from file */
+-				if (lseek64(source, read_offset, 0) !=
+-					 (off64_t)read_offset) {
++				if (lseek(source, read_offset, 0) !=
++					 (off_t)read_offset) {
+ 					rv = -1;
+ 					goto abort;
+ 				}
+@@ -816,7 +819,7 @@ int restore_stripes(int *dest, unsigned
+ 		}
+ 		for (i=0; i < raid_disks ; i++)
+ 			if (dest[i] >= 0) {
+-				if (lseek64(dest[i],
++				if (lseek(dest[i],
+ 					 offsets[i]+offset, 0) < 0) {
+ 					rv = -1;
+ 					goto abort;
+@@ -866,7 +869,7 @@ int test_stripes(int *source, unsigned l
+ 		int disk;
+ 
+ 		for (i = 0 ; i < raid_disks ; i++) {
+-			if ((lseek64(source[i], offsets[i]+start, 0) < 0) ||
++			if ((lseek(source[i], offsets[i]+start, 0) < 0) ||
+ 			    (read(source[i], stripes[i], chunk_size) !=
+ 			     chunk_size)) {
+ 				free(q);
+--- a/raid6check.c
++++ b/raid6check.c
+@@ -22,6 +22,9 @@
+  *    Based on "restripe.c" from "mdadm" codebase
+  */
+ 
++/* Enable largefile support */
++#define _FILE_OFFSET_BITS 64
++
+ #include "mdadm.h"
+ #include <stdint.h>
+ #include <signal.h>
+@@ -279,9 +282,9 @@ int manual_repair(int chunk_size, int sy
+ 	}
+ 
+ 	int write_res1, write_res2;
+-	off64_t seek_res;
++	off_t seek_res;
+ 
+-	seek_res = lseek64(source[fd1],
++	seek_res = lseek(source[fd1],
+ 			   offsets[fd1] + start * chunk_size, SEEK_SET);
+ 	if (seek_res < 0) {
+ 		fprintf(stderr, "lseek failed for failed_disk1\n");
+@@ -289,7 +292,7 @@ int manual_repair(int chunk_size, int sy
+ 	}
+ 	write_res1 = write(source[fd1], blocks[failed_slot1], chunk_size);
+ 
+-	seek_res = lseek64(source[fd2],
++	seek_res = lseek(source[fd2],
+ 			   offsets[fd2] + start * chunk_size, SEEK_SET);
+ 	if (seek_res < 0) {
+ 		fprintf(stderr, "lseek failed for failed_disk2\n");
+@@ -374,7 +377,7 @@ int check_stripes(struct mdinfo *info, i
+ 			goto exitCheck;
+ 		}
+ 		for (i = 0 ; i < raid_disks ; i++) {
+-			off64_t seek_res = lseek64(source[i], offsets[i] + start * chunk_size,
++			off_t seek_res = lseek(source[i], offsets[i] + start * chunk_size,
+ 						   SEEK_SET);
+ 			if (seek_res < 0) {
+ 				fprintf(stderr, "lseek to source %d failed\n", i);
+--- a/swap_super.c
++++ b/swap_super.c
+@@ -1,3 +1,6 @@
++/* Enable largefile support */
++#define _FILE_OFFSET_BITS 64
++
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+@@ -16,8 +19,6 @@
+ 
+ #define MD_NEW_SIZE_SECTORS(x)		((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
+ 
+-extern long long lseek64(int, long long, int);
+-
+ int main(int argc, char *argv[])
+ {
+ 	int fd, i;
+@@ -38,8 +39,8 @@ int main(int argc, char *argv[])
+ 		exit(1);
+ 	}
+ 	offset = MD_NEW_SIZE_SECTORS(size) * 512LL;
+-	if (lseek64(fd, offset, 0) < 0LL) {
+-		perror("lseek64");
++	if (lseek(fd, offset, 0) < 0LL) {
++		perror("lseek");
+ 		exit(1);
+ 	}
+ 	if (read(fd, super, 4096) != 4096) {
+@@ -68,8 +69,8 @@ int main(int argc, char *argv[])
+ 		super[32*4+10*4 +i] = t;
+ 	}
+ 
+-	if (lseek64(fd, offset, 0) < 0LL) {
+-		perror("lseek64");
++	if (lseek(fd, offset, 0) < 0LL) {
++		perror("lseek");
+ 		exit(1);
+ 	}
+ 	if (write(fd, super, 4096) != 4096) {
meta/recipes-extended/mdadm/mdadm_4.2.bb +1 -0
index 19035caaec..7298860241 100644
@@ -24,6 +24,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
            file://0001-mdadm-skip-test-11spare-migration.patch \
            file://0001-Fix-parsing-of-r-in-monitor-manager-mode.patch \
            file://0001-Makefile-install-mdcheck.patch \
+           file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \
            "
 
 SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
Signature · 1 line
2.38.1
author
#1 lore raw

PATCH 2/6 acl: Enable largefile support by default

This ensures right flags are passed so enable it. Musl and decoupled these APIs from _GNU_SOURCE and now are only available when _LARGEFILE64_SOURCE macro is enabled

---
 ...rtable-version-of-dirent-and-readdir.patch | 39 +++++++++++++++++++
 meta/recipes-support/attr/acl_2.3.1.bb        |  3 ++
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch
meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch new file +39 -0
new file mode 100644
index 0000000000..c51b90216f
@@ -0,0 +1,39 @@
+From 1a5671a4eb13b81b98c3e71f00370781563f66d8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 10 Nov 2022 17:57:24 -0800
+Subject: [PATCH] chacl: Use portable version of dirent and readdir
+
+Using 64bit versions on 32bit architectures should be enabled with
+--enable-largefile, this makes it portable across musl and glibc
+
+Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/acl-devel/2022-11/msg00005.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/chacl.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/chacl.c b/tools/chacl.c
+index 525a7ff..8fff875 100644
+--- a/tools/chacl.c
++++ b/tools/chacl.c
+@@ -320,7 +320,7 @@ walk_dir(acl_t acl, acl_t dacl, const char *fname)
+ {
+ 	int failed = 0;
+ 	DIR *dir;
+-	struct dirent64 *d;
++	struct dirent *d;
+ 	char *name;
+ 
+ 	if ((dir = opendir(fname)) == NULL) {
+@@ -332,7 +332,7 @@ walk_dir(acl_t acl, acl_t dacl, const char *fname)
+ 		return(0);	/* got a file, not an error */
+ 	}
+ 
+-	while ((d = readdir64(dir)) != NULL) {
++	while ((d = readdir(dir)) != NULL) {
+ 		/* skip "." and ".." entries */
+ 		if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0)
+ 			continue;
+-- 
+2.38.1
+
meta/recipes-support/attr/acl_2.3.1.bb +3 -0
index aca04a9aac..5fb8f9ae35 100644
@@ -19,12 +19,15 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/acl/${BP}.tar.gz \
            file://run-ptest \
            file://0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch \
            file://0001-test-patch-out-failing-bits.patch \
+           file://0001-chacl-Use-portable-version-of-dirent-and-readdir.patch \
            "
 
 SRC_URI[sha256sum] = "760c61c68901b37fdd5eefeeaf4c0c7a26bdfdd8ac747a1edff1ce0e243c11af"
 
 inherit autotools gettext ptest
 
+EXTRA_OECONF += "--enable-largefile"
+
 PACKAGES =+ "lib${BPN}"
 
 FILES:lib${BPN} = "${libdir}/lib*${SOLIBS}"
Signature · 1 line
2.38.1
#2 lore raw

Re: [OE-core] [PATCH 2/6] acl: Enable largefile support by default

Quoted 17 lines · Khem Raj

This ensures right flags are passed so enable it. Musl and decoupled these APIs from _GNU_SOURCE and now are only available when _LARGEFILE64_SOURCE macro is enabled

---
 ...rtable-version-of-dirent-and-readdir.patch | 39 +++++++++++++++++++
 meta/recipes-support/attr/acl_2.3.1.bb        |  3 ++
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch
meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch new file +0 -0
new file mode 100644
index 0000000000..c51b90216f

meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch line 10

Quoted 10 lines
meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch new file +10 -0
@@ -0,0 +1,39 @@
+From 1a5671a4eb13b81b98c3e71f00370781563f66d8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 10 Nov 2022 17:57:24 -0800
+Subject: [PATCH] chacl: Use portable version of dirent and readdir
+
+Using 64bit versions on 32bit architectures should be enabled with
+--enable-largefile, this makes it portable across musl and glibc
+
+Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/acl-devel/2022-11/msg00005.html]
+Signed-off-by: Khem Raj <[email protected]>

Now a backport:

https://git.savannah.nongnu.org/cgit/acl.git/commit/?id=2b42f64737adf6a2ddd491213580d6e9cdd2f5af

:)

Cheers,

Richard

author
#3 lore raw

PATCH 3/6 btrfs-tools: Do not use 64bit functions for largefile support

In reply to Khem Raj

Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave like 64bit variants. Moreover it makes them portable across libc

---
 ...-ftruncate-stat-instead-of-64bit-equ.patch | 903 ++++++++++++++++++
 .../btrfs-tools/btrfs-tools_6.0.1.bb          |   1 +
 2 files changed, 904 insertions(+)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch new file +903 -0
new file mode 100644
index 0000000000..9a8e24e457
@@ -0,0 +1,903 @@
+From 37425f422e46003ed623f8e6387bed1aa5778b96 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 11 Nov 2022 11:26:05 -0800
+Subject: [PATCH] Use pread/pwrite/ftruncate/stat instead of 64bit equivalents
+
+64bit functions are aliases to original functions when largefile feature
+is enabled via autoconf or right macro is passed on compiler cmdline
+
+-D_FILE_OFFSET_BITS=64
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ cmds/rescue-chunk-recover.c |   4 +-
+ image/main.c                |  14 +--
+ kernel-shared/zoned.c       |   6 +-
+ kernel-shared/zoned.h       |   4 +-
+ mkfs/main.c                 |   4 +-
+ mkfs/rootdir.c              |  10 +-
+ tests/fsstress.c            | 192 ++++++++++++++++++------------------
+ tests/fssum.c               |   8 +-
+ 8 files changed, 121 insertions(+), 121 deletions(-)
+
+--- a/cmds/rescue-chunk-recover.c
++++ b/cmds/rescue-chunk-recover.c
+@@ -755,7 +755,7 @@ static int scan_one_device(void *dev_sca
+ 		if (is_super_block_address(bytenr))
+ 			bytenr += rc->sectorsize;
+ 
+-		if (pread64(fd, buf->data, rc->nodesize, bytenr) <
++		if (pread(fd, buf->data, rc->nodesize, bytenr) <
+ 		    rc->nodesize)
+ 			break;
+ 
+@@ -1875,7 +1875,7 @@ static int check_one_csum(int fd, u64 st
+ 	data = malloc(len);
+ 	if (!data)
+ 		return -1;
+-	ret = pread64(fd, data, len, start);
++	ret = pread(fd, data, len, start);
+ 	if (ret < 0 || ret != len) {
+ 		ret = -1;
+ 		goto out;
+--- a/image/main.c
++++ b/image/main.c
+@@ -691,7 +691,7 @@ static int flush_pending(struct metadump
+ 		if (start == BTRFS_SUPER_INFO_OFFSET) {
+ 			int fd = get_dev_fd(md->root);
+ 
+-			ret = pread64(fd, async->buffer, size, start);
++			ret = pread(fd, async->buffer, size, start);
+ 			if (ret < size) {
+ 				free(async->buffer);
+ 				free(async);
+@@ -1366,7 +1366,7 @@ static void write_backup_supers(int fd,
+ 			break;
+ 		btrfs_set_super_bytenr(super, bytenr);
+ 		csum_block(buf, BTRFS_SUPER_INFO_SIZE);
+-		ret = pwrite64(fd, buf, BTRFS_SUPER_INFO_SIZE, bytenr);
++		ret = pwrite(fd, buf, BTRFS_SUPER_INFO_SIZE, bytenr);
+ 		if (ret < BTRFS_SUPER_INFO_SIZE) {
+ 			if (ret < 0)
+ 				error(
+@@ -1487,12 +1487,12 @@ static int restore_one_work(struct mdres
+ 				else
+ 					bytenr = logical;
+ 
+-				ret = pwrite64(outfd, buffer + offset, chunk_size, bytenr);
++				ret = pwrite(outfd, buffer + offset, chunk_size, bytenr);
+ 				if (ret != chunk_size)
+ 					goto write_error;
+ 
+ 				if (physical_dup)
+-					ret = pwrite64(outfd, buffer + offset,
++					ret = pwrite(outfd, buffer + offset,
+ 						       chunk_size, physical_dup);
+ 				if (ret != chunk_size)
+ 					goto write_error;
+@@ -2454,7 +2454,7 @@ static int fixup_device_size(struct btrf
+ 	}
+ 	if (S_ISREG(buf.st_mode)) {
+ 		/* Don't forget to enlarge the real file */
+-		ret = ftruncate64(out_fd, dev_size);
++		ret = ftruncate(out_fd, dev_size);
+ 		if (ret < 0) {
+ 			error("failed to enlarge result image: %m");
+ 			return -errno;
+@@ -2913,7 +2913,7 @@ static int restore_metadump(const char *
+ 			goto out;
+ 		}
+ 		if (S_ISREG(st.st_mode) && st.st_size < dev_size) {
+-			ret = ftruncate64(fileno(out), dev_size);
++			ret = ftruncate(fileno(out), dev_size);
+ 			if (ret < 0) {
+ 				error(
+ 		"failed to enlarge result image file from %llu to %llu: %m",
+@@ -3010,7 +3010,7 @@ static int update_disk_super_on_device(s
+ 	memcpy(dev_item->fsid, fs_uuid, BTRFS_UUID_SIZE);
+ 	csum_block((u8 *)&disk_super, BTRFS_SUPER_INFO_SIZE);
+ 
+-	ret = pwrite64(fp, &disk_super, BTRFS_SUPER_INFO_SIZE, BTRFS_SUPER_INFO_OFFSET);
++	ret = pwrite(fp, &disk_super, BTRFS_SUPER_INFO_SIZE, BTRFS_SUPER_INFO_OFFSET);
+ 	if (ret != BTRFS_SUPER_INFO_SIZE) {
+ 		if (ret < 0) {
+ 			errno = ret;
+--- a/kernel-shared/zoned.c
++++ b/kernel-shared/zoned.c
+@@ -194,7 +194,7 @@ static int sb_write_pointer(int fd, stru
+ 			bytenr = ((zones[i].start + zones[i].len)
+ 				   << SECTOR_SHIFT) - BTRFS_SUPER_INFO_SIZE;
+ 
+-			ret = pread64(fd, buf[i], BTRFS_SUPER_INFO_SIZE, bytenr);
++			ret = pread(fd, buf[i], BTRFS_SUPER_INFO_SIZE, bytenr);
+ 			if (ret != BTRFS_SUPER_INFO_SIZE)
+ 				return -EIO;
+ 			super[i] = (struct btrfs_super_block *)&buf[i];
+@@ -515,8 +515,8 @@ size_t btrfs_sb_io(int fd, void *buf, of
+ 	/* We can call pread/pwrite if 'fd' is non-zoned device/file */
+ 	if (zone_size_sector == 0) {
+ 		if (rw == READ)
+-			return pread64(fd, buf, count, offset);
+-		return pwrite64(fd, buf, count, offset);
++			return pread(fd, buf, count, offset);
++		return pwrite(fd, buf, count, offset);
+ 	}
+ 
+ 	ASSERT(IS_ALIGNED(zone_size_sector, sb_size_sector));
+--- a/kernel-shared/zoned.h
++++ b/kernel-shared/zoned.h
+@@ -150,9 +150,9 @@ int btrfs_wipe_temporary_sb(struct btrfs
+ #else
+ 
+ #define sbread(fd, buf, offset) \
+-	pread64(fd, buf, BTRFS_SUPER_INFO_SIZE, offset)
++	pread(fd, buf, BTRFS_SUPER_INFO_SIZE, offset)
+ #define sbwrite(fd, buf, offset) \
+-	pwrite64(fd, buf, BTRFS_SUPER_INFO_SIZE, offset)
++	pwrite(fd, buf, BTRFS_SUPER_INFO_SIZE, offset)
+ 
+ static inline int btrfs_reset_dev_zone(int fd, struct blk_zone *zone)
+ {
+--- a/mkfs/main.c
++++ b/mkfs/main.c
+@@ -453,14 +453,14 @@ static int zero_output_file(int out_fd,
+ 	/* Only zero out the first 1M */
+ 	loop_num = SZ_1M / SZ_4K;
+ 	for (i = 0; i < loop_num; i++) {
+-		written = pwrite64(out_fd, buf, SZ_4K, location);
++		written = pwrite(out_fd, buf, SZ_4K, location);
+ 		if (written != SZ_4K)
+ 			ret = -EIO;
+ 		location += SZ_4K;
+ 	}
+ 
+ 	/* Then enlarge the file to size */
+-	written = pwrite64(out_fd, buf, 1, size - 1);
++	written = pwrite(out_fd, buf, 1, size - 1);
+ 	if (written < 1)
+ 		ret = -EIO;
+ 	return ret;
+--- a/mkfs/rootdir.c
++++ b/mkfs/rootdir.c
+@@ -340,7 +340,7 @@ static int add_file_items(struct btrfs_t
+ 			goto end;
+ 		}
+ 
+-		ret_read = pread64(fd, buffer, st->st_size, bytes_read);
++		ret_read = pread(fd, buffer, st->st_size, bytes_read);
+ 		if (ret_read == -1) {
+ 			error("cannot read %s at offset %llu length %llu: %m",
+ 				path_name, bytes_read, (unsigned long long)st->st_size);
+@@ -386,7 +386,7 @@ again:
+ 
+ 		memset(eb->data, 0, sectorsize);
+ 
+-		ret_read = pread64(fd, eb->data, sectorsize, file_pos +
++		ret_read = pread(fd, eb->data, sectorsize, file_pos +
+ 				   bytes_read);
+ 		if (ret_read == -1) {
+ 			error("cannot read %s at offset %llu length %u: %m",
+@@ -929,7 +929,7 @@ int btrfs_mkfs_shrink_fs(struct btrfs_fs
+ 	u64 new_size;
+ 	struct btrfs_device *device;
+ 	struct list_head *cur;
+-	struct stat64 file_stat;
++	struct stat file_stat;
+ 	int nr_devs = 0;
+ 	int ret;
+ 
+@@ -963,14 +963,14 @@ int btrfs_mkfs_shrink_fs(struct btrfs_fs
+ 		*new_size_ret = new_size;
+ 
+ 	if (shrink_file_size) {
+-		ret = fstat64(device->fd, &file_stat);
++		ret = fstat(device->fd, &file_stat);
+ 		if (ret < 0) {
+ 			error("failed to stat devid %llu: %m", device->devid);
+ 			return ret;
+ 		}
+ 		if (!S_ISREG(file_stat.st_mode))
+ 			return ret;
+-		ret = ftruncate64(device->fd, new_size);
++		ret = ftruncate(device->fd, new_size);
+ 		if (ret < 0) {
+ 			error("failed to truncate device file of devid %llu: %m",
+ 				device->devid);
+--- a/tests/fsstress.c
++++ b/tests/fsstress.c
+@@ -458,7 +458,7 @@ int	get_fname(int, long, pathname_t *, f
+ void	init_pathname(pathname_t *);
+ int	lchown_path(pathname_t *, uid_t, gid_t);
+ int	link_path(pathname_t *, pathname_t *);
+-int	lstat64_path(pathname_t *, struct stat64 *);
++int	lstat_path(pathname_t *, struct stat *);
+ void	make_freq_table(void);
+ int	mkdir_path(pathname_t *, mode_t);
+ int	mknod_path(pathname_t *, mode_t, dev_t);
+@@ -472,9 +472,9 @@ int	rename_path(pathname_t *, pathname_t
+ int	rmdir_path(pathname_t *);
+ void	separate_pathname(pathname_t *, char *, pathname_t *);
+ void	show_ops(int, char *);
+-int	stat64_path(pathname_t *, struct stat64 *);
++int	stat_path(pathname_t *, struct stat *);
+ int	symlink_path(const char *, pathname_t *);
+-int	truncate64_path(pathname_t *, off64_t);
++int	truncate_path(pathname_t *, off64_t);
+ int	unlink_path(pathname_t *);
+ void	usage(void);
+ void	write_freq(void);
+@@ -998,12 +998,12 @@ void
+ check_cwd(void)
+ {
+ #ifdef DEBUG
+-	struct stat64	statbuf;
++	struct stat	statbuf;
+ 	int ret;
+ 
+-	ret = stat64(".", &statbuf);
++	ret = stat(".", &statbuf);
+ 	if (ret != 0) {
+-		fprintf(stderr, "fsstress: check_cwd stat64() returned %d with errno: %d (%m)\n",
++		fprintf(stderr, "fsstress: check_cwd stat() returned %d with errno: %d (%m)\n",
+ 			ret, errno);
+ 		goto out;
+ 	}
+@@ -1171,7 +1171,7 @@ again:
+ void
+ doproc(void)
+ {
+-	struct stat64	statbuf;
++	struct stat	statbuf;
+ 	char		buf[10];
+ 	char		cmd[64];
+ 	opnum_t		opno;
+@@ -1182,7 +1182,7 @@ doproc(void)
+ 	dividend = (operations + execute_freq) / (execute_freq + 1);
+ 	sprintf(buf, "p%x", procid);
+ 	(void)mkdir(buf, 0777);
+-	if (chdir(buf) < 0 || stat64(".", &statbuf) < 0) {
++	if (chdir(buf) < 0 || stat(".", &statbuf) < 0) {
+ 		perror(buf);
+ 		_exit(1);
+ 	}
+@@ -1214,7 +1214,7 @@ doproc(void)
+ 		 * the forced shutdown happened.
+ 		 */
+ 		if (errtag != 0 && opno % 100 == 0)  {
+-			rval = stat64(".", &statbuf);
++			rval = stat(".", &statbuf);
+ 			if (rval == EIO)  {
+ 				fprintf(stderr, "Detected EIO\n");
+ 				goto errout;
+@@ -1537,18 +1537,18 @@ link_path(pathname_t *name1, pathname_t
+ }
+ 
+ int
+-lstat64_path(pathname_t *name, struct stat64 *sbuf)
++lstat_path(pathname_t *name, struct stat *sbuf)
+ {
+ 	char		buf[NAME_MAX + 1];
+ 	pathname_t	newname;
+ 	int		rval;
+ 
+-	rval = lstat64(name->path, sbuf);
++	rval = lstat(name->path, sbuf);
+ 	if (rval >= 0 || errno != ENAMETOOLONG)
+ 		return rval;
+ 	separate_pathname(name, buf, &newname);
+ 	if (chdir(buf) == 0) {
+-		rval = lstat64_path(&newname, sbuf);
++		rval = lstat_path(&newname, sbuf);
+ 		assert(chdir("..") == 0);
+ 	}
+ 	free_pathname(&newname);
+@@ -1870,18 +1870,18 @@ show_ops(int flag, char *lead_str)
+ }
+ 
+ int
+-stat64_path(pathname_t *name, struct stat64 *sbuf)
++stat_path(pathname_t *name, struct stat *sbuf)
+ {
+ 	char		buf[NAME_MAX + 1];
+ 	pathname_t	newname;
+ 	int		rval;
+ 
+-	rval = stat64(name->path, sbuf);
++	rval = stat(name->path, sbuf);
+ 	if (rval >= 0 || errno != ENAMETOOLONG)
+ 		return rval;
+ 	separate_pathname(name, buf, &newname);
+ 	if (chdir(buf) == 0) {
+-		rval = stat64_path(&newname, sbuf);
++		rval = stat_path(&newname, sbuf);
+ 		assert(chdir("..") == 0);
+ 	}
+ 	free_pathname(&newname);
+@@ -1913,18 +1913,18 @@ symlink_path(const char *name1, pathname
+ }
+ 
+ int
+-truncate64_path(pathname_t *name, off64_t length)
++truncate_path(pathname_t *name, off64_t length)
+ {
+ 	char		buf[NAME_MAX + 1];
+ 	pathname_t	newname;
+ 	int		rval;
+ 
+-	rval = truncate64(name->path, length);
++	rval = truncate(name->path, length);
+ 	if (rval >= 0 || errno != ENAMETOOLONG)
+ 		return rval;
+ 	separate_pathname(name, buf, &newname);
+ 	if (chdir(buf) == 0) {
+-		rval = truncate64_path(&newname, length);
++		rval = truncate_path(&newname, length);
+ 		assert(chdir("..") == 0);
+ 	}
+ 	free_pathname(&newname);
+@@ -2026,7 +2026,7 @@ non_btrfs_freq(const char *path)
+ 		ops[btrfs_ops[i]].freq = 0;
+ }
+ 
+-void inode_info(char *str, size_t sz, struct stat64 *s, int verbose)
++void inode_info(char *str, size_t sz, struct stat *s, int verbose)
+ {
+ 	if (verbose)
+ 		snprintf(str, sz, "[%ld %ld %d %d %lld %lld]",
+@@ -2101,7 +2101,7 @@ allocsp_f(opnum_t opno, long r)
+ 	struct xfs_flock64	fl;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -2122,9 +2122,9 @@ allocsp_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: allocsp - fstat64 %s failed %d\n",
++			printf("%d/%lld: allocsp - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -2160,7 +2160,7 @@ do_aio_rw(opnum_t opno, long r, int flag
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	char		*dio_env;
+@@ -2184,9 +2184,9 @@ do_aio_rw(opnum_t opno, long r, int flag
+ 			       procid, opno, f.path, e);
+ 		goto aio_out;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: do_aio_rw - fstat64 %s failed %d\n",
++			printf("%d/%lld: do_aio_rw - fstat %s failed %d\n",
+ 			       procid, opno, f.path, errno);
+ 		goto aio_out;
+ 	}
+@@ -2278,7 +2278,7 @@ do_uring_rw(opnum_t opno, long r, int fl
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	struct io_uring_sqe	*sqe;
+@@ -2304,9 +2304,9 @@ do_uring_rw(opnum_t opno, long r, int fl
+ 			       procid, opno, f.path, e);
+ 		goto uring_out;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: do_uring_rw - fstat64 %s failed %d\n",
++			printf("%d/%lld: do_uring_rw - fstat %s failed %d\n",
+ 			       procid, opno, f.path, errno);
+ 		goto uring_out;
+ 	}
+@@ -2522,7 +2522,7 @@ bulkstat1_f(opnum_t opno, long r)
+ 	int		fd;
+ 	int		good;
+ 	__u64		ino;
+-	struct stat64	s;
++	struct stat	s;
+ 	struct xfs_bstat	t;
+ 	int		v;
+ 	struct xfs_fsop_bulkreq bsr;
+@@ -2534,7 +2534,7 @@ bulkstat1_f(opnum_t opno, long r)
+ 		init_pathname(&f);
+ 		if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+ 			append_pathname(&f, ".");
+-		ino = stat64_path(&f, &s) < 0 ? (ino64_t)r : s.st_ino;
++		ino = stat_path(&f, &s) < 0 ? (ino64_t)r : s.st_ino;
+ 		check_cwd();
+ 		free_pathname(&f);
+ 	} else {
+@@ -2605,8 +2605,8 @@ clonerange_f(
+ 	struct file_clone_range	fcr;
+ 	struct pathname		fpath1;
+ 	struct pathname		fpath2;
+-	struct stat64		stat1;
+-	struct stat64		stat2;
++	struct stat		stat1;
++	struct stat		stat2;
+ 	char			inoinfo1[1024];
+ 	char			inoinfo2[1024];
+ 	off64_t			lr;
+@@ -2660,17 +2660,17 @@ clonerange_f(
+ 	}
+ 
+ 	/* Get file stats */
+-	if (fstat64(fd1, &stat1) < 0) {
++	if (fstat(fd1, &stat1) < 0) {
+ 		if (v1)
+-			printf("%d/%lld: clonerange read - fstat64 %s failed %d\n",
++			printf("%d/%lld: clonerange read - fstat %s failed %d\n",
+ 				procid, opno, fpath1.path, errno);
+ 		goto out_fd2;
+ 	}
+ 	inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1);
+ 
+-	if (fstat64(fd2, &stat2) < 0) {
++	if (fstat(fd2, &stat2) < 0) {
+ 		if (v2)
+-			printf("%d/%lld: clonerange write - fstat64 %s failed %d\n",
++			printf("%d/%lld: clonerange write - fstat %s failed %d\n",
+ 				procid, opno, fpath2.path, errno);
+ 		goto out_fd2;
+ 	}
+@@ -2743,8 +2743,8 @@ copyrange_f(
+ #ifdef HAVE_COPY_FILE_RANGE
+ 	struct pathname		fpath1;
+ 	struct pathname		fpath2;
+-	struct stat64		stat1;
+-	struct stat64		stat2;
++	struct stat		stat1;
++	struct stat		stat2;
+ 	char			inoinfo1[1024];
+ 	char			inoinfo2[1024];
+ 	loff_t			lr;
+@@ -2802,17 +2802,17 @@ copyrange_f(
+ 	}
+ 
+ 	/* Get file stats */
+-	if (fstat64(fd1, &stat1) < 0) {
++	if (fstat(fd1, &stat1) < 0) {
+ 		if (v1)
+-			printf("%d/%lld: copyrange read - fstat64 %s failed %d\n",
++			printf("%d/%lld: copyrange read - fstat %s failed %d\n",
+ 				procid, opno, fpath1.path, errno);
+ 		goto out_fd2;
+ 	}
+ 	inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1);
+ 
+-	if (fstat64(fd2, &stat2) < 0) {
++	if (fstat(fd2, &stat2) < 0) {
+ 		if (v2)
+-			printf("%d/%lld: copyrange write - fstat64 %s failed %d\n",
++			printf("%d/%lld: copyrange write - fstat %s failed %d\n",
+ 				procid, opno, fpath2.path, errno);
+ 		goto out_fd2;
+ 	}
+@@ -2900,7 +2900,7 @@ deduperange_f(
+ #define INFO_SZ			1024
+ 	struct file_dedupe_range *fdr;
+ 	struct pathname		*fpath;
+-	struct stat64		*stat;
++	struct stat		*stat;
+ 	char			*info;
+ 	off64_t			*off;
+ 	int			*v;
+@@ -2938,7 +2938,7 @@ deduperange_f(
+ 		goto out_fdr;
+ 	}
+ 
+-	stat = calloc(nr, sizeof(struct stat64));
++	stat = calloc(nr, sizeof(struct stat));
+ 	if (!stat) {
+ 		printf("%d/%lld: line %d error %d\n",
+ 			procid, opno, __LINE__, errno);
+@@ -3017,9 +3017,9 @@ deduperange_f(
+ 	}
+ 
+ 	/* Get file stats */
+-	if (fstat64(fd[0], &stat[0]) < 0) {
++	if (fstat(fd[0], &stat[0]) < 0) {
+ 		if (v[0])
+-			printf("%d/%lld: deduperange read - fstat64 %s failed %d\n",
++			printf("%d/%lld: deduperange read - fstat %s failed %d\n",
+ 				procid, opno, fpath[0].path, errno);
+ 		goto out_fds;
+ 	}
+@@ -3027,9 +3027,9 @@ deduperange_f(
+ 	inode_info(&info[0], INFO_SZ, &stat[0], v[0]);
+ 
+ 	for (i = 1; i < nr; i++) {
+-		if (fstat64(fd[i], &stat[i]) < 0) {
++		if (fstat(fd[i], &stat[i]) < 0) {
+ 			if (v[i])
+-				printf("%d/%lld: deduperange write - fstat64 %s failed %d\n",
++				printf("%d/%lld: deduperange write - fstat %s failed %d\n",
+ 					procid, opno, fpath[i].path, errno);
+ 			goto out_fds;
+ 		}
+@@ -3179,8 +3179,8 @@ splice_f(opnum_t opno, long r)
+ {
+ 	struct pathname		fpath1;
+ 	struct pathname		fpath2;
+-	struct stat64		stat1;
+-	struct stat64		stat2;
++	struct stat		stat1;
++	struct stat		stat2;
+ 	char			inoinfo1[1024];
+ 	char			inoinfo2[1024];
+ 	loff_t			lr;
+@@ -3237,17 +3237,17 @@ splice_f(opnum_t opno, long r)
+ 	}
+ 
+ 	/* Get file stats */
+-	if (fstat64(fd1, &stat1) < 0) {
++	if (fstat(fd1, &stat1) < 0) {
+ 		if (v1)
+-			printf("%d/%lld: splice read - fstat64 %s failed %d\n",
++			printf("%d/%lld: splice read - fstat %s failed %d\n",
+ 				procid, opno, fpath1.path, errno);
+ 		goto out_fd2;
+ 	}
+ 	inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1);
+ 
+-	if (fstat64(fd2, &stat2) < 0) {
++	if (fstat(fd2, &stat2) < 0) {
+ 		if (v2)
+-			printf("%d/%lld: splice write - fstat64 %s failed %d\n",
++			printf("%d/%lld: splice write - fstat %s failed %d\n",
+ 				procid, opno, fpath2.path, errno);
+ 		goto out_fd2;
+ 	}
+@@ -3432,7 +3432,7 @@ dread_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	char		*dio_env;
+@@ -3454,9 +3454,9 @@ dread_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: dread - fstat64 %s failed %d\n",
++			printf("%d/%lld: dread - fstat %s failed %d\n",
+ 			       procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -3522,7 +3522,7 @@ dwrite_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	char		*dio_env;
+@@ -3544,9 +3544,9 @@ dwrite_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: dwrite - fstat64 %s failed %d\n",
++			printf("%d/%lld: dwrite - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -3620,7 +3620,7 @@ do_fallocate(opnum_t opno, long r, int m
+ 	int64_t		lr;
+ 	off64_t		off;
+ 	off64_t		len;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -3640,9 +3640,9 @@ do_fallocate(opnum_t opno, long r, int m
+ 		return;
+ 	}
+ 	check_cwd();
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: do_fallocate - fstat64 %s failed %d\n",
++			printf("%d/%lld: do_fallocate - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -3734,7 +3734,7 @@ fiemap_f(opnum_t opno, long r)
+ 	int		fd;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	int blocks_to_map;
+@@ -3757,9 +3757,9 @@ fiemap_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: fiemap - fstat64 %s failed %d\n",
++			printf("%d/%lld: fiemap - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -3807,7 +3807,7 @@ freesp_f(opnum_t opno, long r)
+ 	struct xfs_flock64	fl;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -3828,9 +3828,9 @@ freesp_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: freesp - fstat64 %s failed %d\n",
++			printf("%d/%lld: freesp - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -4226,7 +4226,7 @@ do_mmap(opnum_t opno, long r, int prot)
+ 	int64_t		lr;
+ 	off64_t		off;
+ 	int		flags;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	sigjmp_buf	sigbus_jmpbuf;
+@@ -4248,9 +4248,9 @@ do_mmap(opnum_t opno, long r, int prot)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: do_mmap - fstat64 %s failed %d\n",
++			printf("%d/%lld: do_mmap - fstat %s failed %d\n",
+ 			       procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -4370,7 +4370,7 @@ read_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -4391,9 +4391,9 @@ read_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: read - fstat64 %s failed %d\n",
++			printf("%d/%lld: read - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -4454,7 +4454,7 @@ readv_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	struct iovec	*iov = NULL;
+@@ -4480,9 +4480,9 @@ readv_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: readv - fstat64 %s failed %d\n",
++			printf("%d/%lld: readv - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -4739,7 +4739,7 @@ resvsp_f(opnum_t opno, long r)
+ 	struct xfs_flock64	fl;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -4760,9 +4760,9 @@ resvsp_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: resvsp - fstat64 %s failed %d\n",
++			printf("%d/%lld: resvsp - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -4971,7 +4971,7 @@ stat_f(opnum_t opno, long r)
+ {
+ 	int		e;
+ 	pathname_t	f;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 
+ 	init_pathname(&f);
+@@ -4981,7 +4981,7 @@ stat_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	e = lstat64_path(&f, &stb) < 0 ? errno : 0;
++	e = lstat_path(&f, &stb) < 0 ? errno : 0;
+ 	check_cwd();
+ 	if (v)
+ 		printf("%d/%lld: stat %s %d\n", procid, opno, f.path, e);
+@@ -5133,7 +5133,7 @@ truncate_f(opnum_t opno, long r)
+ 	pathname_t	f;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -5144,11 +5144,11 @@ truncate_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	e = stat64_path(&f, &stb) < 0 ? errno : 0;
++	e = stat_path(&f, &stb) < 0 ? errno : 0;
+ 	check_cwd();
+ 	if (e > 0) {
+ 		if (v)
+-			printf("%d/%lld: truncate - stat64 %s failed %d\n",
++			printf("%d/%lld: truncate - stat %s failed %d\n",
+ 				procid, opno, f.path, e);
+ 		free_pathname(&f);
+ 		return;
+@@ -5157,7 +5157,7 @@ truncate_f(opnum_t opno, long r)
+ 	lr = ((int64_t)random() << 32) + random();
+ 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+ 	off %= maxfsize;
+-	e = truncate64_path(&f, off) < 0 ? errno : 0;
++	e = truncate_path(&f, off) < 0 ? errno : 0;
+ 	check_cwd();
+ 	if (v)
+ 		printf("%d/%lld: truncate %s%s %lld %d\n", procid, opno, f.path,
+@@ -5209,7 +5209,7 @@ unresvsp_f(opnum_t opno, long r)
+ 	struct xfs_flock64	fl;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -5230,9 +5230,9 @@ unresvsp_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: unresvsp - fstat64 %s failed %d\n",
++			printf("%d/%lld: unresvsp - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -5281,7 +5281,7 @@ write_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 
+@@ -5302,9 +5302,9 @@ write_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: write - fstat64 %s failed %d\n",
++			printf("%d/%lld: write - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+@@ -5337,7 +5337,7 @@ writev_f(opnum_t opno, long r)
+ 	size_t		len;
+ 	int64_t		lr;
+ 	off64_t		off;
+-	struct stat64	stb;
++	struct stat	stb;
+ 	int		v;
+ 	char		st[1024];
+ 	struct iovec	*iov = NULL;
+@@ -5363,9 +5363,9 @@ writev_f(opnum_t opno, long r)
+ 		free_pathname(&f);
+ 		return;
+ 	}
+-	if (fstat64(fd, &stb) < 0) {
++	if (fstat(fd, &stb) < 0) {
+ 		if (v)
+-			printf("%d/%lld: writev - fstat64 %s failed %d\n",
++			printf("%d/%lld: writev - fstat %s failed %d\n",
+ 				procid, opno, f.path, errno);
+ 		free_pathname(&f);
+ 		close(fd);
+--- a/tests/fssum.c
++++ b/tests/fssum.c
+@@ -519,9 +519,9 @@ sum(int dirfd, int level, sum_t *dircs,
+ 	int excl;
+ 	sum_file_data_t sum_file_data = flags[FLAG_STRUCTURE] ?
+ 			sum_file_data_strict : sum_file_data_permissive;
+-	struct stat64 dir_st;
++	struct stat dir_st;
+ 
+-	if (fstat64(dirfd, &dir_st)) {
++	if (fstat(dirfd, &dir_st)) {
+ 		perror("fstat");
+ 		exit(-1);
+ 	}
+@@ -552,7 +552,7 @@ sum(int dirfd, int level, sum_t *dircs,
+ 	}
+ 	qsort(namelist, entries, sizeof(*namelist), namecmp);
+ 	for (i = 0; i < entries; ++i) {
+-		struct stat64 st;
++		struct stat st;
+ 		sum_t cs;
+ 		sum_t meta;
+ 		char *path;
+@@ -572,7 +572,7 @@ sum(int dirfd, int level, sum_t *dircs,
+ 			perror("fchdir");
+ 			exit(-1);
+ 		}
+-		ret = lstat64(namelist[i], &st);
++		ret = lstat(namelist[i], &st);
+ 		if (ret) {
+ 			fprintf(stderr, "stat failed for %s/%s: %m\n",
+ 				path_prefix, path);
meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.1.bb +1 -0
index 7144087a11..0372c189a8 100644
@@ -17,6 +17,7 @@ DEPENDS = "util-linux zlib"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \
            file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
+           file://0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch \
            "
 SRCREV = "441d01556873385d55fd4940f50ee7ae1fcfb13d"
 S = "${WORKDIR}/git"
Signature · 1 line
2.38.1
#4 lore raw

Re: [OE-core] [PATCH 3/6] btrfs-tools: Do not use 64bit functions for largefile support

Quoted 1 line · Khem Raj

+Upstream-Status: Pending

Please submit this and all other patches in this set upstream first.

Come on Khem, you should expect this response, and I should not have to tell you.

Alex

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [OE-core] [PATCH 3/6] btrfs-tools: Do not use 64bit functions for largefile support

I want to once again request that the whole set is not merged into master until every patch has an upstream submission link. It's fine to test them in master-next, but please do not merge.

Alex

Quoted 19 lines · Alexander Kanavin via lists.openembedded.org
Quoted 1 line · Khem Raj

+Upstream-Status: Pending

Please submit this and all other patches in this set upstream first.

Come on Khem, you should expect this response, and I should not have to tell you.

Alex

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#174208): https://lists.openembedded.org/g/openembedded-core/message/174208
Mute This Topic: https://lists.openembedded.org/mt/95389895/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw

Re: [OE-core] [PATCH 3/6] btrfs-tools: Do not use 64bit functions for largefile support

Quoted 3 lines · Alexander Kanavin

I want to once again request that the whole set is not merged into master until every patch has an upstream submission link. It's fine to test them in master-next, but please do not merge.

I did a quick check and the acl patch was merged so I think that is ok to go in. The pseudo one doesn't need any further work either.

I'm worried the mdadm upstream isn't very active so that one, whilst submitted, may take a while.

I do agree we need to at least get the others submitted. OE isn't in the business of carrying patches, particularly when this is near enough musl feature development :/

Cheers,

Richard

author
#9 lore raw

PATCH 4/6 e2fsprogs: Do not use 64bit functions for largefile support

In reply to Khem Raj

Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave like 64bit variants. Moreover it makes them portable across libc

---
 ...-to-enable-disable-largefile-support.patch | 57 +++++++++++++++++++
 .../e2fsprogs/e2fsprogs_1.46.5.bb             |  3 +-
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch
meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch new file +57 -0
new file mode 100644
index 0000000000..1a00fa844c
@@ -0,0 +1,57 @@
+From 6fab3346d448298a24cee1faeb5fc8507a3b9712 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 10 Nov 2022 20:34:54 -0800
+Subject: [PATCH] Add option to enable/disable largefile support
+
+fallocate can be used to have 64bit off_t provided its compiled with
+_FILE_OFFSET_BITS=64 which will be added automatically when
+--enable-largefile is used.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac    | 3 +++
+ misc/e4defrag.c | 6 +-----
+ 2 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dff3d1ca..ec1c5b64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1800,6 +1800,9 @@ OS_IO_FILE=""
+   ;;
+ esac]
+ AC_SUBST(OS_IO_FILE)
++
++AC_SYS_LARGEFILE
++
+ dnl
+ dnl Make our output files, being sure that we create the some miscellaneous 
+ dnl directories
+diff --git a/misc/e4defrag.c b/misc/e4defrag.c
+index 86e97ee3..e7175c37 100644
+--- a/misc/e4defrag.c
++++ b/misc/e4defrag.c
+@@ -195,10 +195,6 @@ static struct frag_statistic_ino	frag_rank[SHOW_FRAG_FILES];
+ #error posix_fadvise not available!
+ #endif
+ 
+-#ifndef HAVE_FALLOCATE64
+-#error fallocate64 not available!
+-#endif /* ! HAVE_FALLOCATE64 */
+-
+ /*
+  * get_mount_point() -	Get device's mount point.
+  *
+@@ -1568,7 +1564,7 @@ static int file_defrag(const char *file, const struct stat64 *buf,
+ 	/* Allocate space for donor inode */
+ 	orig_group_tmp = orig_group_head;
+ 	do {
+-		ret = fallocate64(donor_fd, 0,
++		ret = fallocate(donor_fd, 0,
+ 		  (ext2_loff_t)orig_group_tmp->start->data.logical * block_size,
+ 		  (ext2_loff_t)orig_group_tmp->len * block_size);
+ 		if (ret < 0) {
+-- 
+2.38.1
+
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb +2 -1
index 5b2d1921f0..a251f126ae 100644
@@ -5,6 +5,7 @@ SRC_URI += "file://remove.ldconfig.call.patch \
            file://ptest.patch \
            file://mkdir_p.patch \
            file://extents.patch \
+           file://0001-Add-option-to-enable-disable-largefile-support.patch \
            "
 SRC_URI:append:class-native = " \
            file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
@@ -17,7 +18,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)$"
 EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
                 --enable-elf-shlibs --disable-libuuid --disable-uuidd \
                 --disable-libblkid --enable-verbose-makecmds \
-                --with-crond-dir=no"
+                --enable-largefile --with-crond-dir=no"
 
 EXTRA_OECONF:darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
 
Signature · 1 line
2.38.1
author
#10 lore raw

PATCH 5/6 libpciaccess: Do not use 64bit functions for largefile support

In reply to Khem Raj

Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave like 64bit variants. Moreover it makes them portable across libc

---
 ...pwrite-pread-instead-of-64bit-versio.patch | 39 +++++++++++++++++++
 .../xorg-lib/libpciaccess_0.17.bb             |  2 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch
meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch new file +39 -0
new file mode 100644
index 0000000000..cd9c2d3991
@@ -0,0 +1,39 @@
+From d20ff4f2e4feaafa6a6191b9cae3815b85617943 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 11 Nov 2022 11:15:58 -0800
+Subject: [PATCH] linux_sysfs: Use pwrite/pread instead of 64bit versions
+
+pread64/pwrite64 are aliased to pread/pwrite when largefile support is
+enabled e.g. using _FILE_OFFSET_BITS=64 macro
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/linux_sysfs.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
+index d62f48c..20c800e 100644
+--- a/src/linux_sysfs.c
++++ b/src/linux_sysfs.c
+@@ -462,7 +462,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
+ 
+ 
+     while ( temp_size > 0 ) {
+-	const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
++	const ssize_t bytes = pread( fd, data_bytes, temp_size, offset );
+ 
+ 	/* If zero bytes were read, then we assume it's the end of the
+ 	 * config file.
+@@ -522,7 +522,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
+ 
+ 
+     while ( temp_size > 0 ) {
+-	const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
++	const ssize_t bytes = pwrite( fd, data_bytes, temp_size, offset );
+ 
+ 	/* If zero bytes were written, then we assume it's the end of the
+ 	 * config file.
+-- 
+2.38.1
+
meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb +2 -0
index 06c30384ab..309354e872 100644
@@ -5,6 +5,8 @@ PCI bus and devices in a platform-independent way."
 
 require xorg-lib-common.inc
 
+SRC_URI += "file://0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch"
+
 XORG_EXT = "tar.xz"
 SRC_URI[sha256sum] = "74283ba3c974913029e7a547496a29145b07ec51732bbb5b5c58d5025ad95b73"
 
Signature · 1 line
2.38.1
author
#11 lore raw

PATCH 6/6 pseudo: Disable LFS on 32bit arches

In reply to Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
index c34580b4ff..c3f0a987fc 100644
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 # error: use of undeclared identifier '_STAT_VER'
 COMPATIBLE_HOST:libc-musl = 'null'
Signature · 1 line
2.38.1
#12 lore raw

Re: [OE-core] [PATCH 6/6] pseudo: Disable LFS on 32bit arches

Quoted 13 lines · Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +0 -0
index c34580b4ff..c3f0a987fc 100644

meta/recipes-devtools/pseudo/pseudo_git.bb SRCREV = "c9670c27ff67ab899007ce749254b16091577e55" · line 22

Quoted 6 lines
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 

We need to put some comments in here about what this is doing and why.

Cheers,

Richard

#13 lore raw

Re: [OE-core] [PATCH 6/6] pseudo: Disable LFS on 32bit arches

Quoted 17 lines · Richard Purdie
Quoted 16 lines · Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +0 -0
index c34580b4ff..c3f0a987fc 100644
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
Quoted 6 lines

meta/recipes-devtools/pseudo/pseudo_git.bb SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"

Quoted 3 lines
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 

We need to put some comments in here about what this is doing and why.

Note that this was one of the issues I had with the -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 build. My guess is that we also have to remove -D_TIME_BITS=64.

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#14 lore raw

Re: [OE-core] [PATCH 6/6] pseudo: Disable LFS on 32bit arches

Quoted 26 lines · Alexandre Belloni
Quoted 17 lines · Richard Purdie
Quoted 16 lines · Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +0 -0
index c34580b4ff..c3f0a987fc 100644
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
Quoted 6 lines

meta/recipes-devtools/pseudo/pseudo_git.bb SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"

Quoted 3 lines
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 

We need to put some comments in here about what this is doing and why.

Quoted 3 lines

Note that this was one of the issues I had with the -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 build. My guess is that we also have to remove -D_TIME_BITS=64.

Eventually yes, however lets do that incrementally. First I am trying to get LFS handled.

Quoted 6 lines

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#15 lore raw

Re: [OE-core] [PATCH 6/6] pseudo: Disable LFS on 32bit arches

Quoted 28 lines · Khem Raj
Quoted 26 lines · Alexandre Belloni
Quoted 23 lines · Richard Purdie
Quoted 13 lines · Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +0 -0
index c34580b4ff..c3f0a987fc 100644

meta/recipes-devtools/pseudo/pseudo_git.bb SRCREV = "c9670c27ff67ab899007ce749254b16091577e55" · line 22

Quoted 6 lines
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 

We need to put some comments in here about what this is doing and why.

Quoted 6 lines
Quoted 3 lines

Note that this was one of the issues I had with the -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 build. My guess is that we also have to remove -D_TIME_BITS=64.

Eventually yes, however lets do that incrementally. First I am trying to get LFS handled.

Pseudo is a bit of a special case so if we can see an issue here, lets add the other bit needed as well please! :)

I don't mind if it is one or two patches but we should do it.

Cheers,

Richard

author
#16 lore raw

Re: [OE-core] [PATCH 6/6] pseudo: Disable LFS on 32bit arches

Quoted 34 lines · Richard Purdie
Quoted 32 lines · Khem Raj
Quoted 29 lines · Alexandre Belloni
Quoted 17 lines · Richard Purdie
Quoted 16 lines · Khem Raj

pseudo overrides certain libc functions which are aliases when LFS64 is enabled. In anycase pseudo may not be much used on 32bit systems anyway

---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +0 -0
index c34580b4ff..c3f0a987fc 100644
@@ -17,5 +17,7 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
Quoted 6 lines

meta/recipes-devtools/pseudo/pseudo_git.bb SRCREV = "c9670c27ff67ab899007ce749254b16091577e55" · line 22

Quoted 3 lines
meta/recipes-devtools/pseudo/pseudo_git.bb +2 -0
+TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D
+
 

We need to put some comments in here about what this is doing and why.

Note that this was one of the issues I had with the -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 build. My guess is that we also have to remove -D_TIME_BITS=64.

Quoted 8 lines
Quoted 2 lines

Eventually yes, however lets do that incrementally. First I am trying to get LFS handled.

Pseudo is a bit of a special case so if we can see an issue here, lets add the other bit needed as well please! :)

I don't mind if it is one or two patches but we should do it.

OK, I wanted to first fail with that option because we are removing -D_FILE_OFFSET_BITS=64 it should be enough
for 64bit time_t as well.

Quoted 4 lines

Cheers,

Richard