qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
	qemu-devel@nongnu.org
Cc: amarkovic@wavecomp.com
Subject: Re: [Qemu-devel] [PATCH v16 4/5] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK
Date: Mon, 1 Jul 2019 10:43:40 +0200	[thread overview]
Message-ID: <30a8fd18-3a5b-b9c0-00b5-1e2996bcc87c@vivier.eu> (raw)
In-Reply-To: <1561718618-20218-5-git-send-email-aleksandar.markovic@rt-rk.com>

Le 28/06/2019 à 12:43, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Bring target_flock definitions to be more in sync with the way
> flock is defined in kernel.
> 
> Basically, the rules from the kernel are:
> 
> 1. Majority of architectures have a common flock definition.
> 
> 2. Architectures with 32-bit MIPS ABIs have a sligtly different
> flock definition; those architectures are the only arcitectures
> that have HAVE_ARCH_STRUCT_FLOCK defined, and that preprocessor
> constant is used in the common header as a flag for including or
> not including common flock definition.
> 
> 3. Sparc architectures also have a sligtly different flock
> definition, but the difference is only the padding at the end of
> the structure. The presence of that padding is determined by
> preprocessor constants __ARCH_FLOCK6_PAD and __ARCH_FLOCK64_PAD.
> 
> QEMU linux-user already implements rules 1. and 3. in a very
> similar way as they are implemented in kernel. However, rule 2.
> is implemented in a dissimilar way (for example, the constant
> TARGET_HAVE_ARCH_STRUCT_FLOCK is missing), and this patch brings
> QEMU implementation much closer to the kernel implementation.
> TARGET_HAVE_ARCH_STRUCT_FLOCK64 constant is also introduced to
> mimic HAVE_ARCH_STRUCT_FLOCK64 from kernel, but it is not defined
> anywhere, however, this is the case with HAVE_ARCH_STRUCT_FLOCK64
> in kernel as well.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/generic/fcntl.h     |  8 +++++---
>  linux-user/mips/target_fcntl.h | 17 +++++++++++++----
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
> index 1b48dde..9f727d4 100644
> --- a/linux-user/generic/fcntl.h
> +++ b/linux-user/generic/fcntl.h
> @@ -120,6 +120,7 @@ struct target_f_owner_ex {
>  #define TARGET_F_SHLCK         8
>  #endif
>  
> +#ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK
>  #ifndef TARGET_ARCH_FLOCK_PAD
>  #define TARGET_ARCH_FLOCK_PAD
>  #endif
> @@ -129,13 +130,12 @@ struct target_flock {
>      short l_whence;
>      abi_long l_start;
>      abi_long l_len;
> -#if defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
> -    abi_long l_sysid;
> -#endif
>      int l_pid;
>      TARGET_ARCH_FLOCK_PAD
>  };
> +#endif
>  
> +#ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK64
>  #ifndef TARGET_ARCH_FLOCK64_PAD
>  #define TARGET_ARCH_FLOCK64_PAD
>  #endif
> @@ -149,3 +149,5 @@ struct target_flock64 {
>      TARGET_ARCH_FLOCK64_PAD
>  };
>  #endif
> +
> +#endif
> diff --git a/linux-user/mips/target_fcntl.h b/linux-user/mips/target_fcntl.h
> index 795bba7..6fc7b8a 100644
> --- a/linux-user/mips/target_fcntl.h
> +++ b/linux-user/mips/target_fcntl.h
> @@ -28,11 +28,20 @@
>  #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
> +
> +struct target_flock {
> +    short l_type;
> +    short l_whence;
> +    abi_long l_start;
> +    abi_long l_len;
> +    abi_long l_sysid;
> +    int l_pid;
> +    abi_long pad[4];
> +};
> +
> +#define TARGET_HAVE_ARCH_STRUCT_FLOCK
> +
>  #endif
> -#define TARGET_ARCH_FLOCK64_PAD
>  
>  #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
>  #define TARGET_F_SETLK64       34
> 

Applied to my linux-user branch.

Thanks,
Laurent



  reply	other threads:[~2019-07-01  8:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 10:43 [Qemu-devel] [PATCH v16 0/5] linux-user: A set of miscellaneous patches Aleksandar Markovic
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 1/5] linux-user: Add support for translation of statx() syscall Aleksandar Markovic
2019-06-29  0:53   ` Aleksandar Markovic
2019-06-29  4:06     ` Jim Wilson
2019-06-30 15:44       ` Aleksandar Markovic
2019-07-01  8:40   ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 2/5] linux-user: Add support for strace for " Aleksandar Markovic
2019-07-01  8:42   ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 3/5] linux-user: Fix target_flock structure for MIPS O64 ABI Aleksandar Markovic
2019-07-01  8:42   ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 4/5] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK Aleksandar Markovic
2019-07-01  8:43   ` Laurent Vivier [this message]
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 5/5] linux-user: Handle EXCP_FPE properly for MIPS Aleksandar Markovic
2019-07-01  8:44   ` Laurent Vivier
2019-07-01  8:46   ` Laurent Vivier
2019-06-28 11:30 ` [Qemu-devel] [PATCH v16 0/5] linux-user: A set of miscellaneous patches no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30a8fd18-3a5b-b9c0-00b5-1e2996bcc87c@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=aleksandar.markovic@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).