Skip to contentSkip to conversation

selftests/filesystems: move kernel UAPI includes after libc headers

PATCH New Nikolai Dokutovich 1 participant 1 message Nov 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/filesystems: move kernel UAPI includes after libc headers

<linux/fs.h> includes <linux/mount.h>, which defines the MS_* flags as macros. <sys/mount.h> declares the same flags as enum constants, so including <linux/fs.h> first makes the macros expand inside the enum declaration and the build fails:

/usr/include/x86_64-linux-gnu/sys/mount.h:35:3:
error: expected identifier before numeric constant

Seen with glibc 2.35 on Ubuntu 22.04.

Move the two kernel UAPI includes after the libc headers.

Fixes 073d71c5118f ("selftests/filesystems: add a test for freezing a shared block device")
---
 tools/testing/selftests/filesystems/freeze/shared_bdev_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/filesystems/freeze/shared_bdev_test.c +2 -2
index 0ee352268a97..6454cabce83f 100644
@@ -14,8 +14,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <ftw.h>
-#include <linux/dm-ioctl.h>
-#include <linux/fs.h>
 #include <sched.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -29,6 +27,8 @@
 #include <sys/sysmacros.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <linux/dm-ioctl.h>
+#include <linux/fs.h>
 
 #include "../../kselftest_harness.h"
 #include "loop_util.h"
Signature · 1 line
2.34.1