[LTP] [PATCH 1/2] lapi/mount.h: Remove <linux/mount.h>

Petr Vorel pvorel@suse.cz
Tue May 3 17:29:47 CEST 2022


To avoid constants redefinition:

tst_cgroup.c: note: in included file (through ../include/lapi/mount.h):
/usr/include/linux/mount.h:13:9: warning: preprocessor token MS_RDONLY redefined
tst_cgroup.c: note: in included file:
/usr/include/sys/mount.h:36:9: this was the original definition

c0cb5d196 was missing #include "config.h" which leaded to always
including <sys/mount.h> while keeping including <sys/mount.h> before
lapi/mount.h (will be removed in separate commit).

Because <linux/mount.h> conflicts with <sys/mount.h>, but does not
include some common functions (e.g. mount(), umount()), it's better to
include in lapi/mount.h only <sys/mount.h>. This requires to include
<linux/mount.h> instead of lapi/mount.h in lapi/fsmount.h.

Fixes: c0cb5d196 ("lapi/mount.h: Include kernel/libc header")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/fsmount.h | 7 +++++--
 include/lapi/mount.h   | 6 +-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
index 377af85ec..3609855f6 100644
--- a/include/lapi/fsmount.h
+++ b/include/lapi/fsmount.h
@@ -8,11 +8,14 @@
 #ifndef LAPI_FSMOUNT_H__
 #define LAPI_FSMOUNT_H__
 
+#include "config.h"
 #include <sys/syscall.h>
 #include <sys/types.h>
 
-#include "config.h"
-#include "lapi/mount.h"
+#ifdef HAVE_LINUX_MOUNT_H
+# include <linux/mount.h>
+#endif
+
 #include "lapi/fcntl.h"
 #include "lapi/syscalls.h"
 
diff --git a/include/lapi/mount.h b/include/lapi/mount.h
index 6d098e3fd..66e1d1319 100644
--- a/include/lapi/mount.h
+++ b/include/lapi/mount.h
@@ -7,11 +7,7 @@
 #ifndef LAPI_MOUNT_H__
 #define LAPI_MOUNT_H__
 
-#ifdef HAVE_LINUX_MOUNT_H
-# include <linux/mount.h>
-#else
-# include <sys/mount.h>
-#endif
+#include <sys/mount.h>
 
 #ifndef MS_REC
 # define MS_REC 16384
-- 
2.36.0



More information about the ltp mailing list