[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 4/6] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FL

From: Laurent Vivier
Subject: [Qemu-devel] [PULL 4/6] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK
Date: Tue, 2 Jul 2019 17:05:43 +0200

From: Aleksandar Markovic <address@hidden>

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 <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
 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 1b48ddeb99fe..9f727d4df2c8 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
@@ -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;
     int l_pid;
@@ -149,3 +149,5 @@ struct target_flock64 {
diff --git a/linux-user/mips/target_fcntl.h b/linux-user/mips/target_fcntl.h
index 795bba754b5a..6fc7b8a12bfc 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];
+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_F_GETLK64       33      /*  using 'struct flock64' */
 #define TARGET_F_SETLK64       34

reply via email to

[Prev in Thread] Current Thread [Next in Thread]