Skip to contentSkip to conversation

selftests mount: Fix mount_setattr_test builds failed

PATCH Superseded Anh Tuan Phan 3 participants 4 messages Mar 23, 2023 – Mar 27, 2023

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

PATCH 1/1 selftests mount: Fix mount_setattr_test builds failed

When compiling selftests with target mount_setattr I encountered some errors with the below messages:
mount_setattr_test.c: In function ‘mount_setattr_thread’:
mount_setattr_test.c:343:16: error: variable ‘attr’ has initializer but incomplete type

  343 |         struct mount_attr attr = {
      |                ^~~~~~~~~~

These errors are might be because of linux/mount.h is not included. This patch resolves that issue.

---
 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mount_setattr/mount_setattr_test.c +1 -0
index 582669ca38e9..7ca13a924e34 100644
@@ -18,6 +18,7 @@
 #include <grp.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include "linux/mount.h"
 
 #include "../kselftest_harness.h"
 
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Anh Tuan Phan

When compiling selftests with target mount_setattr I encountered some errors with the below messages:
mount_setattr_test.c: In function ‘mount_setattr_thread’:
mount_setattr_test.c:343:16: error: variable ‘attr’ has initializer but incomplete type

  343 |         struct mount_attr attr = {
      |                ^~~~~~~~~~

These errors are might be because of linux/mount.h is not included. This patch resolves that issue.

---
 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mount_setattr/mount_setattr_test.c +0 -0
index 582669ca38e9..7ca13a924e34 100644

tools/testing/selftests/mount_setattr/mount_setattr_test.c line 23

Quoted 6 lines
tools/testing/selftests/mount_setattr/mount_setattr_test.c +1 -0
@@ -18,6 +18,7 @@
 #include <grp.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include "linux/mount.h"
 
 #include "../kselftest_harness.h"

Oops, I had meant to send this fix before and forgot.

One minor nit. I'd prefer to see angle brackets used for this include, since the kernel header path is passed using -isystem and angle brackets are more conventional for system includes. It's also how most other selftests include kernel headers. But either way:

#2 lore raw

PATCH v2 1/1 selftests mount: Fix mount_setattr_test builds failed

When compiling selftests with target mount_setattr I encountered some errors with the below messages:
mount_setattr_test.c: In function ‘mount_setattr_thread’:
mount_setattr_test.c:343:16: error: variable ‘attr’ has initializer but incomplete type

  343 |         struct mount_attr attr = {
      |                ^~~~~~~~~~

These errors might be because of linux/mount.h is not included. This patch resolves that issue.

---
Thanks for replying so quickly, this is my first patch to the kernel. I changed the include to use angle bracket as your suggestion.

 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mount_setattr/mount_setattr_test.c +1 -0
index 582669ca38e9..c6a8c732b802 100644
@@ -18,6 +18,7 @@
 #include <grp.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include <linux/mount.h>
 
 #include "../kselftest_harness.h"
 
Signature · 6 lines
2.34.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
maintainer Acked-by on v2 1/1
#3 lore raw
Quoted 10 lines · Anh Tuan Phan

When compiling selftests with target mount_setattr I encountered some errors with the below messages:
mount_setattr_test.c: In function ‘mount_setattr_thread’:
mount_setattr_test.c:343:16: error: variable ‘attr’ has initializer but incomplete type

  343 |         struct mount_attr attr = {
      |                ^~~~~~~~~~

These errors might be because of linux/mount.h is not included. This patch resolves that issue.

---

I think Seth already acked this. This can go via the selftest tree,