diff mbox series

[v12,5/5] linux-user: Fix flock structure for MIPS O64 ABI

Message ID 1560953834-29584-6-git-send-email-aleksandar.markovic@rt-rk.com (mailing list archive)
State New, archived
Headers show
Series | expand

Commit Message

Aleksandar Markovic June 19, 2019, 2:17 p.m. UTC
From: Aleksandar Markovic <amarkovic@wavecomp.com>

Only MIPS O32 and N32 have special (different than other
architectures) definition of structure flock in kernel.

Bring flock definition for MIPS O64 ABI to the correct state.

Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/generic/fcntl.h     | 2 +-
 linux-user/mips/target_fcntl.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Laurent Vivier June 19, 2019, 4:21 p.m. UTC | #1
Le 19/06/2019 à 16:17, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Only MIPS O32 and N32 have special (different than other
> architectures) definition of structure flock in kernel.
> 
> Bring flock definition for MIPS O64 ABI to the correct state.
> 
> Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/generic/fcntl.h     | 2 +-
>  linux-user/mips/target_fcntl.h | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
> index a775a49..1b48dde 100644
> --- a/linux-user/generic/fcntl.h
> +++ b/linux-user/generic/fcntl.h
> @@ -129,7 +129,7 @@ struct target_flock {
>      short l_whence;
>      abi_long l_start;
>      abi_long l_len;
> -#if defined(TARGET_MIPS)
> +#if defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
>      abi_long l_sysid;
>  #endif
>      int l_pid;
> diff --git a/linux-user/mips/target_fcntl.h b/linux-user/mips/target_fcntl.h
> index 000527c..795bba7 100644
> --- a/linux-user/mips/target_fcntl.h
> +++ b/linux-user/mips/target_fcntl.h
> @@ -27,7 +27,11 @@
>  #define TARGET_F_SETOWN        24       /*  for sockets. */
>  #define TARGET_F_GETOWN        23       /*  for sockets. */
>  
> +#if (TARGET_ABI_BITS == 32)
>  #define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
> +#else
> +#define TARGET_ARCH_FLOCK_PAD
> +#endif
>  #define TARGET_ARCH_FLOCK64_PAD
>  
>  #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
> 

The patch is correct, but I think it would be cleaner to introduce an
"TARGET_HAVE_ARCH_STRUCT_FLOCK" as we have in the kernel for the mips case.

Thanks,
Laurent
Aleksandar Markovic June 26, 2019, 7:54 a.m. UTC | #2
On Jun 19, 2019 6:34 PM, "Laurent Vivier" <laurent@vivier.eu> wrote:
>
> Le 19/06/2019 à 16:17, Aleksandar Markovic a écrit :
> > From: Aleksandar Markovic <amarkovic@wavecomp.com>
> >
> > Only MIPS O32 and N32 have special (different than other
> > architectures) definition of structure flock in kernel.
> >
> > Bring flock definition for MIPS O64 ABI to the correct state.
> >
> > Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
> > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> > ---
> >  linux-user/generic/fcntl.h     | 2 +-
> >  linux-user/mips/target_fcntl.h | 4 ++++
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
> > index a775a49..1b48dde 100644
> > --- a/linux-user/generic/fcntl.h
> > +++ b/linux-user/generic/fcntl.h
> > @@ -129,7 +129,7 @@ struct target_flock {
> >      short l_whence;
> >      abi_long l_start;
> >      abi_long l_len;
> > -#if defined(TARGET_MIPS)
> > +#if defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
> >      abi_long l_sysid;
> >  #endif
> >      int l_pid;
> > diff --git a/linux-user/mips/target_fcntl.h
b/linux-user/mips/target_fcntl.h
> > index 000527c..795bba7 100644
> > --- a/linux-user/mips/target_fcntl.h
> > +++ b/linux-user/mips/target_fcntl.h
> > @@ -27,7 +27,11 @@
> >  #define TARGET_F_SETOWN        24       /*  for sockets. */
> >  #define TARGET_F_GETOWN        23       /*  for sockets. */
> >
> > +#if (TARGET_ABI_BITS == 32)
> >  #define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
> > +#else
> > +#define TARGET_ARCH_FLOCK_PAD
> > +#endif
> >  #define TARGET_ARCH_FLOCK64_PAD
> >
> >  #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
> >
>
> The patch is correct, but I think it would be cleaner to introduce an
> "TARGET_HAVE_ARCH_STRUCT_FLOCK" as we have in the kernel for the mips
case.
>
> Thanks,
> Laurent
>

Do you mean we should do everything in a single patch, or do you ask me to
devise a separate restructuring/cleanup patch here?

Aleksandar
Laurent Vivier June 26, 2019, 7:57 a.m. UTC | #3
Le 26/06/2019 à 09:54, Aleksandar Markovic a écrit :
> 
> On Jun 19, 2019 6:34 PM, "Laurent Vivier" <laurent@vivier.eu
> <mailto:laurent@vivier.eu>> wrote:
>>
>> Le 19/06/2019 à 16:17, Aleksandar Markovic a écrit :
>> > From: Aleksandar Markovic <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>>
>> >
>> > Only MIPS O32 and N32 have special (different than other
>> > architectures) definition of structure flock in kernel.
>> >
>> > Bring flock definition for MIPS O64 ABI to the correct state.
>> >
>> > Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com
> <mailto:dmladjenovic@wavecomp.com>>
>> > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>>
>> > ---
>> >  linux-user/generic/fcntl.h     | 2 +-
>> >  linux-user/mips/target_fcntl.h | 4 ++++
>> >  2 files changed, 5 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
>> > index a775a49..1b48dde 100644
>> > --- a/linux-user/generic/fcntl.h
>> > +++ b/linux-user/generic/fcntl.h
>> > @@ -129,7 +129,7 @@ struct target_flock {
>> >      short l_whence;
>> >      abi_long l_start;
>> >      abi_long l_len;
>> > -#if defined(TARGET_MIPS)
>> > +#if defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
>> >      abi_long l_sysid;
>> >  #endif
>> >      int l_pid;
>> > diff --git a/linux-user/mips/target_fcntl.h
> b/linux-user/mips/target_fcntl.h
>> > index 000527c..795bba7 100644
>> > --- a/linux-user/mips/target_fcntl.h
>> > +++ b/linux-user/mips/target_fcntl.h
>> > @@ -27,7 +27,11 @@
>> >  #define TARGET_F_SETOWN        24       /*  for sockets. */
>> >  #define TARGET_F_GETOWN        23       /*  for sockets. */
>> > 
>> > +#if (TARGET_ABI_BITS == 32)
>> >  #define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
>> > +#else
>> > +#define TARGET_ARCH_FLOCK_PAD
>> > +#endif
>> >  #define TARGET_ARCH_FLOCK64_PAD
>> > 
>> >  #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
>> >
>>
>> The patch is correct, but I think it would be cleaner to introduce an
>> "TARGET_HAVE_ARCH_STRUCT_FLOCK" as we have in the kernel for the mips
> case.
>>
>> Thanks,
>> Laurent
>>
> 
> Do you mean we should do everything in a single patch, or do you ask me
> to devise a separate restructuring/cleanup patch here?

As you want, I'm fine with all in a single patch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
index a775a49..1b48dde 100644
--- a/linux-user/generic/fcntl.h
+++ b/linux-user/generic/fcntl.h
@@ -129,7 +129,7 @@  struct target_flock {
     short l_whence;
     abi_long l_start;
     abi_long l_len;
-#if defined(TARGET_MIPS)
+#if defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
     abi_long l_sysid;
 #endif
     int l_pid;
diff --git a/linux-user/mips/target_fcntl.h b/linux-user/mips/target_fcntl.h
index 000527c..795bba7 100644
--- a/linux-user/mips/target_fcntl.h
+++ b/linux-user/mips/target_fcntl.h
@@ -27,7 +27,11 @@ 
 #define TARGET_F_SETOWN        24       /*  for sockets. */
 #define TARGET_F_GETOWN        23       /*  for sockets. */
 
+#if (TARGET_ABI_BITS == 32)
 #define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
+#else
+#define TARGET_ARCH_FLOCK_PAD
+#endif
 #define TARGET_ARCH_FLOCK64_PAD
 
 #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */