* [PATCH 01/11] erofs-utils: Convert from off64_t to off_t
@ 2022-12-15 8:45 Khem Raj
2022-12-15 8:45 ` [PATCH 02/11] pseudo: Remove 64bit time_t flags Khem Raj
` (9 more replies)
0 siblings, 10 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Ensure largefile macros are used to determine size of off_t and not the
explict 64bit version of functions and types
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../0001-configure-use-AC_SYS_LARGEFILE.patch | 43 +++++++
...eplace-l-stat64-by-equivalent-l-stat.patch | 109 ++++++++++++++++++
...-Make-LFS-mandatory-for-all-usecases.patch | 41 +++++++
.../erofs-utils/erofs-utils_1.5.bb | 8 +-
4 files changed, 199 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch
create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch
create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch b/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch
new file mode 100644
index 0000000000..75c91f51a7
--- /dev/null
+++ b/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch
@@ -0,0 +1,43 @@
+From fef3b16dba2c5f6ad88951b80cdfbedd423e80a0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 7 Dec 2022 20:16:52 -0800
+Subject: [PATCH v3 1/3] configure: use AC_SYS_LARGEFILE
+
+The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64
+where necessary to ensure that off_t and all interfaces using off_t
+are 64bit, even on 32bit systems.
+
+Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=66 via CFLAGS
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-1-raj.khem@gmail.com/T/#t]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index a736ff0..e8bb003 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -13,6 +13,8 @@ AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_AUX_DIR(config)
+ AM_INIT_AUTOMAKE([foreign -Wall])
+
++AC_SYS_LARGEFILE
++
+ # Checks for programs.
+ AM_PROG_AR
+ AC_PROG_CC
+@@ -319,6 +321,9 @@ if test "x$enable_lzma" = "xyes"; then
+ CPPFLAGS="${saved_CPPFLAGS}"
+ fi
+
++# Enable 64-bit off_t
++CFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
++
+ # Set up needed symbols, conditionals and compiler/linker flags
+ AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"])
+ AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"])
+--
+2.39.0
+
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch b/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch
new file mode 100644
index 0000000000..d12bebbf87
--- /dev/null
+++ b/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch
@@ -0,0 +1,109 @@
+From 856189c324834b838f0e9cfc0d2e05f12518f264 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 7 Dec 2022 22:17:35 -0800
+Subject: [PATCH v3 2/3] erofs: replace [l]stat64 by equivalent [l]stat
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-2-raj.khem@gmail.com/T/#u]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/inode.c | 10 +++++-----
+ lib/xattr.c | 4 ++--
+ mkfs/main.c | 4 ++--
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/lib/inode.c b/lib/inode.c
+index f192510..38003fc 100644
+--- a/lib/inode.c
++++ b/lib/inode.c
+@@ -773,7 +773,7 @@ static u32 erofs_new_encode_dev(dev_t dev)
+
+ #ifdef WITH_ANDROID
+ int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
+- struct stat64 *st,
++ struct stat *st,
+ const char *path)
+ {
+ /* filesystem_config does not preserve file type bits */
+@@ -818,7 +818,7 @@ int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
+ }
+ #else
+ static int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
+- struct stat64 *st,
++ struct stat *st,
+ const char *path)
+ {
+ return 0;
+@@ -826,7 +826,7 @@ static int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
+ #endif
+
+ static int erofs_fill_inode(struct erofs_inode *inode,
+- struct stat64 *st,
++ struct stat *st,
+ const char *path)
+ {
+ int err = erofs_droid_inode_fsconfig(inode, st, path);
+@@ -910,7 +910,7 @@ static struct erofs_inode *erofs_new_inode(void)
+ /* get the inode from the (source) path */
+ static struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src)
+ {
+- struct stat64 st;
++ struct stat st;
+ struct erofs_inode *inode;
+ int ret;
+
+@@ -918,7 +918,7 @@ static struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src)
+ if (!is_src)
+ return ERR_PTR(-EINVAL);
+
+- ret = lstat64(path, &st);
++ ret = lstat(path, &st);
+ if (ret)
+ return ERR_PTR(-errno);
+
+diff --git a/lib/xattr.c b/lib/xattr.c
+index 71ffe3e..fd0e728 100644
+--- a/lib/xattr.c
++++ b/lib/xattr.c
+@@ -467,7 +467,7 @@ static int erofs_count_all_xattrs_from_path(const char *path)
+ {
+ int ret;
+ DIR *_dir;
+- struct stat64 st;
++ struct stat st;
+
+ _dir = opendir(path);
+ if (!_dir) {
+@@ -502,7 +502,7 @@ static int erofs_count_all_xattrs_from_path(const char *path)
+ goto fail;
+ }
+
+- ret = lstat64(buf, &st);
++ ret = lstat(buf, &st);
+ if (ret) {
+ ret = -errno;
+ goto fail;
+diff --git a/mkfs/main.c b/mkfs/main.c
+index d2c9830..5279805 100644
+--- a/mkfs/main.c
++++ b/mkfs/main.c
+@@ -581,7 +581,7 @@ int main(int argc, char **argv)
+ struct erofs_buffer_head *sb_bh;
+ struct erofs_inode *root_inode;
+ erofs_nid_t root_nid;
+- struct stat64 st;
++ struct stat st;
+ erofs_blk_t nblocks;
+ struct timeval t;
+ char uuid_str[37] = "not available";
+@@ -609,7 +609,7 @@ int main(int argc, char **argv)
+ return 1;
+ }
+
+- err = lstat64(cfg.c_src_path, &st);
++ err = lstat(cfg.c_src_path, &st);
+ if (err)
+ return 1;
+ if (!S_ISDIR(st.st_mode)) {
+--
+2.39.0
+
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch b/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch
new file mode 100644
index 0000000000..97faa5d673
--- /dev/null
+++ b/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch
@@ -0,0 +1,41 @@
+From 8f8cbc7b773da63bce8226249784ba6824635c9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 7 Dec 2022 20:19:27 -0800
+Subject: [PATCH v3 3/3] internal.h: Make LFS mandatory for all usecases
+
+erosfs depend on the consistent use of a 64bit offset
+type, force downstreams to use transparent LFS (_FILE_OFFSET_BITS=64),
+so that it becomes impossible for them to use 32bit interfaces.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-3-raj.khem@gmail.com/T/#u]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ include/erofs/internal.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/include/erofs/internal.h b/include/erofs/internal.h
+index 6a70f11..d3b2986 100644
+--- a/include/erofs/internal.h
++++ b/include/erofs/internal.h
+@@ -21,6 +21,7 @@ typedef unsigned short umode_t;
+
+ #include "erofs_fs.h"
+ #include <fcntl.h>
++#include <sys/types.h> /* for off_t definition */
+
+ #ifndef PATH_MAX
+ #define PATH_MAX 4096 /* # chars in a path name including nul */
+@@ -104,6 +105,10 @@ struct erofs_sb_info {
+ };
+ };
+
++
++/* make sure that any user of the erofs headers has atleast 64bit off_t type */
++extern int erofs_assert_largefile[sizeof(off_t)-8];
++
+ /* global sbi */
+ extern struct erofs_sb_info sbi;
+
+--
+2.39.0
+
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb b/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb
index b9a97b3e53..6ce5843570 100644
--- a/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb
+++ b/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb
@@ -6,7 +6,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=73001d804ea1e3d84365f652242cca20"
HOMEPAGE = "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/README"
SRCREV = "a2821a66b42aee5430bccee82c280e38d1e9ab29"
-SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git;branch=master"
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git;branch=master \
+ file://0001-configure-use-AC_SYS_LARGEFILE.patch \
+ file://0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch \
+ file://0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch \
+ "
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>(\d+(\.\d+)+))"
@@ -19,7 +23,7 @@ inherit pkgconfig autotools
PACKAGECONFIG ??= "lz4"
PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4"
-EXTRA_OECONF = "${PACKAGECONFIG_CONFARGS} --disable-fuse"
+EXTRA_OECONF = "${PACKAGECONFIG_CONFARGS} --disable-fuse --enable-largefile"
CFLAGS:append:powerpc64le = " -D__SANE_USERSPACE_TYPES__"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/11] pseudo: Remove 64bit time_t flags
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 03/11] unfs3: Define off64_t in terms of off_t on musl Khem Raj
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
pseudo traps syscalls and has intimate knowledge of them
and does not really depend on glibc interfaces to kernel
flags are added via TARGET_CC_ARCH therefore move the remove
operation from TARGET_CPPFLAGS to TARGET_CC_ARCH
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-devtools/pseudo/pseudo_git.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 8bb8993439..1a708066f7 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -22,7 +22,7 @@ PV = "1.9.0+git${SRCPV}"
# aliased due to this e.g. open/open64 and it will complain about duplicate definitions
# pseudo on 32bit systems is not much of use anyway and these features are not of much
# use for it.
-TARGET_CPPFLAGS:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+TARGET_CC_ARCH:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64"
# error: use of undeclared identifier '_STAT_VER'
COMPATIBLE_HOST:libc-musl = 'null'
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/11] unfs3: Define off64_t in terms of off_t on musl
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
2022-12-15 8:45 ` [PATCH 02/11] pseudo: Remove 64bit time_t flags Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 04/11] acpid: Fix largefile enabled build Khem Raj
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...4_t-to-off_t-on-linux-if-not-defined.patch | 28 +++++++++++++++++++
meta/recipes-devtools/unfs3/unfs3_git.bb | 3 +-
2 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch
diff --git a/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch b/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch
new file mode 100644
index 0000000000..91909fa236
--- /dev/null
+++ b/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch
@@ -0,0 +1,28 @@
+From 949db882e487d728c44bb68139682b38396dd275 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 14 Dec 2022 14:50:10 -0800
+Subject: [PATCH] Alias off64_t to off_t on linux if not defined
+
+Musl C library does not define off64_t and has 64-bit default off_t
+therefore define off64_t as an alias on linux as well when configure
+detects that off64_t is not provided by a linux system
+
+Upstream-Status: Submitted [https://github.com/unfs3/unfs3/pull/29]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ nfs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nfs.h b/nfs.h
+index aded011..7996c67 100644
+--- a/nfs.h
++++ b/nfs.h
+@@ -62,7 +62,7 @@ typedef int32_t int32;
+ #endif
+
+ #ifndef HAVE_OFF64_T
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__linux__)
+ typedef off_t off64_t;
+ #endif
+ #endif
diff --git a/meta/recipes-devtools/unfs3/unfs3_git.bb b/meta/recipes-devtools/unfs3/unfs3_git.bb
index 606c103a79..a4701bdb57 100644
--- a/meta/recipes-devtools/unfs3/unfs3_git.bb
+++ b/meta/recipes-devtools/unfs3/unfs3_git.bb
@@ -14,7 +14,8 @@ DEPENDS:append:class-nativesdk = " flex-nativesdk"
S = "${WORKDIR}/git"
SRC_URI = "git://github.com/unfs3/unfs3.git;protocol=https;branch=master \
file://0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch \
- "
+ file://0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch \
+ "
SRCREV = "c8f2d2cd4529955419bad0e163f88d47ff176b8d"
UPSTREAM_CHECK_GITTAGREGEX = "unfs3\-(?P<pver>\d+(\.\d+)+)"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/11] acpid: Fix largefile enabled build
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
2022-12-15 8:45 ` [PATCH 02/11] pseudo: Remove 64bit time_t flags Khem Raj
2022-12-15 8:45 ` [PATCH 03/11] unfs3: Define off64_t in terms of off_t on musl Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 05/11] efivar: Replace off64_t with off_t Khem Raj
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-bsp/acpid/acpid.inc | 3 +-
.../acpid/0001-Replace-stat64-with-stat.patch | 31 +++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch
diff --git a/meta/recipes-bsp/acpid/acpid.inc b/meta/recipes-bsp/acpid/acpid.inc
index 98910bab29..7b2f1c71c5 100644
--- a/meta/recipes-bsp/acpid/acpid.inc
+++ b/meta/recipes-bsp/acpid/acpid.inc
@@ -13,7 +13,8 @@ LICENSE = "GPL-2.0-or-later"
SRC_URI = "${SOURCEFORGE_MIRROR}/acpid2/acpid-${PV}.tar.xz \
file://init \
file://acpid.service \
- "
+ file://0001-Replace-stat64-with-stat.patch \
+ "
CVE_PRODUCT = "acpid2"
diff --git a/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch b/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch
new file mode 100644
index 0000000000..10abfc8388
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch
@@ -0,0 +1,31 @@
+From 4b729235a9e96f120feee7e3746818aad0f3b924 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 14 Dec 2022 15:04:30 -0800
+Subject: [PATCH] Replace stat64 with stat
+
+It already checks for largefile support in configure.ac via
+AC_SYS_LARGEFILE macro, which will ensure that 64bit elements
+are correctly setup for stat APIs on platforms needing large
+file support.
+
+Upstream-Status: Submitted [https://sourceforge.net/p/acpid2/code/merge-requests/5/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sock.c b/sock.c
+index 9e04501..3121fb7 100644
+--- a/sock.c
++++ b/sock.c
+@@ -54,8 +54,8 @@ int non_root_clients;
+ static int
+ isfdtype(int fd, int fdtype)
+ {
+- struct stat64 st;
+- if (fstat64(fd, &st) != 0)
++ struct stat st;
++ if (fstat(fd, &st) != 0)
+ return -1;
+ return ((st.st_mode & S_IFMT) == (mode_t)fdtype);
+ }
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/11] efivar: Replace off64_t with off_t
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (2 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 04/11] acpid: Fix largefile enabled build Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 06/11] ltp: Fix largefile support Khem Raj
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../0001-Use-off_t-instead-of-off64_t.patch | 39 +++++++++++++++++++
meta/recipes-bsp/efivar/efivar_38.bb | 1 +
2 files changed, 40 insertions(+)
create mode 100644 meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch
diff --git a/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch b/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch
new file mode 100644
index 0000000000..f47a457386
--- /dev/null
+++ b/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch
@@ -0,0 +1,39 @@
+From 1eb0fa531301a5045af1b020fc093c4fcfd38680 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 14 Dec 2022 16:55:51 -0800
+Subject: [PATCH] Use off_t instead of off64_t
+
+Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t
+
+Upstream-Status: Submitted [https://github.com/rhboot/efivar/pull/237]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/error.c | 2 +-
+ src/include/defaults.mk | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/error.c b/src/error.c
+index fcbba0d..9530e22 100644
+--- a/src/error.c
++++ b/src/error.c
+@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *buf, size_t size)
+ }
+
+ static int
+-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
++dbglog_seek(void *cookie UNUSED, off_t *offset, int whence)
+ {
+ FILE *log = efi_errlog ? efi_errlog : stderr;
+ int rc;
+diff --git a/src/include/defaults.mk b/src/include/defaults.mk
+index 632b155..95be8be 100644
+--- a/src/include/defaults.mk
++++ b/src/include/defaults.mk
+@@ -34,6 +34,7 @@ CPPFLAGS ?=
+ override _CPPFLAGS := $(CPPFLAGS)
+ override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \
+ -D_GNU_SOURCE \
++ -D_FILE_OFFSET_BITS=64 \
+ -I$(TOPDIR)/src/include/
+ CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
+ CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \
diff --git a/meta/recipes-bsp/efivar/efivar_38.bb b/meta/recipes-bsp/efivar/efivar_38.bb
index 6a6918931b..5523329699 100644
--- a/meta/recipes-bsp/efivar/efivar_38.bb
+++ b/meta/recipes-bsp/efivar/efivar_38.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \
file://efisecdb-fix-build-with-musl-libc.patch \
file://0001-Fix-invalid-free-in-main.patch \
file://0001-Fix-glibc-2.36-build-mount.h-conflicts.patch \
+ file://0001-Use-off_t-instead-of-off64_t.patch \
"
SRCREV = "1753149d4176ebfb2b135ac0aaf79340bf0e7a93"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/11] ltp: Fix largefile support
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (3 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 05/11] efivar: Replace off64_t with off_t Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 07/11] acl: Enable largefile support by default Khem Raj
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...0001-testcases-Fix-largefile-support.patch | 426 ++++++++++++++++++
meta/recipes-extended/ltp/ltp_20220930.bb | 1 +
2 files changed, 427 insertions(+)
create mode 100644 meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch
diff --git a/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch b/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch
new file mode 100644
index 0000000000..e9b48c392f
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch
@@ -0,0 +1,426 @@
+From 3cca69b85c88c6eb4f02313b3c6a9e0f6cc0b5d7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 14 Dec 2022 18:14:22 -0800
+Subject: [PATCH] testcases: Fix largefile support
+
+Use standard functions ( not 64-bit equivalents ) which operate on off_t
+and pass -D_FILE_OFFSET_BITS=64 to enable LFS always so off_t is 64bit
+for these tests.
+
+This helps making it portable across musl which has removed the 64bit
+transition functions from _GNU_SOURCE namespace.
+
+Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2022-December/032310.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ testcases/kernel/io/direct_io/Makefile | 2 +-
+ testcases/kernel/io/direct_io/diotest2.c | 4 ++--
+ testcases/kernel/io/direct_io/diotest5.c | 10 +++++-----
+ testcases/kernel/io/direct_io/diotest6.c | 4 ++--
+ testcases/kernel/syscalls/fcntl/fcntl18.c | 6 +++---
+ testcases/kernel/syscalls/fcntl/fcntl34.c | 2 +-
+ testcases/kernel/syscalls/fcntl/fcntl36.c | 4 ++--
+ testcases/kernel/syscalls/llseek/Makefile | 2 ++
+ testcases/kernel/syscalls/llseek/llseek01.c | 14 +++++++-------
+ testcases/kernel/syscalls/llseek/llseek02.c | 12 ++++++------
+ testcases/kernel/syscalls/llseek/llseek03.c | 6 +++---
+ testcases/kernel/syscalls/open/Makefile | 2 ++
+ testcases/kernel/syscalls/open/open12.c | 6 +++---
+ testcases/kernel/syscalls/openat/Makefile | 2 ++
+ testcases/kernel/syscalls/openat/openat02.c | 6 +++---
+ testcases/kernel/syscalls/sync_file_range/Makefile | 2 ++
+ .../syscalls/sync_file_range/sync_file_range01.c | 4 ++--
+ .../syscalls/sync_file_range/sync_file_range02.c | 6 +++---
+ 18 files changed, 51 insertions(+), 43 deletions(-)
+
+diff --git a/testcases/kernel/io/direct_io/Makefile b/testcases/kernel/io/direct_io/Makefile
+index 777f7b166..7480d7b0d 100644
+--- a/testcases/kernel/io/direct_io/Makefile
++++ b/testcases/kernel/io/direct_io/Makefile
+@@ -5,7 +5,7 @@ top_srcdir ?= ../../../..
+
+ include $(top_srcdir)/include/mk/testcases.mk
+
+-CFLAGS += -DSHARED_OFILE -D_GNU_SOURCE
++CFLAGS += -DSHARED_OFILE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+ LDLIBS += -lpthread
+
+diff --git a/testcases/kernel/io/direct_io/diotest2.c b/testcases/kernel/io/direct_io/diotest2.c
+index c407c46ae..db47ee8ef 100644
+--- a/testcases/kernel/io/direct_io/diotest2.c
++++ b/testcases/kernel/io/direct_io/diotest2.c
+@@ -78,7 +78,7 @@ int bufsize = BUFSIZE;
+ * For each iteration, write data starting at offse+iter*bufsize
+ * location in the file and read from there.
+ */
+-int runtest(int fd_r, int fd_w, int iter, off64_t offset, int action)
++int runtest(int fd_r, int fd_w, int iter, off_t offset, int action)
+ {
+ char *buf1;
+ char *buf2;
+@@ -136,7 +136,7 @@ static void cleanup(void);
+ int main(int argc, char *argv[])
+ {
+ int iter = 100; /* Iterations. Default 100 */
+- off64_t offset = 0; /* Offset. Default 0 */
++ off_t offset = 0; /* Offset. Default 0 */
+ int i, action, fd_r, fd_w;
+ int fail_count = 0, total = 0, failed = 0;
+
+diff --git a/testcases/kernel/io/direct_io/diotest5.c b/testcases/kernel/io/direct_io/diotest5.c
+index 9bf917c64..ac66f2a04 100644
+--- a/testcases/kernel/io/direct_io/diotest5.c
++++ b/testcases/kernel/io/direct_io/diotest5.c
+@@ -75,14 +75,14 @@ int TST_TOTAL = 3; /* Total number of test conditions */
+ static int bufsize = BUFSIZE; /* Buffer size. Default 4k */
+ static int iter = 20; /* Iterations. Default 20 */
+ static int nvector = 20; /* Vector array. Default 20 */
+-static off64_t offset = 0; /* Start offset. Default 0 */
++static off_t offset = 0; /* Start offset. Default 0 */
+ static char filename[LEN]; /* Test data file */
+ static int fd1 = -1;
+ /*
+ * runtest: Write the data in vector array to the file. Read the data
+ * from the file into another vectory array and verify. Repeat the test.
+ */
+-int runtest(int fd_r, int fd_w, int iter, off64_t offset, int action)
++int runtest(int fd_r, int fd_w, int iter, off_t offset, int action)
+ {
+ int i;
+ struct iovec *iov1, *iov2, *iovp;
+@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
+ tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s",
+ filename, strerror(errno));
+ }
+- if ((fd_r = open64(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) {
++ if ((fd_r = open(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) {
+ tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s",
+ filename, strerror(errno));
+ }
+@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
+ tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s",
+ filename, strerror(errno));
+ }
+- if ((fd_r = open64(filename, O_RDONLY | O_CREAT, 0666)) < 0) {
++ if ((fd_r = open(filename, O_RDONLY | O_CREAT, 0666)) < 0) {
+ tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s",
+ filename, strerror(errno));
+ }
+@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
+ tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s",
+ filename, strerror(errno));
+ }
+- if ((fd_r = open64(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) {
++ if ((fd_r = open(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) {
+ tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s",
+ filename, strerror(errno));
+ }
+diff --git a/testcases/kernel/io/direct_io/diotest6.c b/testcases/kernel/io/direct_io/diotest6.c
+index a06e6b82b..1905380f0 100644
+--- a/testcases/kernel/io/direct_io/diotest6.c
++++ b/testcases/kernel/io/direct_io/diotest6.c
+@@ -62,7 +62,7 @@ int TST_TOTAL = 3;
+
+ static int iter = 100;
+ static int bufsize = BUFSIZE;
+-static off64_t offset = 0;
++static off_t offset = 0;
+ static int nvector = 20;
+ static char filename[LEN];
+ static int fd1 = -1;
+@@ -84,7 +84,7 @@ static void prg_usage(void)
+ */
+ int runtest(int fd_r, int fd_w, int childnum, int action)
+ {
+- off64_t seekoff;
++ off_t seekoff;
+ int i, ret = -1;
+ ssize_t n = 0;
+ struct iovec *iov_r, *iov_w;
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl18.c b/testcases/kernel/syscalls/fcntl/fcntl18.c
+index 5eefbd128..1105dd393 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl18.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl18.c
+@@ -103,11 +103,11 @@ int main(int ac, char **av)
+ tst_resm(TINFO, "Enter block 2");
+ fail = 0;
+ /* Error condition if address is bad */
+- retval = fcntl(fd, F_GETLK64, (struct flock *)INVAL_FLAG);
++ retval = fcntl(fd, F_GETLK, (struct flock *)INVAL_FLAG);
+ if (errno == EFAULT) {
+- tst_resm(TPASS, "Test F_GETLK64: for errno EFAULT PASSED");
++ tst_resm(TPASS, "Test F_GETLK: for errno EFAULT PASSED");
+ } else {
+- tst_resm(TFAIL, "Test F_GETLK64: for errno EFAULT FAILED");
++ tst_resm(TFAIL, "Test F_GETLK: for errno EFAULT FAILED");
+ fail = 1;
+ }
+ if (fail) {
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c b/testcases/kernel/syscalls/fcntl/fcntl34.c
+index 3442114ff..536dead29 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl34.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl34.c
+@@ -54,7 +54,7 @@ void *thread_fn_01(void *arg)
+
+ memset(buf, (intptr_t)arg, write_size);
+
+- struct flock64 lck = {
++ struct flock lck = {
+ .l_whence = SEEK_SET,
+ .l_start = 0,
+ .l_len = 1,
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
+index d6b07fc41..4e4d48afc 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
+@@ -72,7 +72,7 @@ static void *fn_ofd_w(void *arg)
+ int fd = SAFE_OPEN(fname, O_RDWR);
+ long wt = pa->cnt;
+
+- struct flock64 lck = {
++ struct flock lck = {
+ .l_whence = SEEK_SET,
+ .l_start = pa->offset,
+ .l_len = pa->length,
+@@ -151,7 +151,7 @@ static void *fn_ofd_r(void *arg)
+ int i;
+ int fd = SAFE_OPEN(fname, O_RDWR);
+
+- struct flock64 lck = {
++ struct flock lck = {
+ .l_whence = SEEK_SET,
+ .l_start = pa->offset,
+ .l_len = pa->length,
+diff --git a/testcases/kernel/syscalls/llseek/Makefile b/testcases/kernel/syscalls/llseek/Makefile
+index 044619fb8..8a916d0fa 100644
+--- a/testcases/kernel/syscalls/llseek/Makefile
++++ b/testcases/kernel/syscalls/llseek/Makefile
+@@ -6,3 +6,5 @@ top_srcdir ?= ../../../..
+ include $(top_srcdir)/include/mk/testcases.mk
+
+ include $(top_srcdir)/include/mk/generic_leaf_target.mk
++
++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+diff --git a/testcases/kernel/syscalls/llseek/llseek01.c b/testcases/kernel/syscalls/llseek/llseek01.c
+index 50f35493d..efb444dc8 100644
+--- a/testcases/kernel/syscalls/llseek/llseek01.c
++++ b/testcases/kernel/syscalls/llseek/llseek01.c
+@@ -4,7 +4,7 @@
+ * 07/2001 Ported by Wayne Boyer
+ */
+ /*
+- * Verify that lseek64() call succeeds to set the file pointer position to an
++ * Verify that lseek() call succeeds to set the file pointer position to an
+ * offset larger than file size limit (RLIMIT_FSIZE). Also, verify that any
+ * attempt to write to this location fails.
+ */
+@@ -27,22 +27,22 @@ static int fildes;
+
+ static void verify_llseek(void)
+ {
+- TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET));
++ TEST(lseek(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET));
+ if (TST_RET == (80 * BUFSIZ))
+- tst_res(TPASS, "lseek64() can set file pointer position larger than file size limit");
++ tst_res(TPASS, "lseek() can set file pointer position larger than file size limit");
+ else
+- tst_res(TFAIL, "lseek64() returned wrong value %ld when write past file size", TST_RET);
++ tst_res(TFAIL, "lseek() returned wrong value %ld when write past file size", TST_RET);
+
+ if (write(fildes, write_buff, BUFSIZ) == -1)
+ tst_res(TPASS,"write failed after file size limit");
+ else
+ tst_brk(TFAIL, "write successful after file size limit");
+
+- TEST(lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET));
++ TEST(lseek(fildes, (loff_t) BUFSIZ, SEEK_SET));
+ if (TST_RET == BUFSIZ)
+- tst_res(TPASS,"lseek64() can set file pointer position under filer size limit");
++ tst_res(TPASS,"lseek() can set file pointer position under filer size limit");
+ else
+- tst_brk(TFAIL,"lseek64() returns wrong value %ld when write under file size", TST_RET);
++ tst_brk(TFAIL,"lseek() returns wrong value %ld when write under file size", TST_RET);
+
+ if (write(fildes, write_buff, BUFSIZ) != -1)
+ tst_res(TPASS, "write succcessfully under file size limit");
+diff --git a/testcases/kernel/syscalls/llseek/llseek02.c b/testcases/kernel/syscalls/llseek/llseek02.c
+index 3d9c21fc9..5431969f9 100644
+--- a/testcases/kernel/syscalls/llseek/llseek02.c
++++ b/testcases/kernel/syscalls/llseek/llseek02.c
+@@ -5,8 +5,8 @@
+ */
+ /*
+ * Description:
+- * 1) lseek64(2) fails and sets errno to EINVAL when whence is invalid.
+- * 2) lseek64(2) fails ans sets errno to EBADF when fd is not an open
++ * 1) lseek(2) fails and sets errno to EINVAL when whence is invalid.
++ * 2) lseek(2) fails ans sets errno to EBADF when fd is not an open
+ * file descriptor.
+ */
+
+@@ -39,17 +39,17 @@ static void verify_llseek(unsigned int n)
+ {
+ struct tcase *tc = &tcases[n];
+
+- TEST(lseek64(*tc->fd, (loff_t) 1, tc->whence));
++ TEST(lseek(*tc->fd, (loff_t) 1, tc->whence));
+ if (TST_RET != (off_t) -1) {
+- tst_res(TFAIL, "lseek64(%d, 1, %d) succeeded unexpectedly (%ld)",
++ tst_res(TFAIL, "lseek(%d, 1, %d) succeeded unexpectedly (%ld)",
+ *tc->fd, tc->whence, TST_RET);
+ return;
+ }
+ if (TST_ERR == tc->exp_err) {
+- tst_res(TPASS | TTERRNO, "lseek64(%d, 1, %d) failed as expected",
++ tst_res(TPASS | TTERRNO, "lseek(%d, 1, %d) failed as expected",
+ *tc->fd, tc->whence);
+ } else {
+- tst_res(TFAIL | TTERRNO, "lseek64(%d, 1, %d) failed "
++ tst_res(TFAIL | TTERRNO, "lseek(%d, 1, %d) failed "
+ "unexpectedly, expected %s", *tc->fd, tc->whence,
+ tst_strerrno(tc->exp_err));
+ }
+diff --git a/testcases/kernel/syscalls/llseek/llseek03.c b/testcases/kernel/syscalls/llseek/llseek03.c
+index d780f2af6..6c34119e5 100644
+--- a/testcases/kernel/syscalls/llseek/llseek03.c
++++ b/testcases/kernel/syscalls/llseek/llseek03.c
+@@ -72,7 +72,7 @@ static const char *str_whence(int whence)
+ }
+ }
+
+-static void verify_lseek64(unsigned int n)
++static void verify_lseek(unsigned int n)
+ {
+ struct tcase *tc = &tcases[n];
+ char read_buf[128];
+@@ -82,7 +82,7 @@ static void verify_lseek64(unsigned int n)
+
+ SAFE_READ(1, fd, read_buf, 4);
+
+- TEST(lseek64(fd, tc->off, tc->whence));
++ TEST(lseek(fd, tc->off, tc->whence));
+
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO, "llseek failed on %s ", TEST_FILE);
+@@ -121,6 +121,6 @@ exit:
+ static struct tst_test test = {
+ .needs_tmpdir = 1,
+ .setup = setup,
+- .test = verify_lseek64,
++ .test = verify_lseek,
+ .tcnt = ARRAY_SIZE(tcases),
+ };
+diff --git a/testcases/kernel/syscalls/open/Makefile b/testcases/kernel/syscalls/open/Makefile
+index 044619fb8..8a916d0fa 100644
+--- a/testcases/kernel/syscalls/open/Makefile
++++ b/testcases/kernel/syscalls/open/Makefile
+@@ -6,3 +6,5 @@ top_srcdir ?= ../../../..
+ include $(top_srcdir)/include/mk/testcases.mk
+
+ include $(top_srcdir)/include/mk/generic_leaf_target.mk
++
++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+diff --git a/testcases/kernel/syscalls/open/open12.c b/testcases/kernel/syscalls/open/open12.c
+index bdf29a9a8..c840de53d 100644
+--- a/testcases/kernel/syscalls/open/open12.c
++++ b/testcases/kernel/syscalls/open/open12.c
+@@ -233,14 +233,14 @@ static void test_cloexec(void)
+ static void test_largefile(void)
+ {
+ int fd;
+- off64_t offset;
++ off_t offset;
+
+ fd = SAFE_OPEN(cleanup, LARGE_FILE,
+ O_LARGEFILE | O_RDWR | O_CREAT, 0777);
+
+- offset = lseek64(fd, 4.1*1024*1024*1024, SEEK_SET);
++ offset = lseek(fd, 4.1*1024*1024*1024, SEEK_SET);
+ if (offset == -1)
+- tst_brkm(TBROK | TERRNO, cleanup, "lseek64 failed");
++ tst_brkm(TBROK | TERRNO, cleanup, "lseek failed");
+
+ SAFE_WRITE(cleanup, 1, fd, LARGE_FILE, sizeof(LARGE_FILE));
+
+diff --git a/testcases/kernel/syscalls/openat/Makefile b/testcases/kernel/syscalls/openat/Makefile
+index 044619fb8..8a916d0fa 100644
+--- a/testcases/kernel/syscalls/openat/Makefile
++++ b/testcases/kernel/syscalls/openat/Makefile
+@@ -6,3 +6,5 @@ top_srcdir ?= ../../../..
+ include $(top_srcdir)/include/mk/testcases.mk
+
+ include $(top_srcdir)/include/mk/generic_leaf_target.mk
++
++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+diff --git a/testcases/kernel/syscalls/openat/openat02.c b/testcases/kernel/syscalls/openat/openat02.c
+index 2ce119033..f6113852a 100644
+--- a/testcases/kernel/syscalls/openat/openat02.c
++++ b/testcases/kernel/syscalls/openat/openat02.c
+@@ -22,7 +22,7 @@
+ * 2)openat() succeeds to enable the close-on-exec flag for a
+ * file descriptor, when 'flags' is set to O_CLOEXEC.
+ * 3)openat() succeeds to allow files whose sizes cannot be
+- * represented in an off_t but can be represented in an off64_t
++ * represented in an off_t but can be represented in an off_t
+ * to be opened, when 'flags' is set to O_LARGEFILE.
+ * 4)openat() succeeds to not update the file last access time
+ * (st_atime in the inode) when the file is read, when 'flags'
+@@ -193,12 +193,12 @@ void testfunc_cloexec(void)
+ void testfunc_largefile(void)
+ {
+ int fd;
+- off64_t offset;
++ off_t offset;
+
+ fd = SAFE_OPEN(cleanup, LARGE_FILE,
+ O_LARGEFILE | O_RDWR | O_CREAT, 0777);
+
+- offset = lseek64(fd, 4.1*1024*1024*1024, SEEK_SET);
++ offset = lseek(fd, 4.1*1024*1024*1024, SEEK_SET);
+ if (offset == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "lseek64 failed");
+
+diff --git a/testcases/kernel/syscalls/sync_file_range/Makefile b/testcases/kernel/syscalls/sync_file_range/Makefile
+index 044619fb8..8a916d0fa 100644
+--- a/testcases/kernel/syscalls/sync_file_range/Makefile
++++ b/testcases/kernel/syscalls/sync_file_range/Makefile
+@@ -6,3 +6,5 @@ top_srcdir ?= ../../../..
+ include $(top_srcdir)/include/mk/testcases.mk
+
+ include $(top_srcdir)/include/mk/generic_leaf_target.mk
++
++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
+index 187ef6071..47188aa48 100644
+--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
++++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
+@@ -44,8 +44,8 @@ static int bfd = -1;
+
+ struct test_case {
+ int *fd;
+- off64_t offset;
+- off64_t nbytes;
++ off_t offset;
++ off_t nbytes;
+ unsigned int flags;
+ int error;
+ } tcases[] = {
+diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+index 5da751c70..28a8156c8 100644
+--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
++++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+@@ -31,10 +31,10 @@
+
+ struct testcase {
+ char *fname;
+- off64_t sync_off;
+- off64_t sync_size;
++ off_t sync_off;
++ off_t sync_size;
+ size_t exp_sync_size;
+- off64_t write_off;
++ off_t write_off;
+ size_t write_size_mb;
+ const char *desc;
+ };
diff --git a/meta/recipes-extended/ltp/ltp_20220930.bb b/meta/recipes-extended/ltp/ltp_20220930.bb
index 405b17b637..568a6320c1 100644
--- a/meta/recipes-extended/ltp/ltp_20220930.bb
+++ b/meta/recipes-extended/ltp/ltp_20220930.bb
@@ -29,6 +29,7 @@ SRCREV = "b763f81998f19f783982d3937d1fd05bcf649c16"
SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \
file://0001-Remove-OOM-tests-from-runtest-mm.patch \
file://disable_hanging_tests.patch \
+ file://0001-testcases-Fix-largefile-support.patch \
"
S = "${WORKDIR}/git"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/11] acl: Enable largefile support by default
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (4 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 06/11] ltp: Fix largefile support Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support Khem Raj
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: 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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...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
diff --git a/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch b/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch
new file mode 100644
index 0000000000..775675e1f2
--- /dev/null
+++ b/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch
@@ -0,0 +1,39 @@
+From 1a5671a4eb13b81b98c3e71f00370781563f66d8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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: Backport [https://git.savannah.nongnu.org/cgit/acl.git/commit/?id=2b42f64737adf6a2ddd491213580d6e9cdd2f5af]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-support/attr/acl_2.3.1.bb b/meta/recipes-support/attr/acl_2.3.1.bb
index aca04a9aac..5fb8f9ae35 100644
--- a/meta/recipes-support/attr/acl_2.3.1.bb
+++ b/meta/recipes-support/attr/acl_2.3.1.bb
@@ -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}"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (5 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 07/11] acl: Enable largefile support by default Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 9:14 ` [OE-core] " Alexander Kanavin
2022-12-15 8:45 ` [PATCH 09/11] libpciaccess: " Khem Raj
` (2 subsequent siblings)
9 siblings, 1 reply; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave
like 64bit variants. Moreover it makes them portable across libc
Ensure that right lseek function is used with _FILE_OFFSET_BITS = 64
Refresh patches with devtool
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...-to-enable-disable-largefile-support.patch | 57 +++++++++++++++++++
...t-lseek-when-_FILE_OFFSET_BITS-is-64.patch | 37 ++++++++++++
...-missing-check-for-permission-denied.patch | 2 +-
.../e2fsprogs/e2fsprogs/quiet-debugfs.patch | 2 +-
.../e2fsprogs/e2fsprogs_1.46.5.bb | 4 +-
5 files changed, 99 insertions(+), 3 deletions(-)
create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch
create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch
new file mode 100644
index 0000000000..5e3730ca40
--- /dev/null
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch
@@ -0,0 +1,57 @@
+From 6fab3346d448298a24cee1faeb5fc8507a3b9712 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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: Submitted [https://sourceforge.net/p/e2fsprogs/code/merge-requests/4/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch
new file mode 100644
index 0000000000..a219296b89
--- /dev/null
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch
@@ -0,0 +1,37 @@
+From 1a8aaa8ff7f4aca68b5ae964458e49ab16b4315f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 14 Dec 2022 20:56:44 -0800
+Subject: [PATCH] ext2fs: Use 64bit lseek when _FILE_OFFSET_BITS is 64
+
+Use lseek() with 64bit off_t when _FILE_OFFSET_BITS is 64
+this fixes build with musl where there is no _llseek but lseek
+is using off_t which is 64bit on musl
+
+Upstream-Status: Submitted [https://sourceforge.net/p/e2fsprogs/code/merge-requests/4/]
+Signe-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/ext2fs/llseek.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c
+index 922a0d56..45f21d09 100644
+--- a/lib/ext2fs/llseek.c
++++ b/lib/ext2fs/llseek.c
+@@ -51,7 +51,7 @@ extern long long llseek (int fd, long long offset, int origin);
+
+ #else /* ! HAVE_LLSEEK */
+
+-#if SIZEOF_LONG == SIZEOF_LONG_LONG
++#if SIZEOF_LONG == SIZEOF_LONG_LONG || _FILE_OFFSET_BITS+0 == 64
+
+ #define my_llseek lseek
+
+@@ -69,7 +69,7 @@ static int _llseek (unsigned int, unsigned long,
+
+ static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
+ unsigned long, offset_low,ext2_loff_t *,result,
+- unsigned int, origin)
++ unsigned int, origin);
+ #endif
+
+ static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch
index 29078f9dd3..92bd0d0c1f 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch
@@ -1,4 +1,4 @@
-From 22d7557905534d9e1b39f7d2a6d2036a40bf0c4e Mon Sep 17 00:00:00 2001
+From cce489c96aa3f4272a19d2137c2a46b439636712 Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Wed, 10 Aug 2016 11:19:44 +0800
Subject: [PATCH] Fix missing check for permission denied.
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch
index 902a369eb0..d695580c92 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch
@@ -1,4 +1,4 @@
-From 5408b6463ee700a080a15102bccccdeb2615d734 Mon Sep 17 00:00:00 2001
+From 20bf59365646af0466c1910e8763b352380b26d6 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Mon, 23 Dec 2013 13:38:34 +0000
Subject: [PATCH] e2fsprogs: silence debugfs
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
index 5b2d1921f0..ceceb7edcc 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
@@ -5,6 +5,8 @@ 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 \
+ file://0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch \
"
SRC_URI:append:class-native = " \
file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
@@ -17,7 +19,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"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/11] libpciaccess: Do not use 64bit functions for largefile support
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (6 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 10/11] mdadm: Use _FILE_OFFSET_BITS to use " Khem Raj
2022-12-15 8:45 ` [PATCH 11/11] btrfs-tools: Do not use 64bit functions for " Khem Raj
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave
like 64bit variants. Moreover it makes them portable across libc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...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
diff --git a/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch b/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch
new file mode 100644
index 0000000000..512a473e20
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch
@@ -0,0 +1,39 @@
+From d20ff4f2e4feaafa6a6191b9cae3815b85617943 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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: Submitted [https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/merge_requests/26]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb b/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb
index 06c30384ab..309354e872 100644
--- a/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb
+++ b/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb
@@ -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"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/11] mdadm: Use _FILE_OFFSET_BITS to use largefile support
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (7 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 09/11] libpciaccess: " Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
2022-12-15 8:45 ` [PATCH 11/11] btrfs-tools: Do not use 64bit functions for " Khem Raj
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...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
diff --git a/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch b/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch
new file mode 100644
index 0000000000..142ed355ef
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch
@@ -0,0 +1,147 @@
+From 6b861a267a6ef6f60f6cc21e4c8e6d7cdd2451dc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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/20221110225546.337164-1-raj.khem@gmail.com/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ restripe.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/restripe.c
++++ b/restripe.c
+@@ -22,6 +22,9 @@
+ * Email: <neilb@suse.de>
+ */
+
++/* 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) {
diff --git a/meta/recipes-extended/mdadm/mdadm_4.2.bb b/meta/recipes-extended/mdadm/mdadm_4.2.bb
index 19035caaec..7298860241 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.2.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.2.bb
@@ -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"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 11/11] btrfs-tools: Do not use 64bit functions for largefile support
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
` (8 preceding siblings ...)
2022-12-15 8:45 ` [PATCH 10/11] mdadm: Use _FILE_OFFSET_BITS to use " Khem Raj
@ 2022-12-15 8:45 ` Khem Raj
9 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2022-12-15 8:45 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Using -D_FILE_OFFSET_BITS=64 already makes the normal function behave
like 64bit variants. Moreover it makes them portable across libc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...-ftruncate-stat-instead-of-64bit-equ.patch | 903 ++++++++++++++++++
.../btrfs-tools/btrfs-tools_6.0.2.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
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch
new file mode 100644
index 0000000000..2618687088
--- /dev/null
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch
@@ -0,0 +1,903 @@
+From 37425f422e46003ed623f8e6387bed1aa5778b96 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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: Submitted [https://lore.kernel.org/linux-btrfs/20221215084046.122836-1-raj.khem@gmail.com/T/#u]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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);
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.2.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.2.bb
index 872fba6b6d..aa48422080 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.2.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.2.bb
@@ -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 = "ff964ba6aef98bd1bafe8ff9b0088501b30bdd27"
S = "${WORKDIR}/git"
--
2.39.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [OE-core] [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support
2022-12-15 8:45 ` [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support Khem Raj
@ 2022-12-15 9:14 ` Alexander Kanavin
0 siblings, 0 replies; 12+ messages in thread
From: Alexander Kanavin @ 2022-12-15 9:14 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-core
On Thu, 15 Dec 2022 at 09:45, Khem Raj <raj.khem@gmail.com> wrote:
> +Upstream-Status: Submitted [https://sourceforge.net/p/e2fsprogs/code/merge-requests/4/]
Development is happening on github, please re-submit there:
https://github.com/tytso/e2fsprogs
Alex
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-12-15 9:14 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 8:45 [PATCH 01/11] erofs-utils: Convert from off64_t to off_t Khem Raj
2022-12-15 8:45 ` [PATCH 02/11] pseudo: Remove 64bit time_t flags Khem Raj
2022-12-15 8:45 ` [PATCH 03/11] unfs3: Define off64_t in terms of off_t on musl Khem Raj
2022-12-15 8:45 ` [PATCH 04/11] acpid: Fix largefile enabled build Khem Raj
2022-12-15 8:45 ` [PATCH 05/11] efivar: Replace off64_t with off_t Khem Raj
2022-12-15 8:45 ` [PATCH 06/11] ltp: Fix largefile support Khem Raj
2022-12-15 8:45 ` [PATCH 07/11] acl: Enable largefile support by default Khem Raj
2022-12-15 8:45 ` [PATCH 08/11] e2fsprogs: Do not use 64bit functions for largefile support Khem Raj
2022-12-15 9:14 ` [OE-core] " Alexander Kanavin
2022-12-15 8:45 ` [PATCH 09/11] libpciaccess: " Khem Raj
2022-12-15 8:45 ` [PATCH 10/11] mdadm: Use _FILE_OFFSET_BITS to use " Khem Raj
2022-12-15 8:45 ` [PATCH 11/11] btrfs-tools: Do not use 64bit functions for " Khem Raj
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.