aboutsummaryrefslogtreecommitdiffstats
path: root/meta-filesystems/recipes-utils/xfsprogs/files/0001-build-Check-for-sync_file_range-libc-function.patch
blob: d8ff5553193749bf1bc5c842623ba8a69da88080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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