selftests/overlayfs: fix compilation error in overlayfs

Message ID 20240219075029.2318383-1-li.meng@amd.com
State New
Headers
Series selftests/overlayfs: fix compilation error in overlayfs |

Commit Message

Meng Li Feb. 19, 2024, 7:50 a.m. UTC
  make -C tools/testing/selftests, compiling dev_in_maps fail.
In file included from dev_in_maps.c:10:
/usr/include/x86_64-linux-gnu/sys/mount.h:35:3: error: expected identifier before numeric constant
   35 |   MS_RDONLY = 1,                /* Mount read-only.  */
      |   ^~~~~~~~~

That sys/mount.h has to be included before linux/mount.h.

Signed-off-by: Meng Li <li.meng@amd.com>
---
 tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Shuah Khan Feb. 19, 2024, 10:30 p.m. UTC | #1
On 2/19/24 00:50, Meng Li wrote:
> make -C tools/testing/selftests, compiling dev_in_maps fail.
> In file included from dev_in_maps.c:10:
> /usr/include/x86_64-linux-gnu/sys/mount.h:35:3: error: expected identifier before numeric constant
>     35 |   MS_RDONLY = 1,                /* Mount read-only.  */
>        |   ^~~~~~~~~
> 
> That sys/mount.h has to be included before linux/mount.h.
> 
> Signed-off-by: Meng Li <li.meng@amd.com>

Please resend with linux-kselftest on the cc

thanks,
-- Shuah
  

Patch

diff --git a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
index e19ab0e85709..871a0923c06e 100644
--- a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
+++ b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
@@ -7,11 +7,11 @@ 
 
 #include <linux/unistd.h>
 #include <linux/types.h>
-#include <linux/mount.h>
 #include <sys/syscall.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <sys/mman.h>
+#include <linux/mount.h>
 #include <sched.h>
 #include <fcntl.h>