diff mbox series

[v1] selftests mount: Fix mount_setattr_test builds failed

Message ID 20230323172859.89085-1-tuananhlfc@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series [v1] selftests mount: Fix mount_setattr_test builds failed | expand

Commit Message

Anh Tuan Phan March 23, 2023, 5:28 p.m. UTC
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.

Signed-off-by: Anh Tuan Phan <tuananhlfc@gmail.com>
---
 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Seth Forshee March 23, 2023, 6:07 p.m. UTC | #1
On Fri, Mar 24, 2023 at 12:28:59AM +0700, Anh Tuan Phan wrote:
> 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.
> 
> Signed-off-by: Anh Tuan Phan <tuananhlfc@gmail.com>
> ---
>  tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> index 582669ca38e9..7ca13a924e34 100644
> --- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> +++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> @@ -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:

Acked-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
index 582669ca38e9..7ca13a924e34 100644
--- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
+++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
@@ -18,6 +18,7 @@ 
 #include <grp.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include "linux/mount.h"
 
 #include "../kselftest_harness.h"