From c9e678374a2d8b3207cbcd06bb566fbaaab30d9a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 22 May 2020 16:07:58 -0700 Subject: [PATCH 1/2] xfsprogs: import from base Does not seem to be appropriate there. Signed-off-by: Rosen Penev --- utils/xfsprogs/Makefile | 98 +++++++++++++++++++ utils/xfsprogs/patches/100-no-selftest.patch | 14 +++ utils/xfsprogs/patches/110-subdirs.patch | 12 +++ .../xfsprogs/patches/120-disable_assert.patch | 12 +++ ...six_memalign-instead-of-deprecated-v.patch | 26 +++++ .../patches/140-copy-file-range.patch | 48 +++++++++ 6 files changed, 210 insertions(+) create mode 100644 utils/xfsprogs/Makefile create mode 100644 utils/xfsprogs/patches/100-no-selftest.patch create mode 100644 utils/xfsprogs/patches/110-subdirs.patch create mode 100644 utils/xfsprogs/patches/120-disable_assert.patch create mode 100644 utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch create mode 100644 utils/xfsprogs/patches/140-copy-file-range.patch diff --git a/utils/xfsprogs/Makefile b/utils/xfsprogs/Makefile new file mode 100644 index 000000000..f717185bb --- /dev/null +++ b/utils/xfsprogs/Makefile @@ -0,0 +1,98 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=xfsprogs +PKG_CPE_ID:=cpe:/a:sgi:xfsprogs +PKG_RELEASE:=4 +PKG_VERSION:=4.11.0 +PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs +PKG_HASH:=c3a6d87b564d7738243c507df82276bed982265e345363a95f2c764e8a5f5bb2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/xfsprogs/default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=+libuuid +libpthread +librt + URL:=http://oss.sgi.com/projects/xfs +endef + +define Package/xfs-admin +$(call Package/xfsprogs/default) + TITLE:=Utilities for changing parameters of an XFS filesystems +endef + +define Package/xfs-mkfs +$(call Package/xfsprogs/default) + TITLE:=Utility for creating XFS filesystems +endef + +define Package/xfs-fsck +$(call Package/xfsprogs/default) + TITLE:=Utilities for checking and repairing XFS filesystems +endef + +define Package/xfs-growfs +$(call Package/xfsprogs/default) + TITLE:=Utility for increasing the size of XFS filesystems +endef + +CONFIGURE_ARGS += \ + --enable-gettext=no \ + --enable-lib64=no \ + --enable-blkid=no + +TARGET_CFLAGS += \ + -I$(STAGING_DIR)/usr/include \ + -D_LARGEFILE64_SOURCE \ + -D_FILE_OFFSET_BITS=64 \ + -D_GNU_SOURCE + +MAKE_FLAGS += \ + DEBUG= Q= \ + PCFLAGS="-Wall" \ + PKG_PLATFORM=linux \ + ENABLE_GETTEXT=no + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/libxfs crc32table.h CFLAGS="$(HOST_CFLAGS) -I$(PKG_BUILD_DIR)/include" + $(call Build/Compile/Default) +endef + +define Package/xfs-admin/install + mkdir -p $(1)/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_db $(1)/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_admin $(1)/sbin +endef + +define Package/xfs-mkfs/install + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/mkfs.xfs $(1)/usr/sbin +endef + +define Package/xfs-fsck/install + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/xfs_repair $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_db $(1)/usr/sbin +endef + +define Package/xfs-growfs/install + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_growfs $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,xfs-admin)) +$(eval $(call BuildPackage,xfs-mkfs)) +$(eval $(call BuildPackage,xfs-fsck)) +$(eval $(call BuildPackage,xfs-growfs)) diff --git a/utils/xfsprogs/patches/100-no-selftest.patch b/utils/xfsprogs/patches/100-no-selftest.patch new file mode 100644 index 000000000..227016675 --- /dev/null +++ b/utils/xfsprogs/patches/100-no-selftest.patch @@ -0,0 +1,14 @@ +--- a/libxfs/Makefile ++++ b/libxfs/Makefile +@@ -118,9 +118,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" diff --git a/utils/xfsprogs/patches/110-subdirs.patch b/utils/xfsprogs/patches/110-subdirs.patch new file mode 100644 index 000000000..53a6b09ce --- /dev/null +++ b/utils/xfsprogs/patches/110-subdirs.patch @@ -0,0 +1,12 @@ +--- a/Makefile ++++ b/Makefile +@@ -46,8 +46,7 @@ HDR_SUBDIRS = include libxfs + + DLIB_SUBDIRS = libxlog libxcmd libhandle + LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) +-TOOL_SUBDIRS = copy db estimate fsck growfs io logprint mkfs quota \ +- mdrestore repair rtcp m4 man doc debian ++TOOL_SUBDIRS = db fsck growfs io mkfs repair + + ifneq ("$(PKG_PLATFORM)","darwin") + TOOL_SUBDIRS += fsr diff --git a/utils/xfsprogs/patches/120-disable_assert.patch b/utils/xfsprogs/patches/120-disable_assert.patch new file mode 100644 index 000000000..9a970d27a --- /dev/null +++ b/utils/xfsprogs/patches/120-disable_assert.patch @@ -0,0 +1,12 @@ +--- a/libxfs/libxfs_priv.h ++++ b/libxfs/libxfs_priv.h +@@ -84,9 +84,6 @@ extern uint32_t crc32c_le(uint32_t crc, + /* for all the support code that uses progname in error messages */ + extern char *progname; + +-#undef ASSERT +-#define ASSERT(ex) assert(ex) +- + #ifndef EWRONGFS + #define EWRONGFS EINVAL + #endif diff --git a/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch b/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch new file mode 100644 index 000000000..b028db187 --- /dev/null +++ b/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch @@ -0,0 +1,26 @@ +From 930f9aa8f08759fa739dd6e615ba8b3a1890008d Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 6 May 2019 13:56:13 -0700 +Subject: [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc + +valloc is not available with uClibc-ng as well as being deprecated, which +causes compilation errors. aligned_alloc is not available before C11 so +used posix_memalign.' + +Signed-off-by: Rosen Penev +--- + db/malloc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/db/malloc.c ++++ b/db/malloc.c +@@ -56,8 +56,7 @@ xmalloc( + { + void *ptr; + +- ptr = valloc(size); +- if (ptr) ++ if(!posix_memalign(&ptr, sysconf(_SC_PAGESIZE), size)) + return ptr; + badmalloc(); + /* NOTREACHED */ diff --git a/utils/xfsprogs/patches/140-copy-file-range.patch b/utils/xfsprogs/patches/140-copy-file-range.patch new file mode 100644 index 000000000..076d5c95d --- /dev/null +++ b/utils/xfsprogs/patches/140-copy-file-range.patch @@ -0,0 +1,48 @@ +From 8041435de7ed028a27ecca64302945ad455c69a6 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Mon, 5 Feb 2018 14:38:02 -0600 +Subject: [PATCH] xfs_io: fix copy_file_range symbol name collision + +glibc 2.27 has a copy_file_range wrapper, so we need to change our +internal function out of the way to avoid compiler warnings. + +Reported-by: fredrik@crux.nu +Signed-off-by: Darrick J. Wong +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + io/copy_file_range.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/io/copy_file_range.c ++++ b/io/copy_file_range.c +@@ -42,13 +42,18 @@ copy_range_help(void) + ")); + } + ++/* ++ * Issue a raw copy_file_range syscall; for our test program we don't want the ++ * glibc buffered copy fallback. ++ */ + static loff_t +-copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len) ++copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len) + { + loff_t ret; + + do { +- ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0); ++ ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, ++ len, 0); + if (ret == -1) { + perror("copy_range"); + return errno; +@@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv) + copy_dst_truncate(); + } + +- ret = copy_file_range(fd, &src, &dst, len); ++ ret = copy_file_range_cmd(fd, &src, &dst, len); + close(fd); + return ret; + } From 05ce920e12c2bbc0bd80e26101eb8b1019e2e47e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 22 May 2020 16:12:44 -0700 Subject: [PATCH 2/2] xfsprogs: update to 5.5 Reworked Makefile for consistency between packages. Removed librt dependency. clock_gettime does not need it anymore. Updated URL. Add MAP_SYNC workaround as musl undefines MAP_SYNC for MIPS and PPC. Refreshed patches and removed upstream ones Signed-off-by: Rosen Penev --- utils/xfsprogs/Makefile | 57 +++++++++---------- utils/xfsprogs/patches/100-no-selftest.patch | 14 ----- utils/xfsprogs/patches/110-subdirs.patch | 12 ++-- .../xfsprogs/patches/120-disable_assert.patch | 8 +-- ...six_memalign-instead-of-deprecated-v.patch | 2 +- .../patches/140-copy-file-range.patch | 48 ---------------- utils/xfsprogs/patches/140-mman.patch | 13 +++++ 7 files changed, 50 insertions(+), 104 deletions(-) delete mode 100644 utils/xfsprogs/patches/100-no-selftest.patch delete mode 100644 utils/xfsprogs/patches/140-copy-file-range.patch create mode 100644 utils/xfsprogs/patches/140-mman.patch diff --git a/utils/xfsprogs/Makefile b/utils/xfsprogs/Makefile index f717185bb..335c8f711 100644 --- a/utils/xfsprogs/Makefile +++ b/utils/xfsprogs/Makefile @@ -8,15 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xfsprogs -PKG_CPE_ID:=cpe:/a:sgi:xfsprogs -PKG_RELEASE:=4 -PKG_VERSION:=4.11.0 -PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs -PKG_HASH:=c3a6d87b564d7738243c507df82276bed982265e345363a95f2c764e8a5f5bb2 +PKG_VERSION:=5.5.0 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs +PKG_HASH:=cfbb0b136799c48cb79435facd0969c5a60a587a458e2d16f9752771027efbec + PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_CPE_ID:=cpe:/a:sgi:xfsprogs include $(INCLUDE_DIR)/package.mk @@ -24,8 +25,8 @@ define Package/xfsprogs/default SECTION:=utils CATEGORY:=Utilities SUBMENU:=Filesystem - DEPENDS:=+libuuid +libpthread +librt - URL:=http://oss.sgi.com/projects/xfs + DEPENDS:=+libuuid +libpthread + URL:=https://xfs.org/ endef define Package/xfs-admin @@ -49,46 +50,40 @@ $(call Package/xfsprogs/default) endef CONFIGURE_ARGS += \ - --enable-gettext=no \ - --enable-lib64=no \ - --enable-blkid=no - -TARGET_CFLAGS += \ - -I$(STAGING_DIR)/usr/include \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ - -D_GNU_SOURCE - -MAKE_FLAGS += \ - DEBUG= Q= \ - PCFLAGS="-Wall" \ - PKG_PLATFORM=linux \ - ENABLE_GETTEXT=no - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR)/libxfs crc32table.h CFLAGS="$(HOST_CFLAGS) -I$(PKG_BUILD_DIR)/include" - $(call Build/Compile/Default) -endef + --disable-gettext \ + --disable-blkid \ + --disable-readline \ + --disable-editline \ + --disable-termcap \ + --disable-lib64 \ + --disable-librt \ + --disable-ubisan \ + --disable-addrsan \ + --disable-threadsan \ + --disable-scrub \ + --disable-libicu + +TARGET_CFLAGS += -DHAVE_MAP_SYNC define Package/xfs-admin/install - mkdir -p $(1)/sbin + $(INSTALL_DIR) $(1)/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_db $(1)/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_admin $(1)/sbin endef define Package/xfs-mkfs/install - mkdir -p $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/mkfs.xfs $(1)/usr/sbin endef define Package/xfs-fsck/install - mkdir -p $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/xfs_repair $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_db $(1)/usr/sbin endef define Package/xfs-growfs/install - mkdir -p $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xfs_growfs $(1)/usr/sbin endef diff --git a/utils/xfsprogs/patches/100-no-selftest.patch b/utils/xfsprogs/patches/100-no-selftest.patch deleted file mode 100644 index 227016675..000000000 --- a/utils/xfsprogs/patches/100-no-selftest.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/libxfs/Makefile -+++ b/libxfs/Makefile -@@ -118,9 +118,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" diff --git a/utils/xfsprogs/patches/110-subdirs.patch b/utils/xfsprogs/patches/110-subdirs.patch index 53a6b09ce..ad57d608e 100644 --- a/utils/xfsprogs/patches/110-subdirs.patch +++ b/utils/xfsprogs/patches/110-subdirs.patch @@ -1,12 +1,12 @@ --- a/Makefile +++ b/Makefile -@@ -46,8 +46,7 @@ HDR_SUBDIRS = include libxfs - +@@ -62,8 +62,7 @@ HDR_SUBDIRS = include libxfs + LIBFROG_SUBDIR = libfrog DLIB_SUBDIRS = libxlog libxcmd libhandle LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) --TOOL_SUBDIRS = copy db estimate fsck growfs io logprint mkfs quota \ -- mdrestore repair rtcp m4 man doc debian +-TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ +- mdrestore repair rtcp m4 man doc debian spaceman +TOOL_SUBDIRS = db fsck growfs io mkfs repair - ifneq ("$(PKG_PLATFORM)","darwin") - TOOL_SUBDIRS += fsr + ifeq ("$(ENABLE_SCRUB)","yes") + TOOL_SUBDIRS += scrub diff --git a/utils/xfsprogs/patches/120-disable_assert.patch b/utils/xfsprogs/patches/120-disable_assert.patch index 9a970d27a..237c83721 100644 --- a/utils/xfsprogs/patches/120-disable_assert.patch +++ b/utils/xfsprogs/patches/120-disable_assert.patch @@ -1,12 +1,12 @@ --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h -@@ -84,9 +84,6 @@ extern uint32_t crc32c_le(uint32_t crc, +@@ -85,9 +85,6 @@ struct iomap; /* for all the support code that uses progname in error messages */ extern char *progname; -#undef ASSERT -#define ASSERT(ex) assert(ex) - - #ifndef EWRONGFS - #define EWRONGFS EINVAL - #endif + /* + * We have no need for the "linux" dev_t in userspace, so these + * are no-ops, and an xfs_dev_t is stored in VFS_I(ip)->i_rdev diff --git a/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch b/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch index b028db187..a9ab4d322 100644 --- a/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch +++ b/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch @@ -14,7 +14,7 @@ Signed-off-by: Rosen Penev --- a/db/malloc.c +++ b/db/malloc.c -@@ -56,8 +56,7 @@ xmalloc( +@@ -44,8 +44,7 @@ xmalloc( { void *ptr; diff --git a/utils/xfsprogs/patches/140-copy-file-range.patch b/utils/xfsprogs/patches/140-copy-file-range.patch deleted file mode 100644 index 076d5c95d..000000000 --- a/utils/xfsprogs/patches/140-copy-file-range.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 8041435de7ed028a27ecca64302945ad455c69a6 Mon Sep 17 00:00:00 2001 -From: "Darrick J. Wong" -Date: Mon, 5 Feb 2018 14:38:02 -0600 -Subject: [PATCH] xfs_io: fix copy_file_range symbol name collision - -glibc 2.27 has a copy_file_range wrapper, so we need to change our -internal function out of the way to avoid compiler warnings. - -Reported-by: fredrik@crux.nu -Signed-off-by: Darrick J. Wong -Reviewed-by: Eric Sandeen -Signed-off-by: Eric Sandeen ---- - io/copy_file_range.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - ---- a/io/copy_file_range.c -+++ b/io/copy_file_range.c -@@ -42,13 +42,18 @@ copy_range_help(void) - ")); - } - -+/* -+ * Issue a raw copy_file_range syscall; for our test program we don't want the -+ * glibc buffered copy fallback. -+ */ - static loff_t --copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len) -+copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len) - { - loff_t ret; - - do { -- ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0); -+ ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, -+ len, 0); - if (ret == -1) { - perror("copy_range"); - return errno; -@@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv) - copy_dst_truncate(); - } - -- ret = copy_file_range(fd, &src, &dst, len); -+ ret = copy_file_range_cmd(fd, &src, &dst, len); - close(fd); - return ret; - } diff --git a/utils/xfsprogs/patches/140-mman.patch b/utils/xfsprogs/patches/140-mman.patch new file mode 100644 index 000000000..936d3cc29 --- /dev/null +++ b/utils/xfsprogs/patches/140-mman.patch @@ -0,0 +1,13 @@ +--- a/io/mmap.c ++++ b/io/mmap.c +@@ -11,6 +11,10 @@ + #include "init.h" + #include "io.h" + ++#ifndef MAP_SYNC ++#define MAP_SYNC 0 ++#endif ++ + static cmdinfo_t mmap_cmd; + static cmdinfo_t mread_cmd; + static cmdinfo_t msync_cmd;