linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr
@ 2022-12-11  9:28 Siddh Raman Pant
  2023-01-01 16:43 ` Siddh Raman Pant
  2023-01-03 10:27 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Siddh Raman Pant @ 2022-12-11  9:28 UTC (permalink / raw)
  To: Christian Brauner, Seth Forshee, Shuah Khan
  Cc: linux-fsdevel, linux-kselftests, linux-kernel

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 {
      |        ^~~~~~~~~~

Signed-off-by: Siddh Raman Pant <code@siddh.me>
---
 tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
index 8c5fea68ae67..582669ca38e9 100644
--- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
+++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
@@ -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
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr
  2022-12-11  9:28 [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr Siddh Raman Pant
@ 2023-01-01 16:43 ` Siddh Raman Pant
  2023-01-03 10:27 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Siddh Raman Pant @ 2023-01-01 16:43 UTC (permalink / raw)
  To: Christian Brauner, Seth Forshee, Shuah Khan
  Cc: linux-fsdevel, linux-kselftests, linux-kernel

On Sun, 11 Dec 2022 14:58:20 +0530, Siddh Raman Pant wrote:
> 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 {
>       |        ^~~~~~~~~~
> 
> Signed-off-by: Siddh Raman Pant <code@siddh.me>
> ---
>  tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> index 8c5fea68ae67..582669ca38e9 100644
> --- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> +++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> @@ -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
> -- 
> 2.35.1

Hi,

Please review the above patch, which can be found on the link below:
https://lore.kernel.org/all/20221211092820.85527-1-code@siddh.me

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr
  2022-12-11  9:28 [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr Siddh Raman Pant
  2023-01-01 16:43 ` Siddh Raman Pant
@ 2023-01-03 10:27 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2023-01-03 10:27 UTC (permalink / raw)
  To: Siddh Raman Pant
  Cc: Seth Forshee, Shuah Khan, linux-fsdevel, linux-kselftests,
	linux-kernel

On Sun, Dec 11, 2022 at 02:58:20PM +0530, Siddh Raman Pant wrote:
> 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 {
>       |        ^~~~~~~~~~
> 
> Signed-off-by: Siddh Raman Pant <code@siddh.me>
> ---
>  tools/testing/selftests/mount_setattr/mount_setattr_test.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> index 8c5fea68ae67..582669ca38e9 100644
> --- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> +++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> @@ -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

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-03 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-11  9:28 [PATCH] selftests/mount_setattr: Remove redefinition of struct mount_attr Siddh Raman Pant
2023-01-01 16:43 ` Siddh Raman Pant
2023-01-03 10:27 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).