1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

e2fsprogs: Do not use 64bit functions for largefile support

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

(From OE-Core rev: 9f150d6bb4bda37e8ec58d576f3312c44fda654e)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2022-12-15 07:44:37 -08:00
committed by Richard Purdie
parent 3c7dfaaa04
commit f520268975
5 changed files with 99 additions and 3 deletions
@@ -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://github.com/tytso/e2fsprogs/pull/129]
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
@@ -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://github.com/tytso/e2fsprogs/pull/129]
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)
@@ -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.
@@ -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
@@ -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"