xfsprogs: Upgrade to 4.14

Fix build with glibc 2.27 while here

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Khem Raj 2018-01-31 22:03:54 -08:00 committed by Armin Kuster
parent 9eb3e39a9f
commit 9e35f8d788
6 changed files with 91 additions and 6010 deletions

View File

@ -0,0 +1,82 @@
From ae7172194d3fbb563ff8bbe7c02d34f1bd0e5ec9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 31 Jan 2018 21:28:53 -0800
Subject: [PATCH] build: Check for sync_file_range libc function
glibc 2.27 now has sync_file_range()
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
include/builddefs.in | 1 +
io/Makefile | 5 ++++-
io/io.h | 2 +-
io/sync_file_range.c | 3 +++
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/builddefs.in b/include/builddefs.in
index 92d5076..504225a 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -105,6 +105,7 @@ HAVE_FIEMAP = @have_fiemap@
HAVE_PREADV = @have_preadv@
HAVE_PWRITEV2 = @have_pwritev2@
HAVE_COPY_FILE_RANGE = @have_copy_file_range@
+HAVE_NR_COPY_FILE_RANGE = @have_nr_copy_file_range@
HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
HAVE_SYNCFS = @have_syncfs@
HAVE_READDIR = @have_readdir@
diff --git a/io/Makefile b/io/Makefile
index 6725936..1876e95 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -59,10 +59,13 @@ CFILES += inject.c resblks.c
LCFLAGS += -DHAVE_INJECT -DHAVE_RESBLKS
endif
-ifeq ($(HAVE_COPY_FILE_RANGE),yes)
+ifeq ($(HAVE_NR_COPY_FILE_RANGE),yes)
CFILES += copy_file_range.c
+LCFLAGS += -DHAVE_NR_COPY_FILE_RANGE
+ifeq ($(HAVE_COPY_FILE_RANGE),yes)
LCFLAGS += -DHAVE_COPY_FILE_RANGE
endif
+endif
ifeq ($(HAVE_SYNC_FILE_RANGE),yes)
CFILES += sync_file_range.c
diff --git a/io/io.h b/io/io.h
index 3862985..79ddc7b 100644
--- a/io/io.h
+++ b/io/io.h
@@ -158,7 +158,7 @@ extern void fiemap_init(void);
#define fiemap_init() do { } while (0)
#endif
-#ifdef HAVE_COPY_FILE_RANGE
+#if defined(HAVE_NR_COPY_FILE_RANGE) && !defined(HAVE_COPY_FILE_RANGE)
extern void copy_range_init(void);
#else
#define copy_range_init() do { } while (0)
diff --git a/io/sync_file_range.c b/io/sync_file_range.c
index 7e4f3e6..aafea01 100644
--- a/io/sync_file_range.c
+++ b/io/sync_file_range.c
@@ -16,6 +16,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef HAVE_COPY_FILE_RANGE
#include "command.h"
#include "input.h"
#include "init.h"
@@ -104,3 +105,5 @@ sync_range_init(void)
add_command(&sync_range_cmd);
}
+
+#endif
--
2.16.1

View File

@ -1,13 +1,13 @@
Index: xfsprogs-4.12.0/include/builddefs.in
Index: xfsprogs-4.14.0/include/builddefs.in
===================================================================
--- xfsprogs-4.12.0.orig/include/builddefs.in
+++ xfsprogs-4.12.0/include/builddefs.in
@@ -164,7 +164,7 @@ ifeq ($(ENABLE_GETTEXT),yes)
--- xfsprogs-4.14.0.orig/include/builddefs.in
+++ xfsprogs-4.14.0/include/builddefs.in
@@ -168,7 +168,7 @@ ifeq ($(ENABLE_GETTEXT),yes)
GCFLAGS += -DENABLE_GETTEXT
endif
-BUILD_CFLAGS += $(GCFLAGS) $(PCFLAGS)
+BUILD_CFLAGS += $(GCFLAGS)
# First, Global, Platform, Local CFLAGS
CFLAGS += $(FCFLAGS) $(OPTIMIZER) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
# First, Sanitizer, Global, Platform, Local CFLAGS
CFLAGS += $(FCFLAGS) $(SANITIZER_CFLAGS) $(OPTIMIZER) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)

View File

@ -1,117 +0,0 @@
From 21253610f9ef87db8e2a75b863b7fcfbd0cdb421 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Tue, 25 Jul 2017 13:45:01 -0500
Subject: [PATCH] In patch 4944defad4 ("xfs_db: redirect printfs when
metadumping to stdout"), we solved the problem of xfs_db printfs ending up in
the metadump stream by reassigning stdout for the duration of a stdout
metadump. Unfortunately, musl doesn't allow stdout to be reassigned (in
their view "extern FILE *stdout" means "extern FILE * const stdout"), so we
abandon the old approach in favor of playing games with dup() to switch the
raw file descriptors.
While we're at it, fix a regression where an unconverted outf test
allows progress info to end up in the metadump stream.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
db/metadump.c | 47 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 36 insertions(+), 11 deletions(-)
diff --git a/db/metadump.c b/db/metadump.c
index 96641e0..4e2f648 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -78,6 +78,7 @@ static int obfuscate = 1;
static int zero_stale_data = 1;
static int show_warnings = 0;
static int progress_since_warning = 0;
+static bool stdout_metadump;
void
metadump_init(void)
@@ -137,7 +138,7 @@ print_progress(const char *fmt, ...)
va_end(ap);
buf[sizeof(buf)-1] = '\0';
- f = (outf == stdout) ? stderr : stdout;
+ f = stdout_metadump ? stderr : stdout;
fprintf(f, "\r%-59s", buf);
fflush(f);
progress_since_warning = 1;
@@ -2750,7 +2751,8 @@ metadump_f(
xfs_agnumber_t agno;
int c;
int start_iocur_sp;
- bool stdout_metadump = false;
+ int outfd = -1;
+ int ret;
char *p;
exitcode = 1;
@@ -2870,16 +2872,35 @@ metadump_f(
* metadump operation so that dbprintf and other messages
* are sent to the console instead of polluting the
* metadump stream.
+ *
+ * We get to do this the hard way because musl doesn't
+ * allow reassignment of stdout.
*/
- outf = stdout;
- stdout = stderr;
+ fflush(stdout);
+ outfd = dup(STDOUT_FILENO);
+ if (outfd < 0) {
+ perror("opening dump stream");
+ goto out;
+ }
+ ret = dup2(STDERR_FILENO, STDOUT_FILENO);
+ if (ret < 0) {
+ perror("redirecting stdout");
+ close(outfd);
+ goto out;
+ }
+ outf = fdopen(outfd, "a");
+ if (outf == NULL) {
+ fprintf(stderr, "cannot create dump stream\n");
+ dup2(outfd, 1);
+ close(outfd);
+ goto out;
+ }
stdout_metadump = true;
} else {
outf = fopen(argv[optind], "wb");
if (outf == NULL) {
print_warning("cannot create dump file");
- free(metablock);
- return 0;
+ goto out;
}
}
@@ -2907,15 +2928,19 @@ metadump_f(
if (progress_since_warning)
fputc('\n', stdout_metadump ? stderr : stdout);
- if (stdout_metadump)
- stdout = outf;
- else
- fclose(outf);
+ if (stdout_metadump) {
+ fflush(outf);
+ fflush(stdout);
+ ret = dup2(outfd, STDOUT_FILENO);
+ if (ret < 0)
+ perror("un-redirecting stdout");
+ }
+ fclose(outf);
/* cleanup iocur stack */
while (iocur_sp > start_iocur_sp)
pop_cur();
-
+out:
free(metablock);
return 0;
--
2.13.3

View File

@ -6,13 +6,11 @@ LICENSE_libhandle = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://doc/COPYING;md5=102f7fec3d53c7c8f0b7baf9bf9d76a8"
DEPENDS = "util-linux util-linux-native"
SRC_URI = "https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/${BP}.tar.xz \
file://0001-xfsprogs-remove-double-underscore-integer-types.patch \
file://0001-xfs-remove-double-underscore-integer-types.patch \
file://remove_flags_from_build_flags.patch \
file://xfsprogs-4.12.0-fix_musl.patch \
file://0001-build-Check-for-sync_file_range-libc-function.patch \
"
SRC_URI[md5sum] = "e348b0e1d7bd1cd82d64b91ff37e727e"
SRC_URI[sha256sum] = "b330ad8d737f4152ae511580102e2fc49212bb51dfb4b614084344abae46d0df"
SRC_URI[md5sum] = "2d50e3751cc98e6c9364bc3d2297b9fd"
SRC_URI[sha256sum] = "b1b710b268bc95d6f45eca06e1262c29eb38865a19cd4404e48ba446e043b7ec"
inherit autotools-brokensep