selftests/mount_setattr: Remove redefinition of struct mount_attr
Subsystems (3)
PATCH 1/1 selftests/mount_setattr: Remove redefinition of struct mount_attr
It is already included via sys/mount.h on line 10.
GCC error reproducible by: make kselftest TARGETS="mount_setattr"
mount_setattr_test.c:107:8: error: redefinition of ‘struct mount_attr’
107 | struct mount_attr {
| ^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/mount.h:32,
from mount_setattr_test.c:10:
../../../../usr/include/linux/mount.h:129:8: note: originally defined here
129 | struct mount_attr {
| ^~~~~~~~~~--- tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 ------- 1 file changed, 7 deletions(-)
tools/testing/selftests/mount_setattr/mount_setattr_test.c +0 -7
@@ -103,13 +103,6 @@#else #define __NR_mount_setattr 442#endif - -struct mount_attr { -__u64 attr_set; -__u64 attr_clr; -__u64 propagation; -__u64 userns_fd; -};#endif #ifndef __NR_open_tree
Signature · 1 line
2.35.1
Quoted 38 lines · Siddh Raman Pant
It is already included via
sys/mount.hon line 10.GCC error reproducible by: make kselftest TARGETS="mount_setattr"
mount_setattr_test.c:107:8: error: redefinition of ‘struct mount_attr’
107 | struct mount_attr { | ^~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/sys/mount.h:32, from mount_setattr_test.c:10: ../../../../usr/include/linux/mount.h:129:8: note: originally defined here 129 | struct mount_attr { | ^~~~~~~~~~Signed-off-by Siddh Raman Pant <[email protected]>--- tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 ------- 1 file changed, 7 deletions(-)tools/testing/selftests/mount_setattr/mount_setattr_test.c +0
-7@@ -103,13 +103,6 @@#else #define __NR_mount_setattr 442#endif - -struct mount_attr { -__u64 attr_set; -__u64 attr_clr; -__u64 propagation; -__u64 userns_fd; -};#endif #ifndef __NR_open_treeSignature · 1 line
2.35.1
Hi,
Please review the above patch, which can be found on the link below:
https://lore.kernel.org/all/[email protected]
This was encountered before the patch adding missing <sys/syscall.h> was applied, which just means that I went into the code path under #ifndef __NR_mount_setattr, and encountered the error.
Thanks,
Siddh
Christian Brauner
maintainerQuoted 24 lines · Siddh Raman Pant
It is already included via
sys/mount.hon line 10.GCC error reproducible by: make kselftest TARGETS="mount_setattr"
mount_setattr_test.c:107:8: error: redefinition of ‘struct mount_attr’
107 | struct mount_attr { | ^~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/sys/mount.h:32, from mount_setattr_test.c:10: ../../../../usr/include/linux/mount.h:129:8: note: originally defined here 129 | struct mount_attr { | ^~~~~~~~~~Signed-off-by Siddh Raman Pant <[email protected]>--- tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 ------- 1 file changed, 7 deletions(-)tools/testing/selftests/mount_setattr/mount_setattr_test.c +0
-0@@ -103,13 +103,6 @@#else
tools/testing/selftests/mount_setattr/mount_setattr_test.c line 106
Quoted 10 lines
tools/testing/selftests/mount_setattr/mount_setattr_test.c +0
-7#define __NR_mount_setattr 442#endif - -struct mount_attr { -__u64 attr_set; -__u64 attr_clr; -__u64 propagation; -__u64 userns_fd; -};#endif
Honestly, until the conflicts between linux/mount.h and sys/mount.h are fixed properly we should probably just not include either linux/mount.h nor sys/mount.h and just define all the things we need in this single test file.