[1/1] fanotify: Fix missing __kernel_fsid_t definition
diff mbox series

Message ID 20191016211501.3777-1-petr.vorel@gmail.com
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series
  • [1/1] fanotify: Fix missing __kernel_fsid_t definition
Related show

Commit Message

Petr Vorel Oct. 16, 2019, 9:15 p.m. UTC
which is missing at least on musl which doesn't have FAN_REPORT_FID
support.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 testcases/kernel/syscalls/fanotify/fanotify.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jan Stancek Oct. 17, 2019, 8:50 a.m. UTC | #1
----- Original Message -----
> which is missing at least on musl which doesn't have FAN_REPORT_FID
> support.
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
>  testcases/kernel/syscalls/fanotify/fanotify.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h
> b/testcases/kernel/syscalls/fanotify/fanotify.h
> index 1c7623d3b..01a2d52bd 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> @@ -35,6 +35,10 @@
>  #include <errno.h>
>  #include <fcntl.h>
>  
> +#if !defined(FAN_REPORT_FID) && defined(HAVE_NAME_TO_HANDLE_AT)

Will FAN_REPORT_FID ever be defined at this point, when include of
sys/fanotify.h is below?

> +#include <asm/posix_types.h> // __kernel_fsid_t
> +#endif
> +
>  #if defined(HAVE_SYS_FANOTIFY_H)
>  
>  #include <sys/fanotify.h>
> --
> 2.23.0
> 
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Jan Stancek Oct. 17, 2019, 8:56 a.m. UTC | #2
----- Original Message -----
> which is missing at least on musl which doesn't have FAN_REPORT_FID
> support.
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
>  testcases/kernel/syscalls/fanotify/fanotify.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h
> b/testcases/kernel/syscalls/fanotify/fanotify.h
> index 1c7623d3b..01a2d52bd 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> @@ -35,6 +35,10 @@
>  #include <errno.h>
>  #include <fcntl.h>
>  
> +#if !defined(FAN_REPORT_FID) && defined(HAVE_NAME_TO_HANDLE_AT)
> +#include <asm/posix_types.h> // __kernel_fsid_t
> +#endif

Would an alternative that adds this type to lapi work?
(just looking if we can avoid extra kernel include)

typedef struct {
        int     val[2];
} lapi_fsid_t;

#define __kernel_fsid_t lapi_fsid_t
Cyril Hrubis Oct. 17, 2019, 9:20 a.m. UTC | #3
Hi!
> > +#if !defined(FAN_REPORT_FID) && defined(HAVE_NAME_TO_HANDLE_AT)
> > +#include <asm/posix_types.h> // __kernel_fsid_t
> > +#endif
> 
> Would an alternative that adds this type to lapi work?
> (just looking if we can avoid extra kernel include)
> 
> typedef struct {
>         int     val[2];
> } lapi_fsid_t;
> 
> #define __kernel_fsid_t lapi_fsid_t

This looks a bit safer to me as well.

Patch
diff mbox series

diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 1c7623d3b..01a2d52bd 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -35,6 +35,10 @@ 
 #include <errno.h>
 #include <fcntl.h>
 
+#if !defined(FAN_REPORT_FID) && defined(HAVE_NAME_TO_HANDLE_AT)
+#include <asm/posix_types.h> // __kernel_fsid_t
+#endif
+
 #if defined(HAVE_SYS_FANOTIFY_H)
 
 #include <sys/fanotify.h>