[Mod] First commit

This commit is contained in:
2022-10-31 22:18:58 +08:00
commit 1c8a3d9709
13090 changed files with 526733 additions and 0 deletions

View File

@ -0,0 +1,52 @@
From d5cbb4f43cc9c30100fbf18a3e0d1fb95e1c1b0a Mon Sep 17 00:00:00 2001
From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Date: Wed, 25 Nov 2015 10:50:00 +0000
Subject: [PATCH] mdrestore, scrub: do not do dynamic linking of libtool
libraries
As explained in commit ece49daeff1a3cad765e106d678c608925c9d768, use
-static-libtool-libs instead of -static to allow fallback to the dynamic
linking for libuuid only. Otherwise the build will fail like this:
ld: attempted static link of dynamic object `/usr/lib/libuuid.so'
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
[Sent upstream: https://www.spinics.net/lists/xfs/msg36149.html]
[baruch: update for v4.15.1; extend to include scrub]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
[matt: update for v4.16.1; adjusted libunistring -> libicu]
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
---
mdrestore/Makefile | 2 +-
scrub/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mdrestore/Makefile b/mdrestore/Makefile
index 136ae716d691..75ff1bad78e9 100644
--- a/mdrestore/Makefile
+++ b/mdrestore/Makefile
@@ -10,7 +10,7 @@ CFILES = xfs_mdrestore.c
LLDLIBS = $(LIBXFS) $(LIBFROG) $(LIBRT) $(LIBPTHREAD) $(LIBUUID)
LTDEPENDENCIES = $(LIBXFS) $(LIBFROG)
-LLDFLAGS = -static
+LLDFLAGS = -static-libtool-libs
default: depend $(LTCOMMAND)
diff --git a/scrub/Makefile b/scrub/Makefile
index 063279400262..949f6fd8ba94 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -70,7 +70,7 @@ xfs_scrub.c
LLDLIBS += $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBICU_LIBS) $(LIBRT)
LTDEPENDENCIES += $(LIBHANDLE) $(LIBFROG)
-LLDFLAGS = -static
+LLDFLAGS = -static-libtool-libs
ifeq ($(HAVE_MALLINFO),yes)
LCFLAGS += -DHAVE_MALLINFO
--
2.16.2

View File

@ -0,0 +1,44 @@
From 3a77dfc54271059dcac305384bf6ace34fe1f3d3 Mon Sep 17 00:00:00 2001
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Date: Sun, 18 Dec 2016 15:37:27 +0100
Subject: [PATCH] libxfs: do not try to run the crc32selftest
Even though the crc32selftest is natively compiled (because it is to be
executed), it fails in cross-compilation as the host may lack the
required headers, like uuid/uuid.h (e.g. in a minimal environment).
Moreover, running the crc32selftest natively is completely wrong,
because it passing on the host does not mean it would still pass n the
target (because endianness or bitness or alignment differences).
So, just disable running the crc32selftest altogether.
Note that there's a remaining bug-in-hiding, because the crc32 table
generator is natively built, but with the target CFLAGS.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Fabrice Fontaine" <fontaine.fabrice@gmail.com>
[Update for 4.18.0: crc32 has been moved from libxfs to libfrog]
---
libxfs/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libfrog/Makefile b/libxfs/Makefile
index 62608bd..e021625 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -112,9 +112,9 @@ LTLIBS = $(LIBPTHREAD) $(LIBRT)
# don't try linking xfs_repair with a debug libxfs.
DEBUG = -DNDEBUG
-LDIRT = gen_crc32table crc32table.h crc32selftest
+LDIRT = gen_crc32table crc32table.h
-default: crc32selftest ltdepend $(LTLIBRARY)
+default: ltdepend $(LTLIBRARY)
crc32table.h: gen_crc32table.c
@echo " [CC] gen_crc32table"
--
2.7.4

View File

@ -0,0 +1,187 @@
From b82bd75c80aadcc2890b23f63eec9ba2c560b2e5 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <djwong@kernel.org>
Date: Thu, 4 Aug 2022 21:26:43 -0500
Subject: [PATCH] libxfs: stop overriding MAP_SYNC in publicly exported header
files
Florian Fainelli most recently reported that xfsprogs doesn't build with
musl on mips:
"MIPS platforms building with recent kernel headers and the musl-libc
toolchain will expose the following build failure:
mmap.c: In function 'mmap_f':
mmap.c:196:12: error: 'MAP_SYNC' undeclared (first use in this function); did you mean 'MS_SYNC'?
196 | flags = MAP_SYNC | MAP_SHARED_VALIDATE;
| ^~~~~~~~
| MS_SYNC
mmap.c:196:12: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [../include/buildrules:81: mmap.o] Error 1"
At first glance, the build failure here is caused by the fact that:
1. The configure script doesn't detect MAP_SYNC support
2. The build system doesn't set HAVE_MAP_SYNC
2. io/mmap.c includes input.h -> projects.h -> xfs.h and later sys/mman.h
3. include/linux.h #define's MAP_SYNC to 0 if HAVE_MAP_SYNC is not set
4. musl's sys/mman.h #undef MAP_SYNC on platforms that don't support it
5. io/mmap.c tries to use MAP_SYNC, not realizing that libc undefined it
Normally, xfs_io only exports functionality that is defined by the libc
and/or kernel headers on the build system. We often make exceptions for
new functionality so that we have a way to test them before the header
file packages catch up, hence this '#ifndef HAVE_FOO #define FOO'
paradigm.
MAP_SYNC is a gross and horribly broken example of this. These support
crutches are supposed to be *private* to xfsprogs for benefit of early
testing, but they were instead added to include/linux.h, which we
provide to user programs in the xfslibs-dev package. IOWs, we've been
Worst yet, gcc 11.3 doesn't even warn about overriding a #define to 0:
int main(int argc, char *argv[]) {
printf("MAP_SYNC 0x%x\n", MAP_SYNC);
}
$ gcc -o a a.c -Wall
$ ./a
MAP_SYNC 0x80000
$ gcc -DSTUPID -o a a.c -Wall
$ ./a
MAP_SYNC 0x0
Four years have gone by since the introduction of MAP_SYNC, so let's get
rid of the override code entirely -- any platform that supports MAP_SYNC
has had plenty of chances to ensure their header files have the right
bits. While we're at it, fix AC_HAVE_MAP_SYNC to look for MAP_SYNC in
the same header file that the one user (io/mmap.c) uses -- sys/mman.h.
Annoyingly, I had to test this by hand because the sole fstest that
exercises MAP_SYNC (generic/470) requires dm-logwrites and dm-thinp,
neither of which support fsdax on current kernels.
Reported-by: info@mobile-stream.com
Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
include/linux.h | 8 --------
io/io.h | 2 +-
io/mmap.c | 25 +++++++++++++------------
m4/package_libcdev.m4 | 3 +--
4 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/include/linux.h b/include/linux.h
index de8a71221146..052facc15db5 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -356,14 +356,6 @@ fsmap_advance(
#define HAVE_GETFSMAP
#endif /* HAVE_GETFSMAP */
-#ifndef HAVE_MAP_SYNC
-#define MAP_SYNC 0
-#define MAP_SHARED_VALIDATE 0
-#else
-#include <asm-generic/mman.h>
-#include <asm-generic/mman-common.h>
-#endif /* HAVE_MAP_SYNC */
-
/*
* Reminder: anything added to this file will be compiled into downstream
* userspace projects!
diff --git a/io/io.h b/io/io.h
index 49db902fc44f..64b7a663a8cf 100644
--- a/io/io.h
+++ b/io/io.h
@@ -55,7 +55,7 @@ typedef struct mmap_region {
size_t length; /* length of mapping */
off64_t offset; /* start offset into backing file */
int prot; /* protection mode of the mapping */
- bool map_sync; /* is this a MAP_SYNC mapping? */
+ int flags; /* MAP_* flags passed to mmap() */
char *name; /* name of backing file */
} mmap_region_t;
diff --git a/io/mmap.c b/io/mmap.c
index 8c048a0ab6d0..425957d4b487 100644
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -46,8 +46,11 @@ print_mapping(
for (i = 0, p = pflags; p->prot != PROT_NONE; i++, p++)
buffer[i] = (map->prot & p->prot) ? p->mode : '-';
- if (map->map_sync)
+#ifdef HAVE_MAP_SYNC
+ if ((map->flags & (MAP_SYNC | MAP_SHARED_VALIDATE)) ==
+ (MAP_SYNC | MAP_SHARED_VALIDATE))
sprintf(&buffer[i], " S");
+#endif
printf("%c%03d%c 0x%lx - 0x%lx %s %14s (%lld : %ld)\n",
braces? '[' : ' ', index, braces? ']' : ' ',
@@ -139,7 +142,9 @@ mmap_help(void)
" -r -- map with PROT_READ protection\n"
" -w -- map with PROT_WRITE protection\n"
" -x -- map with PROT_EXEC protection\n"
+#ifdef HAVE_MAP_SYNC
" -S -- map with MAP_SYNC and MAP_SHARED_VALIDATE flags\n"
+#endif
" -s <size> -- first do mmap(size)/munmap(size), try to reserve some free space\n"
" If no protection mode is specified, all are used by default.\n"
"\n"));
@@ -193,18 +198,14 @@ mmap_f(
prot |= PROT_EXEC;
break;
case 'S':
+#ifdef HAVE_MAP_SYNC
flags = MAP_SYNC | MAP_SHARED_VALIDATE;
-
- /*
- * If MAP_SYNC and MAP_SHARED_VALIDATE aren't defined
- * in the system headers we will have defined them
- * both as 0.
- */
- if (!flags) {
- printf("MAP_SYNC not supported\n");
- return 0;
- }
break;
+#else
+ printf("MAP_SYNC not supported\n");
+ exitcode = 1;
+ return command_usage(&mmap_cmd);
+#endif
case 's':
length2 = cvtnum(blocksize, sectsize, optarg);
break;
@@ -281,7 +282,7 @@ mmap_f(
mapping->offset = offset;
mapping->name = filename;
mapping->prot = prot;
- mapping->map_sync = (flags == (MAP_SYNC | MAP_SHARED_VALIDATE));
+ mapping->flags = flags;
return 0;
}
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index adab9bb9773a..3a0c23453176 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -339,8 +339,7 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
AC_DEFUN([AC_HAVE_MAP_SYNC],
[ AC_MSG_CHECKING([for MAP_SYNC])
AC_TRY_COMPILE([
-#include <asm-generic/mman.h>
-#include <asm-generic/mman-common.h>
+#include <sys/mman.h>
], [
int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
], have_map_sync=yes
--
2.25.1

View File

@ -0,0 +1,19 @@
comment "xfsprogs needs a toolchain w/ threads"
depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HAS_THREADS
config BR2_PACKAGE_XFSPROGS
bool "xfsprogs"
depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
depends on BR2_USE_MMU # fork()
depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_INIH
select BR2_PACKAGE_LIBURCU
select BR2_PACKAGE_UTIL_LINUX
select BR2_PACKAGE_UTIL_LINUX_LIBUUID
select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
help
The XFS file system utilities and libraries
http://xfs.org

View File

@ -0,0 +1,6 @@
# From https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/sha256sums.asc
sha256 01ccd3ef9df2837753a5d876b8da84ea957d13d7a461b8c46e8afa4eb09aabc8 xfsprogs-5.14.2.tar.xz
# Hash for license files
sha256 f6b78c087c3ebdf0f3c13415070dd480a3f35d8fc76f3d02180a407c1c812f79 LICENSES/GPL-2.0
sha256 0b9a4febcdee6de55872501d5c1a8f5d8b0d1650cd4d5351995ceb22e889f8ca LICENSES/LGPL-2.1

View File

@ -0,0 +1,32 @@
################################################################################
#
# xfsprogs
#
################################################################################
XFSPROGS_VERSION = 5.14.2
XFSPROGS_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/fs/xfs/xfsprogs
XFSPROGS_SOURCE = xfsprogs-$(XFSPROGS_VERSION).tar.xz
XFSPROGS_LICENSE = GPL-2.0, GPL-2.0+, LGPL-2.1 (libhandle, few headers)
XFSPROGS_LICENSE_FILES = LICENSES/GPL-2.0 LICENSES/LGPL-2.1
XFSPROGS_DEPENDENCIES = inih liburcu util-linux
XFSPROGS_CONF_ENV = ac_cv_header_aio_h=yes ac_cv_lib_rt_lio_listio=yes PLATFORM="linux"
XFSPROGS_CONF_OPTS = \
--enable-lib64=no \
--enable-gettext=no \
INSTALL_USER=root \
INSTALL_GROUP=root \
--enable-static
ifeq ($(BR2_PACKAGE_ICU),y)
XFSPROGS_DEPENDENCIES += icu
XFSPROGS_CONF_OPTS += --enable-libicu
else
XFSPROGS_CONF_OPTS += --disable-libicu
endif
XFSPROGS_INSTALL_TARGET_OPTS = DIST_ROOT=$(TARGET_DIR) install
$(eval $(autotools-package))