blob: cdbcf6b28889370760b33dbf3cf250c1b1bc39eb [file] [log] [blame]
From b857f8723f30a4b9554bf6b0ff8fa52fd07e8b60 Mon Sep 17 00:00:00 2001
From: Li Wang <liwang@redhat.com>
Date: Fri, 5 Aug 2022 14:34:01 +0800
Subject: [PATCH] lapi/fsmount: resolve conflict in different header files
The latest glibc added new wrappers (e.g. mount_setattr, fsopen) support
in sys/mount.h, which partly conflicts with linux/mount.h at the same time.
We need to make adjustments to header files to fix compiling error on
different platforms.
Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/b857f8723f30a4b9554bf6b0ff8fa52fd07e8b60]
Signed-off-by: Li Wang <liwang@redhat.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
configure.ac | 1 +
include/lapi/fs.h | 6 ++++--
include/lapi/fsmount.h | 7 +++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index d50ec1ea7..dbd53cab6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,7 @@ AC_CHECK_FUNCS_ONCE([ \
mkdirat \
mknodat \
modify_ldt \
+ mount_setattr \
move_mount \
name_to_handle_at \
open_tree \
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index 27b3a183c..84a168a67 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -6,8 +6,10 @@
* Email: code@zilogic.com
*/
-#ifdef HAVE_LINUX_FS_H
-# include <linux/fs.h>
+#ifndef HAVE_MOUNT_SETATTR
+# ifdef HAVE_LINUX_FS_H
+# include <linux/fs.h>
+# endif
#endif
#include <sys/user.h>
diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
index b11e7a7bd..07eb42ffa 100644
--- a/include/lapi/fsmount.h
+++ b/include/lapi/fsmount.h
@@ -11,9 +11,12 @@
#include "config.h"
#include <sys/syscall.h>
#include <sys/types.h>
+#include <sys/mount.h>
-#ifdef HAVE_LINUX_MOUNT_H
-# include <linux/mount.h>
+#ifndef HAVE_FSOPEN
+# ifdef HAVE_LINUX_MOUNT_H
+# include <linux/mount.h>
+# endif
#endif
#include "lapi/fcntl.h"
--
2.37.2