All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] lapi/fsmount: resolve conflict in different header files
Date: Fri,  5 Aug 2022 14:34:01 +0800	[thread overview]
Message-ID: <20220805063401.1647479-3-liwang@redhat.com> (raw)
In-Reply-To: <20220805063401.1647479-1-liwang@redhat.com>

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.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 configure.ac                                              | 1 +
 include/lapi/fs.h                                         | 6 ++++--
 include/lapi/fsmount.h                                    | 6 ++++--
 testcases/kernel/syscalls/fsconfig/fsconfig01.c           | 1 +
 testcases/kernel/syscalls/fsconfig/fsconfig02.c           | 1 +
 testcases/kernel/syscalls/fsmount/fsmount01.c             | 1 +
 testcases/kernel/syscalls/fsmount/fsmount02.c             | 1 +
 testcases/kernel/syscalls/fsopen/fsopen01.c               | 1 +
 testcases/kernel/syscalls/fsopen/fsopen02.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick01.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick02.c               | 1 +
 testcases/kernel/syscalls/mount_setattr/mount_setattr01.c | 1 +
 testcases/kernel/syscalls/move_mount/move_mount01.c       | 1 +
 testcases/kernel/syscalls/move_mount/move_mount02.c       | 1 +
 testcases/kernel/syscalls/open_tree/open_tree01.c         | 1 +
 testcases/kernel/syscalls/open_tree/open_tree02.c         | 1 +
 16 files changed, 22 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..9b1993580 100644
--- a/include/lapi/fsmount.h
+++ b/include/lapi/fsmount.h
@@ -12,8 +12,10 @@
 #include <sys/syscall.h>
 #include <sys/types.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"
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig01.c b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
index a585daa6d..f1dc7d8da 100644
--- a/testcases/kernel/syscalls/fsconfig/fsconfig01.c
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
@@ -5,6 +5,7 @@
  * Basic fsconfig() test which tries to configure and mount the filesystem as
  * well.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig02.c b/testcases/kernel/syscalls/fsconfig/fsconfig02.c
index 272e25a6f..bbad6def6 100644
--- a/testcases/kernel/syscalls/fsconfig/fsconfig02.c
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig02.c
@@ -4,6 +4,7 @@
  *
  * Basic fsconfig() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c
index 5f755863f..1232b0914 100644
--- a/testcases/kernel/syscalls/fsmount/fsmount01.c
+++ b/testcases/kernel/syscalls/fsmount/fsmount01.c
@@ -6,6 +6,7 @@
  * Basic fsmount() test.
  */
 
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fsmount/fsmount02.c b/testcases/kernel/syscalls/fsmount/fsmount02.c
index a4f42dc18..91512b74a 100644
--- a/testcases/kernel/syscalls/fsmount/fsmount02.c
+++ b/testcases/kernel/syscalls/fsmount/fsmount02.c
@@ -4,6 +4,7 @@
  *
  * Basic fsmount() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fsopen/fsopen01.c b/testcases/kernel/syscalls/fsopen/fsopen01.c
index c2c719c96..332821cf0 100644
--- a/testcases/kernel/syscalls/fsopen/fsopen01.c
+++ b/testcases/kernel/syscalls/fsopen/fsopen01.c
@@ -5,6 +5,7 @@
  * Basic fsopen() test which tries to configure and mount the filesystem as
  * well.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fsopen/fsopen02.c b/testcases/kernel/syscalls/fsopen/fsopen02.c
index 3f287bf29..8c643b9a8 100644
--- a/testcases/kernel/syscalls/fsopen/fsopen02.c
+++ b/testcases/kernel/syscalls/fsopen/fsopen02.c
@@ -4,6 +4,7 @@
  *
  * Basic fsopen() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fspick/fspick01.c b/testcases/kernel/syscalls/fspick/fspick01.c
index d3309a912..ae6cad6fb 100644
--- a/testcases/kernel/syscalls/fspick/fspick01.c
+++ b/testcases/kernel/syscalls/fspick/fspick01.c
@@ -4,6 +4,7 @@
  *
  * Basic fspick() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/fspick/fspick02.c b/testcases/kernel/syscalls/fspick/fspick02.c
index f9a3697c1..907b463b6 100644
--- a/testcases/kernel/syscalls/fspick/fspick02.c
+++ b/testcases/kernel/syscalls/fspick/fspick02.c
@@ -4,6 +4,7 @@
  *
  * Basic fspick() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c b/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
index 83746b878..fcf491c33 100644
--- a/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
+++ b/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
@@ -30,6 +30,7 @@
 #define _GNU_SOURCE
 
 #include <sys/statvfs.h>
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 #include "lapi/stat.h"
diff --git a/testcases/kernel/syscalls/move_mount/move_mount01.c b/testcases/kernel/syscalls/move_mount/move_mount01.c
index 445e6197e..b65141a28 100644
--- a/testcases/kernel/syscalls/move_mount/move_mount01.c
+++ b/testcases/kernel/syscalls/move_mount/move_mount01.c
@@ -4,6 +4,7 @@
  *
  * Basic move_mount() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/move_mount/move_mount02.c b/testcases/kernel/syscalls/move_mount/move_mount02.c
index 45b1db4be..373c8c3ac 100644
--- a/testcases/kernel/syscalls/move_mount/move_mount02.c
+++ b/testcases/kernel/syscalls/move_mount/move_mount02.c
@@ -4,6 +4,7 @@
  *
  * Basic move_mount() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/open_tree/open_tree01.c b/testcases/kernel/syscalls/open_tree/open_tree01.c
index 808d25665..6d2299449 100644
--- a/testcases/kernel/syscalls/open_tree/open_tree01.c
+++ b/testcases/kernel/syscalls/open_tree/open_tree01.c
@@ -4,6 +4,7 @@
  *
  * Basic open_tree() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
diff --git a/testcases/kernel/syscalls/open_tree/open_tree02.c b/testcases/kernel/syscalls/open_tree/open_tree02.c
index ddaa204f2..59a5a4ca2 100644
--- a/testcases/kernel/syscalls/open_tree/open_tree02.c
+++ b/testcases/kernel/syscalls/open_tree/open_tree02.c
@@ -4,6 +4,7 @@
  *
  * Basic open_tree() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2022-08-05  6:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  6:33 [LTP] [PATCH 0/2] fix compiling errors on fedora-rawhide Li Wang
2022-08-05  6:34 ` [LTP] [PATCH 1/2] lapi/pidfd: adding pidfd header file Li Wang
2022-08-05  7:14   ` Petr Vorel
2022-08-05 10:04     ` Li Wang
2022-08-05 10:36       ` Petr Vorel
2022-08-05  6:34 ` Li Wang [this message]
2022-08-05  7:38   ` [LTP] [PATCH 2/2] lapi/fsmount: resolve conflict in different header files Petr Vorel
2022-08-05  9:44     ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805063401.1647479-3-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.