From nobody Tue Feb 10 19:09:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561719445; cv=none; d=zoho.com; s=zohoarc; b=YTy5YYYF8GrYCCToH5fE69o9TEOh4W9AOfduXCfQ+jFP+89DfM7s0G696B5PTVtyWh5Yl/vuFXPInF4Jg4pgFR+o0BFUAIJC+NPELv0HmH5y5wOJ+fwlZw+MHhYWaDlmnfj2Tw2e3sXj3NksShssxvtEdV2JDn4lRf1W7vyRQE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561719445; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hfsBD7HjfvUwimfamvGBsgIrlOIT8AUJiKEj3zKHy2o=; b=XO4K/V93FjZsPi423h4D8n2//ctlRoWv5wpG+I+crwW2gi3GPz2Z9TGk5ajJYDBRAdImmDR4VY+PvDh+y6JcEadT9BrVUoPSIAmylokDUgysHlT9HKqunhTW23QF+w/Jo11f+fiRtZgjoAOZ/NVi3sFUFqQd53O3sP2gx2HAV2I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561719445025629.8149422888408; Fri, 28 Jun 2019 03:57:25 -0700 (PDT) Received: from localhost ([::1]:58822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgoZC-0001mk-6J for importer@patchew.org; Fri, 28 Jun 2019 06:57:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33626) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgoMG-0006w0-BI for qemu-devel@nongnu.org; Fri, 28 Jun 2019 06:43:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgoME-0000Hc-VY for qemu-devel@nongnu.org; Fri, 28 Jun 2019 06:43:56 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:46580 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgoME-0000GW-Lm for qemu-devel@nongnu.org; Fri, 28 Jun 2019 06:43:54 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 6E68F1A2447; Fri, 28 Jun 2019 12:43:52 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 4B1291A2456; Fri, 28 Jun 2019 12:43:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 28 Jun 2019 12:43:37 +0200 Message-Id: <1561718618-20218-5-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561718618-20218-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1561718618-20218-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v16 4/5] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aleksandar Markovic 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 Reviewed-by: Laurent Vivier --- 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 =20 +#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 =3D=3D 32) - abi_long l_sysid; -#endif int l_pid; TARGET_ARCH_FLOCK_PAD }; +#endif =20 +#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. */ =20 #if (TARGET_ABI_BITS =3D=3D 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 =20 #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ #define TARGET_F_SETLK64 34 --=20 2.7.4