blob: cdbcf6b28889370760b33dbf3cf250c1b1bc39eb [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From b857f8723f30a4b9554bf6b0ff8fa52fd07e8b60 Mon Sep 17 00:00:00 2001
2From: Li Wang <liwang@redhat.com>
3Date: Fri, 5 Aug 2022 14:34:01 +0800
4Subject: [PATCH] lapi/fsmount: resolve conflict in different header files
5
6The latest glibc added new wrappers (e.g. mount_setattr, fsopen) support
7in sys/mount.h, which partly conflicts with linux/mount.h at the same time.
8
9We need to make adjustments to header files to fix compiling error on
10different platforms.
11
12Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/b857f8723f30a4b9554bf6b0ff8fa52fd07e8b60]
13Signed-off-by: Li Wang <liwang@redhat.com>
14Reviewed-by: Petr Vorel <pvorel@suse.cz>
15---
16 configure.ac | 1 +
17 include/lapi/fs.h | 6 ++++--
18 include/lapi/fsmount.h | 7 +++++--
19 3 files changed, 10 insertions(+), 4 deletions(-)
20
21diff --git a/configure.ac b/configure.ac
22index d50ec1ea7..dbd53cab6 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -113,6 +113,7 @@ AC_CHECK_FUNCS_ONCE([ \
26 mkdirat \
27 mknodat \
28 modify_ldt \
29+ mount_setattr \
30 move_mount \
31 name_to_handle_at \
32 open_tree \
33diff --git a/include/lapi/fs.h b/include/lapi/fs.h
34index 27b3a183c..84a168a67 100644
35--- a/include/lapi/fs.h
36+++ b/include/lapi/fs.h
37@@ -6,8 +6,10 @@
38 * Email: code@zilogic.com
39 */
40
41-#ifdef HAVE_LINUX_FS_H
42-# include <linux/fs.h>
43+#ifndef HAVE_MOUNT_SETATTR
44+# ifdef HAVE_LINUX_FS_H
45+# include <linux/fs.h>
46+# endif
47 #endif
48
49 #include <sys/user.h>
50diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
51index b11e7a7bd..07eb42ffa 100644
52--- a/include/lapi/fsmount.h
53+++ b/include/lapi/fsmount.h
54@@ -11,9 +11,12 @@
55 #include "config.h"
56 #include <sys/syscall.h>
57 #include <sys/types.h>
58+#include <sys/mount.h>
59
60-#ifdef HAVE_LINUX_MOUNT_H
61-# include <linux/mount.h>
62+#ifndef HAVE_FSOPEN
63+# ifdef HAVE_LINUX_MOUNT_H
64+# include <linux/mount.h>
65+# endif
66 #endif
67
68 #include "lapi/fcntl.h"
69--
702.37.2
71