From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646654617; cv=none; d=zohomail.com; s=zohoarc; b=GRH+hu+DUDnyaNikgS6IES25Go+QnCMcBBcSTxL+7hi581qRuggiy8XFN6rPbgu7cPiPcYtIn5GMHRp+zhQ4M/a5dBnAqb0gde7Tuiv04AcBFFXCAcqGqce8/9UrWjkhoKQjmE/EMga0YprSQIWemF/Gcx3ZXOlyhJY/O86adW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646654617; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KO3uCcDtoP8ypvHqVZeogjqwQxCYF7uWlWLOucj+apQ=; b=MltKGZBod8O1Y97vSMO1CYnqcEFWAeixAJtcrzHNGhXWOETnXEArBXx32bdTjyddVnGym2EwuTHnSixsw3eWzd3isVo1zyU7D9BcSbNQ+AwEx+lUtuxyvuH74MafzGOIJnR3OSC1RhmNzpX2+yo/C5QVodgt8ZDbCSe6K51jAms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646654617379110.55376450696212; Mon, 7 Mar 2022 04:03:37 -0800 (PST) Received: from localhost ([::1]:47094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRC4a-0006Wq-Mu for importer@patchew.org; Mon, 07 Mar 2022 07:03:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBzY-0000iH-NU for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:57:32 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:34857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBzX-0004Q5-6i for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:57:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:References:In-Reply-To:Message-Id:Content-ID: Content-Description; bh=KO3uCcDtoP8ypvHqVZeogjqwQxCYF7uWlWLOucj+apQ=; b=CDT90 R1XMJyayWqWK9zOA+/nAsoQJ24iB5jJpi1HigtE+rL/zUtGxHqV79pqB3vUSMTLTM+4aQj41Fn9jC owuyKYiOOCS/iQvfqcdTPSzzWFLb8cadhgK/SHhsZjwy8p++v/VPnJFa7ZcdT+ktRQAtCFdCWvt4x En6Y/WR6mNZdGnAMh63qVrg8dmSJRxMCLgB/ywbTPHc0u2GqltDTdKmy+SRWGmXXQ4w0ANk0iymBn udtPmWbwAgBYxN1Ij97eSgF4lk4QnkdjpVCXQrXgIn1aD9EqDrR/xjYlNmpzaiOcggtL+npz1+Ook vJKXPb0q7B0V/LmLrTlpbFTHQmi9Q==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 01/19] 9p: linux: Fix a couple Linux assumptions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=e0bd743bb2dd4985791d4de880446bdbb4e04fed@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646654618865100001 From: Keno Fischer - Guard Linux only headers. - Add qemu/statfs.h header to abstract over the which headers are needed for struct statfs - Define `ENOATTR` only if not only defined (it's defined in system headers on Darwin). Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch While it might at first appear that fsdev/virtfs-proxy-header.c would need similar adjustment for darwin as file-op-9p here, a later patch in this series disables virtfs-proxy-helper for non-Linux. Allowing virtfs-proxy-helper on darwin could potentially be an additional optimization later. [Will Cohen: - Fix headers for Alpine - Integrate statfs.h back into file-op-9p.h - Remove superfluous header guards from file-opt-9p - Add note about virtfs-proxy-helper being disabled on non-Linux for this patch series] Signed-off-by: Will Cohen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Greg Kurz Message-Id: <20220227223522.91937-2-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck --- fsdev/file-op-9p.h | 9 ++++++++- hw/9pfs/9p-local.c | 2 ++ hw/9pfs/9p.c | 4 ++++ include/qemu/xattr.h | 4 +++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 8fd89f0447..4997677460 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -16,10 +16,17 @@ =20 #include #include -#include #include "qemu-fsdev-throttle.h" #include "p9array.h" =20 +#ifdef CONFIG_LINUX +# include +#endif +#ifdef CONFIG_DARWIN +# include +# include +#endif + #define SM_LOCAL_MODE_BITS 0600 #define SM_LOCAL_DIR_MODE_BITS 0700 =20 diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 210d9e7705..1a5e3eed73 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -32,10 +32,12 @@ #include "qemu/error-report.h" #include "qemu/option.h" #include +#ifdef CONFIG_LINUX #include #ifdef CONFIG_LINUX_MAGIC_H #include #endif +#endif #include =20 #ifndef XFS_SUPER_MAGIC diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 15b3f4d385..9c63e14b28 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -32,7 +32,11 @@ #include "migration/blocker.h" #include "qemu/xxhash.h" #include +#ifdef CONFIG_LINUX #include +#else +#include +#endif =20 int open_fd_hw; int total_open_fd; diff --git a/include/qemu/xattr.h b/include/qemu/xattr.h index a83fe8e749..f1d0f7be74 100644 --- a/include/qemu/xattr.h +++ b/include/qemu/xattr.h @@ -22,7 +22,9 @@ #ifdef CONFIG_LIBATTR # include #else -# define ENOATTR ENODATA +# if !defined(ENOATTR) +# define ENOATTR ENODATA +# endif # include #endif =20 --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646654413; cv=none; d=zohomail.com; s=zohoarc; b=neHKorOmSSmrzTRfFMrn2xmw6TIZ5gosB3Avo5trqy+LG+Ohy/d/sprkyDPf0A9Q8Q43Kv4ldAE1ADYwNiqUyjfZ130Fm+3aZrFekh8vKfAessZAtqsGEp+ceEHRwBS71YID1e+vXP0T6X0ABrT7XRqzXzyZf+U8dAWTxpxUvlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646654413; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5oLuXWTJKZvpRWIxoiPJFUVce5lljtpqW3n1BbXrpOw=; b=Ewb5YPAb397wg8IPkJmCz7l4YGORFCuW0qTALWzeWSN6UZulaZqdj80jiDrwHb5sDkM2EoagtOtqTLae/rcbF1mF0ssu2QvdGGac+EssVrjK/3vzG171f9nGooBSgYz/QFZwqHFoXcY0wEbNH3XHS/EVGHcUkr1lNURCUa2A6ws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646654413877126.87571142520858; Mon, 7 Mar 2022 04:00:13 -0800 (PST) Received: from localhost ([::1]:43920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRC28-0004NT-P1 for importer@patchew.org; Mon, 07 Mar 2022 07:00:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6450084a66b6cf72b9126a8c8ecead7ddca896e9@lizzy.crudebyte.com>) id 1nRBpi-00008F-TX for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:47:23 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:35455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6450084a66b6cf72b9126a8c8ecead7ddca896e9@lizzy.crudebyte.com>) id 1nRBph-0002ln-8S for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:47:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:References:In-Reply-To:Message-Id:Content-ID: Content-Description; bh=5oLuXWTJKZvpRWIxoiPJFUVce5lljtpqW3n1BbXrpOw=; b=PBwzf 8gcOAjiPv2NQPgnzHKOgfbgnzLgN0gQR8RQxQIA4OaT613ZsocBi3IZlONHTXwi3HsJf5VPHuMso8 F0q8sXL8WihHkFy9S3T2K6pP4N7neM6rouplDjHuU0KpqsA6Ssgit76GSDiwRFradhEMKxH0HUyfR V1IF2bR1sxMmTUCfnroQ49ON+/dDVoqQ3hHBF3170N7uRu2QuRUPDYGw8ImguWVh7w1lBQqdrGdLv 6vXq8/0s7RsmkkClIh0wpLnvx0DI7eeUjmeeUguGsrA0jfvp2fmdej3aT/FLrO36oDExJE/pbmAr5 trwjcz4muOigw8hs0GSsQ6lfpaBgg==; Message-Id: <6450084a66b6cf72b9126a8c8ecead7ddca896e9.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 02/19] 9p: Rename 9p-util -> 9p-util-linux MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=6450084a66b6cf72b9126a8c8ecead7ddca896e9@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646654416052100003 From: Keno Fischer The current file only has the Linux versions of these functions. Rename the file accordingly and update the Makefile to only build it on Linux. A Darwin version of these will follow later in the series. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch Signed-off-by: Will Cohen Reviewed-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220227223522.91937-3-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck --- hw/9pfs/{9p-util.c =3D> 9p-util-linux.c} | 2 +- hw/9pfs/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename hw/9pfs/{9p-util.c =3D> 9p-util-linux.c} (97%) diff --git a/hw/9pfs/9p-util.c b/hw/9pfs/9p-util-linux.c similarity index 97% rename from hw/9pfs/9p-util.c rename to hw/9pfs/9p-util-linux.c index 3221d9b498..398614a5d0 100644 --- a/hw/9pfs/9p-util.c +++ b/hw/9pfs/9p-util-linux.c @@ -1,5 +1,5 @@ /* - * 9p utilities + * 9p utilities (Linux Implementation) * * Copyright IBM, Corp. 2017 * diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 99be5d9119..1b28e70040 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -4,7 +4,6 @@ fs_ss.add(files( '9p-posix-acl.c', '9p-proxy.c', '9p-synth.c', - '9p-util.c', '9p-xattr-user.c', '9p-xattr.c', '9p.c', @@ -14,6 +13,7 @@ fs_ss.add(files( 'coth.c', 'coxattr.c', )) +fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c')) fs_ss.add(when: 'CONFIG_XEN', if_true: files('xen-9p-backend.c')) softmmu_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss) =20 --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646654807; cv=none; d=zohomail.com; s=zohoarc; b=fVtj3oOMppoxr59Z6E3KviX1iK6+pMK3pPwD87LjgovEUk/MOcYAim2WiBnqYdlzR6QbJUTP0SgGFNwztjifOCyB3f9zZUazWtV7xS46+l/2IarjP8WDHlnKuBVlr2tDwx5lzwMdNyEZWkgrCFBFLyll0Ttyhg7jBGCrZzfaAyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646654807; 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; bh=Q5FQJ2Reo2gOK3Lkjz7qs1014MSz8wpQlPECzV97A/A=; b=EU+9W7jlo5dIwelTqSn9sQYLaUjlgnmQ9fn9pLhIRQoCr6hj3ZSXjzCUYqBFPOLcPSPjrB8bM6eBlSq0YgcYZc4RGjtKxFpQjsQYHyGOpNs4I63E/jhC0mVNiLAVx2ZavH7ll9dPBIuEY5/tBSHYZyhv8mK1ULqOKk5gZHebNeo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646654807516553.0431580970267; Mon, 7 Mar 2022 04:06:47 -0800 (PST) Received: from localhost ([::1]:52520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRC8V-000292-0Q for importer@patchew.org; Mon, 07 Mar 2022 07:06:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBUL-0005Ot-43 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:19 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:57653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBUC-00070d-PV for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=Q5FQJ2Reo2gOK3Lkjz7qs1014MSz8wpQlPECzV97A/A=; b=YdKgI PWP7bYzbszzc0rtInaHSXvZaoM/NAzZSTvuxQpL+6xFWyxMuCGi/U+anmbCYRTZSx3V49z/4jNs/K lnlUi09hQq79fsOXGrf45GHIgMSoTnxjITdNpRTla0V6U+FbURygWd2SnzLZvsWxTxE3h2UsYuAWN uxy0CneR+DWoqmGCx4YXy+nejfc3po3bJVtQeOz4SZRHXd3ZPI4O/XM9Z/wOx1G+nnD81hjN0968F Vq+pOFplQmQDezM2PlmIR1wjFjiaNmtNnie/5U9PCMBsNryQMS1mig1DU39kG6tywUZOWBQi9OvuI A9YDwwro+YHcRj2AaY1y0mxZJz5GQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 03/19] 9p: darwin: Handle struct stat(fs) differences To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=f41db099c71151291c269bf48ad006de9cbd9ca6@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646654809866100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Signed-off-by: Keno Fischer Signed-off-by: Michael Roitzsch [Will Cohen: - Note lack of f_namelen and f_frsize on Darwin - Ensure that tv_sec and tv_nsec are both initialized for Darwin and non-Darwin] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-4-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p-proxy.c | 22 ++++++++++++++++++++-- hw/9pfs/9p-synth.c | 2 ++ hw/9pfs/9p.c | 16 ++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index 09bd9f1464..b1664080d8 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -123,10 +123,16 @@ static void prstatfs_to_statfs(struct statfs *stfs, P= roxyStatFS *prstfs) stfs->f_bavail =3D prstfs->f_bavail; stfs->f_files =3D prstfs->f_files; stfs->f_ffree =3D prstfs->f_ffree; +#ifdef CONFIG_DARWIN + /* f_namelen and f_frsize do not exist on Darwin */ + stfs->f_fsid.val[0] =3D prstfs->f_fsid[0] & 0xFFFFFFFFU; + stfs->f_fsid.val[1] =3D prstfs->f_fsid[1] >> 32 & 0xFFFFFFFFU; +#else stfs->f_fsid.__val[0] =3D prstfs->f_fsid[0] & 0xFFFFFFFFU; stfs->f_fsid.__val[1] =3D prstfs->f_fsid[1] >> 32 & 0xFFFFFFFFU; stfs->f_namelen =3D prstfs->f_namelen; stfs->f_frsize =3D prstfs->f_frsize; +#endif } =20 /* Converts proxy_stat structure to VFS stat structure */ @@ -143,12 +149,24 @@ static void prstat_to_stat(struct stat *stbuf, ProxyS= tat *prstat) stbuf->st_size =3D prstat->st_size; stbuf->st_blksize =3D prstat->st_blksize; stbuf->st_blocks =3D prstat->st_blocks; + stbuf->st_atime =3D prstat->st_atim_sec; + stbuf->st_mtime =3D prstat->st_mtim_sec; + stbuf->st_ctime =3D prstat->st_ctim_sec; +#ifdef CONFIG_DARWIN + stbuf->st_atimespec.tv_sec =3D prstat->st_atim_sec; + stbuf->st_mtimespec.tv_sec =3D prstat->st_mtim_sec; + stbuf->st_ctimespec.tv_sec =3D prstat->st_ctim_sec; + stbuf->st_atimespec.tv_nsec =3D prstat->st_atim_nsec; + stbuf->st_mtimespec.tv_nsec =3D prstat->st_mtim_nsec; + stbuf->st_ctimespec.tv_nsec =3D prstat->st_ctim_nsec; +#else stbuf->st_atim.tv_sec =3D prstat->st_atim_sec; + stbuf->st_mtim.tv_sec =3D prstat->st_mtim_sec; + stbuf->st_ctim.tv_sec =3D prstat->st_ctim_sec; stbuf->st_atim.tv_nsec =3D prstat->st_atim_nsec; - stbuf->st_mtime =3D prstat->st_mtim_sec; stbuf->st_mtim.tv_nsec =3D prstat->st_mtim_nsec; - stbuf->st_ctime =3D prstat->st_ctim_sec; stbuf->st_ctim.tv_nsec =3D prstat->st_ctim_nsec; +#endif } =20 /* diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 7a7cd5c5ba..bf9b0c5ddd 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -439,7 +439,9 @@ static int synth_statfs(FsContext *s, V9fsPath *fs_path, stbuf->f_bsize =3D 512; stbuf->f_blocks =3D 0; stbuf->f_files =3D synth_node_count; +#ifndef CONFIG_DARWIN stbuf->f_namelen =3D NAME_MAX; +#endif return 0; } =20 diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 9c63e14b28..1563d7b7c6 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1313,11 +1313,17 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const = struct stat *stbuf, v9lstat->st_blksize =3D stat_to_iounit(pdu, stbuf); v9lstat->st_blocks =3D stbuf->st_blocks; v9lstat->st_atime_sec =3D stbuf->st_atime; - v9lstat->st_atime_nsec =3D stbuf->st_atim.tv_nsec; v9lstat->st_mtime_sec =3D stbuf->st_mtime; - v9lstat->st_mtime_nsec =3D stbuf->st_mtim.tv_nsec; v9lstat->st_ctime_sec =3D stbuf->st_ctime; +#ifdef CONFIG_DARWIN + v9lstat->st_atime_nsec =3D stbuf->st_atimespec.tv_nsec; + v9lstat->st_mtime_nsec =3D stbuf->st_mtimespec.tv_nsec; + v9lstat->st_ctime_nsec =3D stbuf->st_ctimespec.tv_nsec; +#else + v9lstat->st_atime_nsec =3D stbuf->st_atim.tv_nsec; + v9lstat->st_mtime_nsec =3D stbuf->st_mtim.tv_nsec; v9lstat->st_ctime_nsec =3D stbuf->st_ctim.tv_nsec; +#endif /* Currently we only support BASIC fields in stat */ v9lstat->st_result_mask =3D P9_STATS_BASIC; =20 @@ -3519,9 +3525,15 @@ static int v9fs_fill_statfs(V9fsState *s, V9fsPDU *p= du, struct statfs *stbuf) f_bavail =3D stbuf->f_bavail / bsize_factor; f_files =3D stbuf->f_files; f_ffree =3D stbuf->f_ffree; +#ifdef CONFIG_DARWIN + fsid_val =3D (unsigned int)stbuf->f_fsid.val[0] | + (unsigned long long)stbuf->f_fsid.val[1] << 32; + f_namelen =3D NAME_MAX; +#else fsid_val =3D (unsigned int) stbuf->f_fsid.__val[0] | (unsigned long long)stbuf->f_fsid.__val[1] << 32; f_namelen =3D stbuf->f_namelen; +#endif =20 return pdu_marshal(pdu, offset, "ddqqqqqqd", f_type, f_bsize, f_blocks, f_bfree, --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646653385; cv=none; d=zohomail.com; s=zohoarc; b=X2DSla7mlgkJnxZRrdACZiy1Y0IssGB0FCuVoa4Iln6RNtrP+vKzhuuwfC/J2/dHukV/pa2gyLpfHMNh5JCEv2AOK01lI3uM04GeG1pv42NwG1G+9QOoEQZhj8CaOXxGKvo3eZo3uip4z8xJpuOdPCCiulIJGA/K4BOQQFOwILU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646653385; 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; bh=3u34sir+ZeZHfQZGfZ8IvSlB23QK/T53fLss006PEqs=; b=jIYcROLMh0BujHUYqBuCb7nmBjuGCmkq9Dvgw6Qifz90X5/dV/XFUwp97VLGxHPoA125/b2nXVyz2GgWgYjk1z/2agUJ6vtEem3RWx/DHSFpDSfeKvTt1DOA6gFaM4Gg1Psk6zbuWu+Kg4W9PB0GPwgRsU6IbJFNl7OpWXBafmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646653385613408.09443141007193; Mon, 7 Mar 2022 03:43:05 -0800 (PST) Received: from localhost ([::1]:56854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRBlY-0000JO-Ep for importer@patchew.org; Mon, 07 Mar 2022 06:43:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6b3b279bd670c6a2fa23c9049820c814f0e2c846@lizzy.crudebyte.com>) id 1nRBUY-0005Vh-Tn for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:32 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:45295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6b3b279bd670c6a2fa23c9049820c814f0e2c846@lizzy.crudebyte.com>) id 1nRBUK-00072i-Ti for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=3u34sir+ZeZHfQZGfZ8IvSlB23QK/T53fLss006PEqs=; b=MSt1j gf2zWnFbIQkw3hgZ2KcfRMed14z6Dij7qzu4/GbmrO2rDjezNv1xTDXK63C+Il9Ee7Chuk1TDfhxX Nezf734zhusFkwoSYlFa6dAFrgajmqhGb+WiaCTTYhuuX+G9VPbyh3tyLhUFeC2n2LwMwy1Mng0CM ncj8U866UrsAkR4FqNth77/4o6HdbGEttkmggB+RZYN0R71V3fP775HbMfzruxl9/yn6O7HPiQG8d AYRSs1NYo0YLfRMwuenbt4TYY8aCVxsRohu39py+OXOqABWNr16S2FE7U1DXKtfJ/qZPnfRUsKyy9 M1x1Gax1816SiBdcPL5mKx5NMe0sg==; Message-Id: <6b3b279bd670c6a2fa23c9049820c814f0e2c846.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 04/19] 9p: darwin: Handle struct dirent differences To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=6b3b279bd670c6a2fa23c9049820c814f0e2c846@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646653386734100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer On darwin d_seekoff exists, but is optional and does not seem to be commonly used by file systems. Use `telldir` instead to obtain the seek offset and inject it into d_seekoff, and create a qemu_dirent_off helper to call it appropriately when appropriate. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch [Will Cohen: - Adjust to pass testing - Ensure that d_seekoff is filled using telldir on darwin, and create qemu_dirent_off helper to decide which to access] [Fabian Franz: - Add telldir error handling for darwin] Signed-off-by: Fabian Franz [Will Cohen: - Ensure that telldir error handling uses signed int - Cleanup of telldir error handling - Remove superfluous error handling for qemu_dirent_off - Adjust formatting - Use qemu_dirent_off in codir.c - Declare qemu_dirent_off as static to prevent linker error - Move qemu_dirent_off above the end-of-file endif to fix compilation] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-5-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p-local.c | 9 +++++++++ hw/9pfs/9p-proxy.c | 16 +++++++++++++++- hw/9pfs/9p-synth.c | 4 ++++ hw/9pfs/9p-util.h | 16 ++++++++++++++++ hw/9pfs/9p.c | 7 +++++-- hw/9pfs/codir.c | 4 +++- 6 files changed, 52 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 1a5e3eed73..f3272f0b43 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -562,6 +562,15 @@ again: if (!entry) { return NULL; } +#ifdef CONFIG_DARWIN + int off; + off =3D telldir(fs->dir.stream); + /* If telldir fails, fail the entire readdir call */ + if (off < 0) { + return NULL; + } + entry->d_seekoff =3D off; +#endif =20 if (ctx->export_flags & V9FS_SM_MAPPED) { entry->d_type =3D DT_UNKNOWN; diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index b1664080d8..8b4b5cf7dc 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -706,7 +706,21 @@ static off_t proxy_telldir(FsContext *ctx, V9fsFidOpen= State *fs) =20 static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs) { - return readdir(fs->dir.stream); + struct dirent *entry; + entry =3D readdir(fs->dir.stream); +#ifdef CONFIG_DARWIN + if (!entry) { + return NULL; + } + int td; + td =3D telldir(fs->dir.stream); + /* If telldir fails, fail the entire readdir call */ + if (td < 0) { + return NULL; + } + entry->d_seekoff =3D td; +#endif + return entry; } =20 static void proxy_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index bf9b0c5ddd..b3080e415b 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -234,7 +234,11 @@ static void synth_direntry(V9fsSynthNode *node, offsetof(struct dirent, d_name) + sz); memcpy(entry->d_name, node->name, sz); entry->d_ino =3D node->attr->inode; +#ifdef CONFIG_DARWIN + entry->d_seekoff =3D off + 1; +#else entry->d_off =3D off + 1; +#endif } =20 static struct dirent *synth_get_dentry(V9fsSynthNode *dir, diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 546f46dc7d..7449733c15 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -78,4 +78,20 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *fil= ename, ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, const char *name); =20 +/** + * Darwin has d_seekoff, which appears to function similarly to d_off. + * However, it does not appear to be supported on all file systems, + * so ensure it is manually injected earlier and call here when + * needed. + */ +static inline off_t qemu_dirent_off(struct dirent *dent) +{ +#ifdef CONFIG_DARWIN + return dent->d_seekoff; +#else + return dent->d_off; +#endif +} + + #endif diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 1563d7b7c6..caf3b240fe 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -27,6 +27,7 @@ #include "virtio-9p.h" #include "fsdev/qemu-fsdev.h" #include "9p-xattr.h" +#include "9p-util.h" #include "coth.h" #include "trace.h" #include "migration/blocker.h" @@ -2281,7 +2282,7 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9f= sPDU *pdu, count +=3D len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); - saved_dir_pos =3D dent->d_off; + saved_dir_pos =3D qemu_dirent_off(dent); } =20 v9fs_readdir_unlock(&fidp->fs.dir); @@ -2420,6 +2421,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, V9fsString name; int len, err =3D 0; int32_t count =3D 0; + off_t off; struct dirent *dent; struct stat *st; struct V9fsDirEnt *entries =3D NULL; @@ -2480,12 +2482,13 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pd= u, V9fsFidState *fidp, qid.version =3D 0; } =20 + off =3D qemu_dirent_off(dent); v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); =20 /* 11 =3D 7 + 4 (7 =3D start offset, 4 =3D space for storing count= ) */ len =3D pdu_marshal(pdu, 11 + count, "Qqbs", - &qid, dent->d_off, + &qid, off, dent->d_type, &name); =20 v9fs_string_free(&name); diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index c0873bde16..f96d8ac4e6 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -22,6 +22,8 @@ #include "qemu/coroutine.h" #include "qemu/main-loop.h" #include "coth.h" +#include "9p-xattr.h" +#include "9p-util.h" =20 /* * Intended to be called from bottom-half (e.g. background I/O thread) @@ -166,7 +168,7 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *= fidp, } =20 size +=3D len; - saved_dir_pos =3D dent->d_off; + saved_dir_pos =3D qemu_dirent_off(dent); } =20 /* restore (last) saved position */ --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646654952; cv=none; d=zohomail.com; s=zohoarc; b=SZJ0xH+0w50S87W2B7+08/QdDzBoeD0Mn/6orAM8z39HI74UTuqvnFVqbT2/YxClLZ0WUjKvqhGwojPAzn8qeFiisUNxLrRr++hs/pv6BrkC1eUqpiN6TzT6x+Fkqr+Tw96SKhedi4Wa/cxpY6TQ21MxBjFfgmKufI7P07/MSIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646654952; 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; bh=gEkMfmU/1Fn/SSfM8FnRnK2abQo4v0plT/myHJeapCw=; b=PggNbg7U3hUSdFVk36LTGCnH7E5/J51Eh1CYLi9TMylk4mVdMizXGlbvWr9rmgASanmu9JjYqQAloXZnqHzolUkKExKaTT2z8+pir/xSWMbEzcYEYgZUj56bFInMyHVmuPWthiK7v47RwUidCZBqcJFaUgD8iov+/6aw3S8grEg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646654952404491.89034880332736; Mon, 7 Mar 2022 04:09:12 -0800 (PST) Received: from localhost ([::1]:60918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCAp-0007wc-8y for importer@patchew.org; Mon, 07 Mar 2022 07:09:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <67a71e3b71a2834d028031a92e76eb9444e423c6@lizzy.crudebyte.com>) id 1nRBUa-0005Wj-Uv for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:33 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:48867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <67a71e3b71a2834d028031a92e76eb9444e423c6@lizzy.crudebyte.com>) id 1nRBUT-000752-SU for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=gEkMfmU/1Fn/SSfM8FnRnK2abQo4v0plT/myHJeapCw=; b=CQ+gL Oj2EYTNMoUVD9Z8mfWDlznIDBjpXbBc7k04sD3Iu9q3Ym0uXI3+RT6xnZZW0jJGC5EtHEGEvUPRfA cPPhI+SHjKWA9StZWuDO0ziuBFt6030RsIH1eM1kJBzrdE44vVQ/8jjZ/D9NxrIcjU+Qa0pm/FtJR 2aZCpCdJ2IcTumtTLLf1FdNZdDHvR3CUMuG53SNRJhG0iC1E3UJFy5P6IHT2f4RhqKDxAjKRkQpfX 1BdX9OTMmByiC8ncbehztRJOLmXaUDHus+/jzPTcAnO8Fq46Go8FqQqp1/RTmjwHyFoK29IIBnLhl GEJxogLitK/aS9004irPyuAyFP8Iw==; Message-Id: <67a71e3b71a2834d028031a92e76eb9444e423c6.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 05/19] 9p: darwin: Ignore O_{NOATIME, DIRECT} To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=67a71e3b71a2834d028031a92e76eb9444e423c6@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646654954006100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Darwin doesn't have either of these flags. Darwin does have F_NOCACHE, which is similar to O_DIRECT, but has different enough semantics that other projects don't generally map them automatically. In any case, we don't support O_DIRECT on Linux at the moment either. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch [Will Cohen: - Adjust coding style] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-6-wwcohen@gmail.com> [C.S.: - Fix compiler warning "unused label 'again'". ] Link: https://lore.kernel.org/qemu-devel/11201492.CjeqJxXfGd@silver/ Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p-util.h | 4 ++++ hw/9pfs/9p.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 7449733c15..a48da32f04 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -37,10 +37,13 @@ static inline int openat_file(int dirfd, const char *na= me, int flags, { int fd, serrno, ret; =20 +#ifndef CONFIG_DARWIN again: +#endif fd =3D openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, mode); if (fd =3D=3D -1) { +#ifndef CONFIG_DARWIN if (errno =3D=3D EPERM && (flags & O_NOATIME)) { /* * The client passed O_NOATIME but we lack permissions to hono= r it. @@ -53,6 +56,7 @@ again: flags &=3D ~O_NOATIME; goto again; } +#endif return -1; } =20 diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index caf3b240fe..14e84c3bcf 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -138,11 +138,20 @@ static int dotl_to_open_flags(int flags) { P9_DOTL_NONBLOCK, O_NONBLOCK } , { P9_DOTL_DSYNC, O_DSYNC }, { P9_DOTL_FASYNC, FASYNC }, +#ifndef CONFIG_DARWIN + { P9_DOTL_NOATIME, O_NOATIME }, + /* + * On Darwin, we could map to F_NOCACHE, which is + * similar, but doesn't quite have the same + * semantics. However, we don't support O_DIRECT + * even on linux at the moment, so we just ignore + * it here. + */ { P9_DOTL_DIRECT, O_DIRECT }, +#endif { P9_DOTL_LARGEFILE, O_LARGEFILE }, { P9_DOTL_DIRECTORY, O_DIRECTORY }, { P9_DOTL_NOFOLLOW, O_NOFOLLOW }, - { P9_DOTL_NOATIME, O_NOATIME }, { P9_DOTL_SYNC, O_SYNC }, }; =20 @@ -171,10 +180,12 @@ static int get_dotl_openflags(V9fsState *s, int oflag= s) */ flags =3D dotl_to_open_flags(oflags); flags &=3D ~(O_NOCTTY | O_ASYNC | O_CREAT); +#ifndef CONFIG_DARWIN /* * Ignore direct disk access hint until the server supports it. */ flags &=3D ~O_DIRECT; +#endif return flags; } =20 --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646652954; cv=none; d=zohomail.com; s=zohoarc; b=k+wXerFOnMxOnoEW8rNOE9olnOTLrb24PUHnQSteEBr0AiAyguHyjHXvq8N70Ern60VpOvgPYtYVa//ejMyw8wqlGfzC2WGRog6jLpzefg++EugCpbeVbv7cUM5dRWuO8aQHob6Rr2/xqkvaiDzpvYg2SBpM/uRd6RV8Z9BXhJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646652954; 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; bh=E9U8f+CE/a5/AN3TPLs6/9FG2x5Jkw+GdC7Z0ig5vNY=; b=eklXe/1R3ItucfZafj+EC0IuukVu0JrAvAinVH3eZ7fuiD0tJV3h/5sCRTRb1nEQtjMEOJmOKgonTRlpRwXdOwWM4GvhOvslhUYqdX7HXT489j1gt9RqY/tXn86iOy+EbhMR5Fg2CU699P3iwJn+jSpTib3tH83M7E5o0448m4I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646652954016858.147345009031; Mon, 7 Mar 2022 03:35:54 -0800 (PST) Received: from localhost ([::1]:37648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRBeZ-00046k-Nu for importer@patchew.org; Mon, 07 Mar 2022 06:35:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <38d7fd68b0c8775b5253ab84367419621aa032e6@lizzy.crudebyte.com>) id 1nRBUd-0005Y1-3V for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:37 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:41381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <38d7fd68b0c8775b5253ab84367419621aa032e6@lizzy.crudebyte.com>) id 1nRBUY-000761-R6 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:25:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=E9U8f+CE/a5/AN3TPLs6/9FG2x5Jkw+GdC7Z0ig5vNY=; b=TieuR 9Hnh238l020bjL+vqLWJvES9vM2rM1NT9J2E6fctWAkLawfEyltvQxGATGMTI4/HD3FScFP72KOPo v4EGKrMldRZzUbHc13cX+YG02Iuzxk63Yt0+8UGTKz/f54Kg0lanlHFPS7IHJkOkm8drkfcnVq1P5 ZeIhYy0LQ0DJ/bMbHBi0V1c0cAAiqyzt9MS8Joe0HCelqvVHafm+9wKFfHXv7qSFzTFu7z6JMxQzY A1JJk5FUsPqGqe8aQyiapIu4a2xFdvx7nJ7atRbEQT5SJHTaH1GKH1n3ahxAcFThFASrAp+Djab8I 9toQaAaz6xze8nBQ8g8OAma55mhTw==; Message-Id: <38d7fd68b0c8775b5253ab84367419621aa032e6.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 06/19] 9p: darwin: Move XATTR_SIZE_MAX->P9_XATTR_SIZE_MAX To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=38d7fd68b0c8775b5253ab84367419621aa032e6@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646652955154100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Signed-off-by: Keno Fischer Signed-off-by: Michael Roitzsch Because XATTR_SIZE_MAX is not defined on Darwin, create a cross-platform P9_XATTR_SIZE_MAX instead. [Will Cohen: - Adjust coding style - Lower XATTR_SIZE_MAX to 64k - Add explanatory context related to XATTR_SIZE_MAX] [Fabian Franz: - Move XATTR_SIZE_MAX reference from 9p.c to P9_XATTR_SIZE_MAX in 9p.h] Signed-off-by: Will Cohen Signed-off-by: Fabian Franz [Will Cohen: - For P9_XATTR_MAX, ensure that Linux uses XATTR_SIZE_MAX, Darwin uses 64k, and error out for undefined hosts] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-7-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p.c | 2 +- hw/9pfs/9p.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 14e84c3bcf..7405352c37 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3949,7 +3949,7 @@ static void coroutine_fn v9fs_xattrcreate(void *opaqu= e) rflags |=3D XATTR_REPLACE; } =20 - if (size > XATTR_SIZE_MAX) { + if (size > P9_XATTR_SIZE_MAX) { err =3D -E2BIG; goto out_nofid; } diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 1567b67841..94b273b3d0 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -479,4 +479,22 @@ struct V9fsTransport { void (*push_and_notify)(V9fsPDU *pdu); }; =20 +#if defined(XATTR_SIZE_MAX) +/* Linux */ +#define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX +#elif defined(CONFIG_DARWIN) +/* + * Darwin doesn't seem to define a maximum xattr size in its user + * space header, so manually configure it across platforms as 64k. + * + * Having no limit at all can lead to QEMU crashing during large g_malloc() + * calls. Because QEMU does not currently support macOS guests, the below + * preliminary solution only works due to its being a reflection of the li= mit of + * Linux guests. + */ +#define P9_XATTR_SIZE_MAX 65536 +#else +#error Missing definition for P9_XATTR_SIZE_MAX for this host system +#endif + #endif --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646654307; cv=none; d=zohomail.com; s=zohoarc; b=Ryd6Jf8laWvG002Hr5diJbcpsPEpGfmjfXxnvNAepgEePVpapHRXsGuMZSwYXOtXmI07NsRXf7G//h3i9JRy8JqzooPX5d28dgv5OFV8JsMkzM49Bx1z/C0lw2swUJGPmk0JaejRZ2RPqtu7vGwe3dxm018SKIEdT65mjvlXMvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646654307; 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; bh=89Gbgq/kest9e+BQG9UtS5uVE2I3QP9MTMPZSp2J16Y=; b=PMxOQVGoJ6v6ffKyonBI9xOfiwqSbwuZX9OiTOqO1AOjcXVPJj0yUpsKK2PN4B2yD0eTpJkjA7n7q3lBvLMaDjNPPjS1hwtMuo1D6VjHqo02xpzpAUJbQXy5TVCwNwraORZt3e+AfSvXVKw4rGX0GmbIaw18tvR4z/wVQ8KSQHY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646654307858562.4709257233991; Mon, 7 Mar 2022 03:58:27 -0800 (PST) Received: from localhost ([::1]:38188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRC0Q-0000aU-SM for importer@patchew.org; Mon, 07 Mar 2022 06:58:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:32954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <57b3910bc3513ab515296692daafd1c546f3c115@lizzy.crudebyte.com>) id 1nRByU-0006Bx-6Q for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:56:26 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:54591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <57b3910bc3513ab515296692daafd1c546f3c115@lizzy.crudebyte.com>) id 1nRByS-0004Im-L0 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:56:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=89Gbgq/kest9e+BQG9UtS5uVE2I3QP9MTMPZSp2J16Y=; b=XB3b1 p6bpOwAu2A5dBE6PQF+EJYKUmPtYaWyuoyzGyMKn3KZNZfVpzbqOQRw0gNO8zw0Dul4HqnctZhBlz APAHQ9H5ppu+EJy/b6x9dQnKvLP3J46xCUcxF7js2M9q8x4fXkfqyfhea2Rja9wBX9XUN2G1KQB+a oIvSwfQqzjUPsnCEp++gvCY+av39WyjlRt0dcVDxfSB+MqV6avhu65HFuLZdDmB5gdeIF3UqLaUro lEoyDy5Fx6dP4XP9RSWiexdUMLzegJnlQl0VYCVRt7RGxUtOHCymmUXcnJqRJCSWu9bztGb1NYeC7 Zio3borJ6rtcXv2bVZjdRQ8Qwsjjg==; Message-Id: <57b3910bc3513ab515296692daafd1c546f3c115.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 07/19] 9p: darwin: *xattr_nofollow implementations To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=57b3910bc3513ab515296692daafd1c546f3c115@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646654309434100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer This implements the darwin equivalent of the functions that were moved to 9p-util(-linux) earlier in this series in the new 9p-util-darwin file. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-8-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Acked-by: Christian Schoenebeck --- hw/9pfs/9p-util-darwin.c | 64 ++++++++++++++++++++++++++++++++++++++++ hw/9pfs/meson.build | 1 + 2 files changed, 65 insertions(+) create mode 100644 hw/9pfs/9p-util-darwin.c diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c new file mode 100644 index 0000000000..cdb4c9e24c --- /dev/null +++ b/hw/9pfs/9p-util-darwin.c @@ -0,0 +1,64 @@ +/* + * 9p utilities (Darwin Implementation) + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/xattr.h" +#include "9p-util.h" + +ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *= name, + void *value, size_t size) +{ + int ret; + int fd =3D openat_file(dirfd, filename, + O_RDONLY | O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd =3D=3D -1) { + return -1; + } + ret =3D fgetxattr(fd, name, value, size, 0, 0); + close_preserve_errno(fd); + return ret; +} + +ssize_t flistxattrat_nofollow(int dirfd, const char *filename, + char *list, size_t size) +{ + int ret; + int fd =3D openat_file(dirfd, filename, + O_RDONLY | O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd =3D=3D -1) { + return -1; + } + ret =3D flistxattr(fd, list, size, 0); + close_preserve_errno(fd); + return ret; +} + +ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, + const char *name) +{ + int ret; + int fd =3D openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0= ); + if (fd =3D=3D -1) { + return -1; + } + ret =3D fremovexattr(fd, name, 0); + close_preserve_errno(fd); + return ret; +} + +int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, + void *value, size_t size, int flags) +{ + int ret; + int fd =3D openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0= ); + if (fd =3D=3D -1) { + return -1; + } + ret =3D fsetxattr(fd, name, value, size, 0, flags); + close_preserve_errno(fd); + return ret; +} diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 1b28e70040..12443b6ad5 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -14,6 +14,7 @@ fs_ss.add(files( 'coxattr.c', )) fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c')) +fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-util-darwin.c')) fs_ss.add(when: 'CONFIG_XEN', if_true: files('xen-9p-backend.c')) softmmu_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss) =20 --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646655633; cv=none; d=zohomail.com; s=zohoarc; b=OVlmqP7UaekBOaXQo/I4cviIKqJpuEHUK52ZSQel+NP4RNAeQElQBqA0e/2uekAisnGQ3nAa1/0UmLRqBGo4s6ExY0U/fgzZ9rFBPneZJ5Et2AL6ZtCqMx8UPQGcOuRroi1I8YNTGl1+b9q2HMf0K0W2ymkp5rDmgJDtf66OJaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646655633; 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; bh=yCG8mfUuZb4ASX+9n9SbWhBnUD8nd9nbfeLYRBwUpm4=; b=WfDlG8xKsOEzd+IKNRBzqiZB+cuFoxaMJRr7F/TosyFWB+5woEpGbzcV45ZJsBPT7gtULSSig798dKGWAF3CI5vPki6fsOrIyu7F3JX1gQMS5WOdHF3go26XcnqETGyWnAb62wOMbA+Tp8ikLTmq3L6pVUG+d86aHnK2ZinQ9DE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646655633972132.6502377463429; Mon, 7 Mar 2022 04:20:33 -0800 (PST) Received: from localhost ([::1]:59688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCLo-0001V6-V1 for importer@patchew.org; Mon, 07 Mar 2022 07:20:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBtB-0005bL-J7 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:50:57 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:56571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRBt6-00039N-Gm for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:50:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=yCG8mfUuZb4ASX+9n9SbWhBnUD8nd9nbfeLYRBwUpm4=; b=Tvc// xwWBQf9iC5eXcTYiTyIlWVXpuE8POh9ruRgj5RNMNkq5GFvD+oSartctghNvzXnyCILhRG+YZ7UKa LjbFMr+IKaHo6ZVxDMBqpwEd93ZxUZYhq1l5q5wwEWWjLl+uqE6TXctK9ZYvXtNtqFBJRt7qPuAor ujDeBLeTRg/qh23MFzx3QjSVsf7muy+Dd6+4Dlgcdg0w2h0wYcDYfTaT/22zivHmAXktmwNcbC4jm U3MEAaFajLtORlN3nJhiEQaW/r5qT+mRnVE8J5GeJqqOskv2Rqg+/Lu/xebsJdxe7XolDxEjLofnm 5um57UJwtNJEdVn+7VHCWnRdai1DA==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 08/19] 9p: darwin: Compatibility for f/l*xattr To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=b5989326f558faedd2511f29459112cced2ca8f5@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646655634245100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer On darwin `fgetxattr` takes two extra optional arguments, and the l* variants are not defined (in favor of an extra flag to the regular variants. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-9-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Acked-by: Christian Schoenebeck --- hw/9pfs/9p-local.c | 12 ++++++++---- hw/9pfs/9p-util.h | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index f3272f0b43..a0d08e5216 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -790,16 +790,20 @@ static int local_fstat(FsContext *fs_ctx, int fid_typ= e, mode_t tmp_mode; dev_t tmp_dev; =20 - if (fgetxattr(fd, "user.virtfs.uid", &tmp_uid, sizeof(uid_t)) > 0)= { + if (qemu_fgetxattr(fd, "user.virtfs.uid", + &tmp_uid, sizeof(uid_t)) > 0) { stbuf->st_uid =3D le32_to_cpu(tmp_uid); } - if (fgetxattr(fd, "user.virtfs.gid", &tmp_gid, sizeof(gid_t)) > 0)= { + if (qemu_fgetxattr(fd, "user.virtfs.gid", + &tmp_gid, sizeof(gid_t)) > 0) { stbuf->st_gid =3D le32_to_cpu(tmp_gid); } - if (fgetxattr(fd, "user.virtfs.mode", &tmp_mode, sizeof(mode_t)) >= 0) { + if (qemu_fgetxattr(fd, "user.virtfs.mode", + &tmp_mode, sizeof(mode_t)) > 0) { stbuf->st_mode =3D le32_to_cpu(tmp_mode); } - if (fgetxattr(fd, "user.virtfs.rdev", &tmp_dev, sizeof(dev_t)) > 0= ) { + if (qemu_fgetxattr(fd, "user.virtfs.rdev", + &tmp_dev, sizeof(dev_t)) > 0) { stbuf->st_rdev =3D le64_to_cpu(tmp_dev); } } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index a48da32f04..be8dc1a43a 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -19,6 +19,23 @@ #define O_PATH_9P_UTIL 0 #endif =20 +#ifdef CONFIG_DARWIN +#define qemu_fgetxattr(...) fgetxattr(__VA_ARGS__, 0, 0) +#define qemu_lgetxattr(...) getxattr(__VA_ARGS__, 0, XATTR_NOFOLLOW) +#define qemu_llistxattr(...) listxattr(__VA_ARGS__, XATTR_NOFOLLOW) +#define qemu_lremovexattr(...) removexattr(__VA_ARGS__, XATTR_NOFOLLOW) +static inline int qemu_lsetxattr(const char *path, const char *name, + const void *value, size_t size, int flags= ) { + return setxattr(path, name, value, size, 0, flags | XATTR_NOFOLLOW); +} +#else +#define qemu_fgetxattr fgetxattr +#define qemu_lgetxattr lgetxattr +#define qemu_llistxattr llistxattr +#define qemu_lremovexattr lremovexattr +#define qemu_lsetxattr lsetxattr +#endif + static inline void close_preserve_errno(int fd) { int serrno =3D errno; --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646655766; cv=none; d=zohomail.com; s=zohoarc; b=bk1QM+8K/rHKHzuuyDEoTSqO6Vt/RKHU2kubYj4MomDc4yP3xxtjxeZjd1eS3e68RTKF07Tw+YtIKNv/K9GdBFb0VEPVcvq/NHT1IsJix8nI+v5N2Btw9OQIDykCo8MSRP2ou+ewPDFS0f1AkftxNWAG1C7FNoypYA0ux0qsCW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646655766; 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; bh=MSuNWzMRc8KYD7UTwnKgKBQ7UJltx57Fx3duo5Tg36A=; b=Nu429ilXKLw1C3HEAkW8A74eQDkyIFK7VFkq9xp3G4sdXy9RraZBpFjGJguYo1A6ZEiEdPpAs40fugMTA+iMEI3uEudjWG20JC43RkMuVzskIhJbozmShr3K1Uykke6jCl+xjCjHC4DRMoUQYNSeTIz9unim1s+qLeOaN+bGnew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646655766709586.6048576321194; Mon, 7 Mar 2022 04:22:46 -0800 (PST) Received: from localhost ([::1]:35124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCNx-00045x-9M for importer@patchew.org; Mon, 07 Mar 2022 07:22:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <029ed1bd9defa33a80bb40cdcd003699299af8db@lizzy.crudebyte.com>) id 1nRCHg-0002jm-Kr for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:16:16 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:34619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <029ed1bd9defa33a80bb40cdcd003699299af8db@lizzy.crudebyte.com>) id 1nRCHe-0007a4-M1 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:16:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=MSuNWzMRc8KYD7UTwnKgKBQ7UJltx57Fx3duo5Tg36A=; b=Kj7oB 1tRxT9Zo6AAF4fYBINqvDSn26D1XbsrMGDDBLUQvsAMkvQiEoTp4W+QQ4FOKRaN3jQFUfJN38mII3 jubsI+LEw6ppdK7DpXE08PRnzdlbpXH+L6e1Kkkt4L1vcscWw2IVm4gxJT97kgTHcMV0VD0ydWSIM uGNyn2xDvZlNnaXHnOUaN1Ub9QqT6watpdqff0BSVlas07iN7Hucn5PewTl6DgLK2xf/SOeKCBgMk KKCYWXW8iqPiXUS4etEkd8YeEvzoH1RELt9Cs05x0hz/1jydxY14rRWneEDye4HRa19gz8AGh5KUV MO+lg/6sXGmlLVUH0DxNagd9OMjRg==; Message-Id: <029ed1bd9defa33a80bb40cdcd003699299af8db.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 09/19] 9p: darwin: Implement compatibility for mknodat To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=029ed1bd9defa33a80bb40cdcd003699299af8db@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646655767504100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Darwin does not support mknodat. However, to avoid race conditions with later setting the permissions, we must avoid using mknod on the full path instead. We could try to fchdir, but that would cause problems if multiple threads try to call mknodat at the same time. However, luckily there is a solution: Darwin includes a function that sets the cwd for the current thread only. This should suffice to use mknod safely. This function (pthread_fchdir_np) is protected by a check in meson in a patch later in this series. Signed-off-by: Keno Fischer Signed-off-by: Michael Roitzsch [Will Cohen: - Adjust coding style - Replace clang references with gcc - Note radar filed with Apple for missing syscall - Replace direct syscall with pthread_fchdir_np and adjust patch notes accordingly - Declare pthread_fchdir_np with - __attribute__((weak_import)) to allow checking for its presence before usage - Move declarations above cplusplus guard - Add CONFIG_PTHREAD_FCHDIR_NP to meson and check for presence in 9p-util - Rebase to apply cleanly on top of the 2022-02-10 changes to 9pfs - Fix line over 90 characters formatting error] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-10-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p-local.c | 4 ++-- hw/9pfs/9p-util-darwin.c | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p-util-linux.c | 6 ++++++ hw/9pfs/9p-util.h | 11 +++++++++++ meson.build | 1 + 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index a0d08e5216..d42ce6d8b8 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -682,7 +682,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir= _path, =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { - err =3D mknodat(dirfd, name, fs_ctx->fmode | S_IFREG, 0); + err =3D qemu_mknodat(dirfd, name, fs_ctx->fmode | S_IFREG, 0); if (err =3D=3D -1) { goto out; } @@ -697,7 +697,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir= _path, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { - err =3D mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); + err =3D qemu_mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); if (err =3D=3D -1) { goto out; } diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c index cdb4c9e24c..bec0253474 100644 --- a/hw/9pfs/9p-util-darwin.c +++ b/hw/9pfs/9p-util-darwin.c @@ -7,6 +7,8 @@ =20 #include "qemu/osdep.h" #include "qemu/xattr.h" +#include "qapi/error.h" +#include "qemu/error-report.h" #include "9p-util.h" =20 ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *= name, @@ -62,3 +64,34 @@ int fsetxattrat_nofollow(int dirfd, const char *filename= , const char *name, close_preserve_errno(fd); return ret; } + +/* + * As long as mknodat is not available on macOS, this workaround + * using pthread_fchdir_np is needed. + * + * Radar filed with Apple for implementing mknodat: + * rdar://FB9862426 (https://openradar.appspot.com/FB9862426) + */ +#if defined CONFIG_PTHREAD_FCHDIR_NP + +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +{ + int preserved_errno, err; + if (!pthread_fchdir_np) { + error_report_once("pthread_fchdir_np() not available on this versi= on of macOS"); + return -ENOTSUP; + } + if (pthread_fchdir_np(dirfd) < 0) { + return -1; + } + err =3D mknod(filename, mode, dev); + preserved_errno =3D errno; + /* Stop using the thread-local cwd */ + pthread_fchdir_np(-1); + if (err < 0) { + errno =3D preserved_errno; + } + return err; +} + +#endif diff --git a/hw/9pfs/9p-util-linux.c b/hw/9pfs/9p-util-linux.c index 398614a5d0..db451b0784 100644 --- a/hw/9pfs/9p-util-linux.c +++ b/hw/9pfs/9p-util-linux.c @@ -61,4 +61,10 @@ int fsetxattrat_nofollow(int dirfd, const char *filename= , const char *name, ret =3D lsetxattr(proc_path, name, value, size, flags); g_free(proc_path); return ret; + +} + +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +{ + return mknodat(dirfd, filename, mode, dev); } diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index be8dc1a43a..73b08c5561 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -114,5 +114,16 @@ static inline off_t qemu_dirent_off(struct dirent *den= t) #endif } =20 +/* + * As long as mknodat is not available on macOS, this workaround + * using pthread_fchdir_np is needed. qemu_mknodat is defined in + * os-posix.c. pthread_fchdir_np is weakly linked here as a guard + * in case it disappears in future macOS versions, because it is + * is a private API. + */ +#if defined CONFIG_DARWIN && defined CONFIG_PTHREAD_FCHDIR_NP +int pthread_fchdir_np(int fd) __attribute__((weak_import)); +#endif +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev); =20 #endif diff --git a/meson.build b/meson.build index 038502714a..40598630e6 100644 --- a/meson.build +++ b/meson.build @@ -1622,6 +1622,7 @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has= _function('posix_fallocate' config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memal= ign')) config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) +config_host_data.set('CONFIG_PTHREAD_FCHDIR_NP', cc.has_function('pthread_= fchdir_np')) config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwai= t', dependencies: threads)) config_host_data.set('CONFIG_SENDFILE', cc.has_function('sendfile')) config_host_data.set('CONFIG_SETNS', cc.has_function('setns') and cc.has_f= unction('unshare')) --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646658260; cv=none; d=zohomail.com; s=zohoarc; b=PoyS+v65qwmszAizNiHUCKnNyw3VER6AAblDnwIpzGFQzHFaeIvdpOP3QToSDLjAZ+Y552Hmrcd2dYbzKK9EGR+fQFN5ToZXCEwOI5wePQat2vkt2yL3/bvJ/yoCQmBCHj/bE+LjhfTDreVOMUnGG4a/Q9yMeArwePSB62h1c78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646658260; 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; bh=yKS8v7D5O2e+Blqy1u72eKRpQqfklC5OzihiNL/eqwU=; b=NtOyZA/GBhdcCgQpEN3zECw+PfSvF3SqxTEgQfTMz92wzd7kQwE1CR2AUf1EDJR49HJCJEIdfALP19QK+mJ4C1CB5gy/TTVU5BYIeryvlL+g9HSKnYhf8NVMXJ7N866HNTZLTwV54cz/ELblVlmw6UMNLSiLGbUIcGJM9DXrW7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646658260487787.6062460607109; Mon, 7 Mar 2022 05:04:20 -0800 (PST) Received: from localhost ([::1]:49416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRD2C-0002U0-76 for importer@patchew.org; Mon, 07 Mar 2022 08:04:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRCGe-000174-29 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:15:12 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:34619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRCGc-0007a4-5E for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:15:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=yKS8v7D5O2e+Blqy1u72eKRpQqfklC5OzihiNL/eqwU=; b=K0Tf2 xJWKJ63wYH0w8sAad6vlqIP7L8OzX7nmkL6VmH4oA0zYA+YdexvNo2VQLDoXiTyLUKko4LqxfZUwa N12RiMpSJ1OpfCJ26uiNha1/+jMG3FT8nl/Kg83AfPvfboX5ghkauOlD3GWTwz2qplL+5Jbq5Kipu YuAxW333uzm5UFpYlglN8WpPXMBtie5/UNXGLyadk5j31XW9Tj+GO1870GhgfjeDyN5HcNKA2YjfH d5a3aQqHNdVQknU0eO2ERvA4CSqgTXoyhS1/K4rI/GrwZ8nW23yK9uxBKM/EwnLH3f5MZHv9LPe42 voMf/erklSLj990B2F6F55V5cFvhA==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 10/19] 9p: darwin: Adjust assumption on virtio-9p-test To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=d3671fd972cd185a6923433aa4802f54d8b62112@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646658292240100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Will Cohen The previous test depended on the assumption that P9_DOTL_AT_REMOVEDIR and AT_REMOVEDIR have the same value. While this is true on Linux, it is not true everywhere, and leads to an incorrect test failure on unlink_at, noticed when adding 9p to darwin: Received response 7 (RLERROR) instead of 77 (RUNLINKAT) Rlerror has errno 22 (Invalid argument) ** ERROR:../tests/qtest/virtio-9p-test.c:305:v9fs_req_recv: assertion failed (hdr.id =3D=3D id): (7 =3D=3D 77) Bail out! ERROR:../tests/qtest/virtio-9p-test.c:305:v9fs_req_recv: assertion failed (hdr.id =3D=3D id): (7 =3D=3D 77) Signed-off-by: Fabian Franz [Will Cohen: - Add explanation of patch and description of pre-patch test failure] Signed-off-by: Will Cohen Acked-by: Thomas Huth [Will Cohen: - Move this patch before 9p: darwin: meson patch to avoid qtest breakage during bisecting] Signed-off-by: Will Cohen Reviewed-by: Greg Kurz Message-Id: <20220227223522.91937-11-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 502e5ad0c7..01ca076afe 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -1253,7 +1253,7 @@ static void fs_unlinkat_dir(void *obj, void *data, QG= uestAllocator *t_alloc) /* ... and is actually a directory */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); =20 - do_unlinkat(v9p, "/", "02", AT_REMOVEDIR); + do_unlinkat(v9p, "/", "02", P9_DOTL_AT_REMOVEDIR); /* directory should be gone now */ g_assert(stat(new_dir, &st) !=3D 0); } --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646656164; cv=none; d=zohomail.com; s=zohoarc; b=KKQVTWbohFx/yT4C9/A01aKTBnBfTTAG94yx6cw7EJLO/jr0ou5+54EZUzDrTA24VcTOmvFsisw3pzJfX3z5lhuOTiJxxtBJFHaFS1+00BenTMPyJXIu18b13ESe7vekoFC5PHgu9Rxmws/Vgl3m/zC6xy0SxmNVRaLbSSknwek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646656164; 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; bh=InoFH/i7Y64UnxSHU/aQSNBQnxBKbIBG0d1DlNHVBsc=; b=H6D/KS+LXfjpDR0mxmeQgzA/V9r0u3UGB0vy48OzjgTDyCMErNPU17GgjPSziWXGzjWOtowGq9vIz54wBTSZ6DGwq4ob3zei+mVExsQKBYBGKW5f7QpmyS9MmCmY/c3Ui3b9h8LJwcdOR41COePUzOyYlCYfBaYng36SOpCKzfk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646656164211245.6122499891818; Mon, 7 Mar 2022 04:29:24 -0800 (PST) Received: from localhost ([::1]:59048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCUN-0003J8-8f for importer@patchew.org; Mon, 07 Mar 2022 07:29:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0fb1e19d78536e23b650ca72decdc29c98f2dcc1@lizzy.crudebyte.com>) id 1nRCFb-0008S2-AH for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:14:07 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:34619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0fb1e19d78536e23b650ca72decdc29c98f2dcc1@lizzy.crudebyte.com>) id 1nRCFZ-0007a4-Gv for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:14:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=InoFH/i7Y64UnxSHU/aQSNBQnxBKbIBG0d1DlNHVBsc=; b=Wve5b wwKIrY5pk3BXCdgohdKVOVZwixvN8E9S0Y5Dxk3rwfROYzoSxVDE1r/Nt3OMZvw5o34UoAVT37iRg kMM0AWmfylmsqydNPKoh8wJZU5P8tyLGkV//X96mDrD8K0obo6Wa1kLdzUDje3pK5C7Vs0TQJn/BC g39pddvu6pJ+Q48rO2NxgkTo34UxzQNgmS8rSF7vxQNC1ffvRmY0phbGK7kNFVPqfmU3JIIQsODY5 yssB/MDD0u4eRxcSh5sJW5FLtjmNM0dZxjoYzpB3/aH3ULXfphNVkMJgM5KJJhg1CtWfX8QzjSebM Cay/qwu6Kmd4gAeP7hh6/ZMOvEy2g==; Message-Id: <0fb1e19d78536e23b650ca72decdc29c98f2dcc1.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 11/19] 9p: darwin: meson: Allow VirtFS on Darwin To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=0fb1e19d78536e23b650ca72decdc29c98f2dcc1@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646656166306100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer To allow VirtFS on darwin, we need to check that pthread_fchdir_np is available, which has only been available since macOS 10.12. Additionally, virtfs_proxy_helper is disabled on Darwin. This patch series does not currently provide an implementation of the proxy-helper, but this functionality could be implemented later on. Signed-off-by: Keno Fischer [Michael Roitzsch: - Rebase for NixOS] Signed-off-by: Michael Roitzsch [Will Cohen: - Rebase to master] Signed-off-by: Will Cohen Reviewed-by: Paolo Bonzini [Will Cohen: - Add check for pthread_fchdir_np to virtfs - Add comments to patch commit - Note that virtfs_proxy_helper does not work on macOS - Fully adjust meson virtfs error note to specify macOS - Rebase to master] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-12-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Acked-by: Christian Schoenebeck --- fsdev/meson.build | 1 + meson.build | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fsdev/meson.build b/fsdev/meson.build index adf57cc43e..b632b66348 100644 --- a/fsdev/meson.build +++ b/fsdev/meson.build @@ -7,6 +7,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( 'qemu-fsdev.c', ), if_false: files('qemu-fsdev-dummy.c')) softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) +softmmu_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss) =20 if have_virtfs_proxy_helper executable('virtfs-proxy-helper', diff --git a/meson.build b/meson.build index 40598630e6..8a50ec191f 100644 --- a/meson.build +++ b/meson.build @@ -1462,14 +1462,16 @@ dbus_display =3D get_option('dbus_display') \ .allowed() =20 have_virtfs =3D get_option('virtfs') \ - .require(targetos =3D=3D 'linux', - error_message: 'virtio-9p (virtfs) requires Linux') \ - .require(libattr.found() and libcap_ng.found(), - error_message: 'virtio-9p (virtfs) requires libcap-ng-devel a= nd libattr-devel') \ + .require(targetos =3D=3D 'linux' or targetos =3D=3D 'darwin', + error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ + .require(targetos =3D=3D 'linux' or cc.has_function('pthread_fchdir_np= '), + error_message: 'virtio-9p (virtfs) on macOS requires the pres= ence of pthread_fchdir_np') \ + .require(targetos =3D=3D 'darwin' or (libattr.found() and libcap_ng.fo= und()), + error_message: 'virtio-9p (virtfs) on Linux requires libcap-n= g-devel and libattr-devel') \ .disable_auto_if(not have_tools and not have_system) \ .allowed() =20 -have_virtfs_proxy_helper =3D have_virtfs and have_tools +have_virtfs_proxy_helper =3D targetos !=3D 'darwin' and have_virtfs and ha= ve_tools =20 foreach k : get_option('trace_backends') config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true) --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646658513; cv=none; d=zohomail.com; s=zohoarc; b=lpXo554PEmV7VNmaW7IgE858W5ufMi2Cr79eJMm7qjkW1uKlx4+3rIHOPgRdRxv7htHHEwLEoYqGnG77eXMBk+Ul/0v0N9UGNJel1OGo1Aa+9Ui26hUpYKlqAGLsAPEv6I4dEufyn8JrpfeqBHuaK8ZFp5yKqBWzqjcGBFtZoYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646658513; 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; bh=m3rxyJIWUSZsunwAVPLXFSOKT6ApHv/hF1xLM+mgQMU=; b=REIpR4BfNVVOJYbno8p1Lvv/D8UoLiXd7lIzUI/oXxu90eXzWpmHYL3jkECvzBi3EvCEnGbxYp53MYMg39fWKThSr1u1LkpywvL4e/KGILbJ4brDurXuOed9b4ORZpHVnFtsdM8zG5IjrKzC5S10WOlyi0fNkFWqihgNos7r01E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646658513843848.280180519876; Mon, 7 Mar 2022 05:08:33 -0800 (PST) Received: from localhost ([::1]:54208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRD6G-00067B-F8 for importer@patchew.org; Mon, 07 Mar 2022 08:08:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <1983d8b0d6b013f025905c7d37e3f0261edc328b@lizzy.crudebyte.com>) id 1nRCgq-0000rI-GI for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:42:19 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:47275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <1983d8b0d6b013f025905c7d37e3f0261edc328b@lizzy.crudebyte.com>) id 1nRCga-0004DK-BP for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:42:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=m3rxyJIWUSZsunwAVPLXFSOKT6ApHv/hF1xLM+mgQMU=; b=c+zU1 RBYqDRDhiX5cB1m/b7e+ZvHAjkJuEGGiNKHaz13PceIVMzCIdzU+WzuH0XxtMpi1bKu+tQTPXdyID 408fMeSL7BJidM2eCHfhDUoMXarAkDNT/ugQqHjqDEmd5T7JxAhRrRpVxjssiIodWOYxAQWOqF+uV 5ntn8UfEJIXHuk/Ti0hH3fntdPKMYQiZe3PHI8C9iJOnvA1WScTOx0i8dP11y1XjTO7r4aPJ87xPY KQ3EfCx8SURqtviHbGD8jkPg+lC3GhdTqOntu1GqQcr5LS7AgQKT/esgTvh0C27C+a2xuixZqxcL/ JBUO20ngqRGhC8hUgLHW4NMT2DsWg==; Message-Id: <1983d8b0d6b013f025905c7d37e3f0261edc328b.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 12/19] 9pfs: move qemu_dirent_dup() from osdep -> 9p-util To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=1983d8b0d6b013f025905c7d37e3f0261edc328b@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646658515124100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Function qemu_dirent_dup() is currently only used by 9pfs server, so move it from project global header osdep.h to 9pfs specific header 9p-util.h. Link: https://lore.kernel.org/qemu-devel/CAFEAcA_=3DHAUNomKD2wurSVaAHa5mrk2= 2A1oHKLWUDjk7v6Khmg@mail.gmail.com/ Based-on: <20220227223522.91937-12-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Peter Maydell Message-Id: --- hw/9pfs/9p-util.h | 30 ++++++++++++++++++++++++++++++ include/qemu/osdep.h | 13 ------------- util/osdep.c | 21 --------------------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 73b08c5561..408d71c8f7 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -114,6 +114,36 @@ static inline off_t qemu_dirent_off(struct dirent *den= t) #endif } =20 +/** + * Duplicate directory entry @dent. + * + * It is highly recommended to use this function instead of open coding + * duplication of @c dirent objects, because the actual @c struct @c dirent + * size may be bigger or shorter than @c sizeof(struct dirent) and correct + * handling is platform specific (see gitlab issue #841). + * + * @dent - original directory entry to be duplicated + * @returns duplicated directory entry which should be freed with g_free() + */ +static inline struct dirent *qemu_dirent_dup(struct dirent *dent) +{ + size_t sz =3D 0; +#if defined _DIRENT_HAVE_D_RECLEN + /* Avoid use of strlen() if platform supports d_reclen. */ + sz =3D dent->d_reclen; +#endif + /* + * Test sz for zero even if d_reclen is available + * because some drivers may set d_reclen to zero. + */ + if (sz =3D=3D 0) { + /* Fallback to the most portable way. */ + sz =3D offsetof(struct dirent, d_name) + + strlen(dent->d_name) + 1; + } + return g_memdup(dent, sz); +} + /* * As long as mknodat is not available on macOS, this workaround * using pthread_fchdir_np is needed. qemu_mknodat is defined in diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 7bcce3bceb..650ba1aa50 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -673,19 +673,6 @@ static inline int platform_does_not_support_system(con= st char *command) } #endif /* !HAVE_SYSTEM_FUNCTION */ =20 -/** - * Duplicate directory entry @dent. - * - * It is highly recommended to use this function instead of open coding - * duplication of @c dirent objects, because the actual @c struct @c dirent - * size may be bigger or shorter than @c sizeof(struct dirent) and correct - * handling is platform specific (see gitlab issue #841). - * - * @dent - original directory entry to be duplicated - * @returns duplicated directory entry which should be freed with g_free() - */ -struct dirent *qemu_dirent_dup(struct dirent *dent); - #ifdef __cplusplus } #endif diff --git a/util/osdep.c b/util/osdep.c index 723cdcb004..7c4deda6fe 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -33,7 +33,6 @@ extern int madvise(char *, size_t, int); #endif =20 -#include #include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/sockets.h" @@ -619,23 +618,3 @@ writev(int fd, const struct iovec *iov, int iov_cnt) return readv_writev(fd, iov, iov_cnt, true); } #endif - -struct dirent * -qemu_dirent_dup(struct dirent *dent) -{ - size_t sz =3D 0; -#if defined _DIRENT_HAVE_D_RECLEN - /* Avoid use of strlen() if platform supports d_reclen. */ - sz =3D dent->d_reclen; -#endif - /* - * Test sz for zero even if d_reclen is available - * because some drivers may set d_reclen to zero. - */ - if (sz =3D=3D 0) { - /* Fallback to the most portable way. */ - sz =3D offsetof(struct dirent, d_name) + - strlen(dent->d_name) + 1; - } - return g_memdup(dent, sz); -} --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646657976; cv=none; d=zohomail.com; s=zohoarc; b=i0YxgSZmZaXLYIp/bxdZHKvH38TW/H/DZr178tn+uQShlfgg7bxXzRjhGZQDHLFep6+35Vo+TsOusTtm5gzUbifLA+HxdG14mS5LPZkFqdg5RZygFtXYrS1I0fcR3+OazvgjYlRzZNn9exDwL8LKRhzxSHq5HvpGXXgZTqUgU1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646657976; 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; bh=DrohWPsFuDZVi2PkDVvJ6WDmj/4RKl9cI6t4GNGbvL8=; b=JNg8xQJpPcEk1iaaeF7ucJ3ja25ZUwEAscexXUi68ucoQcZWvd/a5blnzISelVLy8Ua6AcJt9tvXAH8wadprpYRWTQBOHVJFbwvATwSgaN7h4RyAsVkmn59l+eEtSyCflpwdcYu2tX/U3DEye3XB0OTQ7x4/h/obK5G8vNnPtJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646657976190838.5893015305472; Mon, 7 Mar 2022 04:59:36 -0800 (PST) Received: from localhost ([::1]:44368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCxb-0007I4-NR for importer@patchew.org; Mon, 07 Mar 2022 07:59:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <63ce31c35da18f9dbd9b7dbea5b6e1d2b85deb24@lizzy.crudebyte.com>) id 1nRCDU-0004Ou-D2 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:11:56 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:33469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <63ce31c35da18f9dbd9b7dbea5b6e1d2b85deb24@lizzy.crudebyte.com>) id 1nRCDR-0006fX-MW for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:11:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=DrohWPsFuDZVi2PkDVvJ6WDmj/4RKl9cI6t4GNGbvL8=; b=GfmZ7 Q9smAVLH7lQoGuzliztzOLGCd2CEeXbq8ALp9OBnyUXLm8oSAUKDGJZ18zc9lfnKhTbFImroybvov Y1l1FygFU8p/iJsdJE7Qsr0jY96A5pQLk6rsw57yxVXCUhCAAfRFs/cFkr3gSNkx42GzlMfeicVCP 0CiJi2PtHeQNNcuGrBRZV0eCIfyL+J5FjqFCPMeehkCluC1Dkgn3oJbGbtNCqPZ6VZqPYrvMFv2Aq +96CXuaIG1NaVFE4ytWyyOai3LEH0fxCe8lgRCuz3kv+qf7t702n9LtnbGJXHc1N1STJ5/Mjmlr+n SB9Zyi0MkaVbcMYWXYL6fhpO1NlQg==; Message-Id: <63ce31c35da18f9dbd9b7dbea5b6e1d2b85deb24.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 13/19] 9pfs: drop Doxygen format from qemu_dirent_dup() API comment To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=63ce31c35da18f9dbd9b7dbea5b6e1d2b85deb24@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646657977813100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so drop occurrences of "@c" which is Doxygen format for fixed-width text. Link: https://lore.kernel.org/qemu-devel/CAFEAcA89+ENOM6x19OEF53Kd2DWkhN5SN= 21Va0D7yepJSa3Jyg@mail.gmail.com/ Based-on: Signed-off-by: Christian Schoenebeck Reviewed-by: Peter Maydell Reviewed-by: Greg Kurz Message-Id: --- hw/9pfs/9p-util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 408d71c8f7..d0de6be3e2 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -118,8 +118,8 @@ static inline off_t qemu_dirent_off(struct dirent *dent) * Duplicate directory entry @dent. * * It is highly recommended to use this function instead of open coding - * duplication of @c dirent objects, because the actual @c struct @c dirent - * size may be bigger or shorter than @c sizeof(struct dirent) and correct + * duplication of dirent objects, because the actual struct dirent + * size may be bigger or shorter than sizeof(struct dirent) and correct * handling is platform specific (see gitlab issue #841). * * @dent - original directory entry to be duplicated --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646657540; cv=none; d=zohomail.com; s=zohoarc; b=QHVew/gFDIJe8ZXazs0D0Q6qEUv43ujx3VytUbejb1vJXm1ZVHkxrZLV3YxAtw6MtgNyyt37eWEdGq6sMBJBzCGpICms40JUDG6dE0+3aCf4RqhoONYG5qWD8vD0OiyteOAVlA8owX+qMbfchEUItSUgdVbLaGd3Bw2C2ggo6lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646657540; 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; bh=xcMKupBZTTL5NgBB0GSoIFyvqJ9eeQK3NYRIyylRKDs=; b=W++4z7qN5orwJqe3J3dnel8dB9utQezn0COMIUR8Y6LK/0EAMMnv7SDYLnVLSFrB0KOHWLIGyHnXTRwoReWxXmcBEKztbnIRDJjbjhUtS6rTYdixZ6D+sreurqCnXFI+ghQUwXtRTZoWMvJ/Klse7i+lSur23eEcue9413ZW+R8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646657540236346.15199611736466; Mon, 7 Mar 2022 04:52:20 -0800 (PST) Received: from localhost ([::1]:56256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCqY-0004ga-Og for importer@patchew.org; Mon, 07 Mar 2022 07:52:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <39db33471909f8ab083e1a079eeae6975b55df13@lizzy.crudebyte.com>) id 1nRCfW-0000My-03 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:41:01 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:52063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <39db33471909f8ab083e1a079eeae6975b55df13@lizzy.crudebyte.com>) id 1nRCfS-0003mu-Eg for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:40:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=xcMKupBZTTL5NgBB0GSoIFyvqJ9eeQK3NYRIyylRKDs=; b=bkqFt 4jZ1Sxoqa3Tl/lUFFEBDfv1xgUC82CV/KBS4rx2BOg2iY7hTA9P5l1eg0xlvq+9Axnmjh7FEfT7LA NUC9PWmCsL8ogLS8W67ZiN5AbJE9sCBaf2SbAJxUv1njX6iiA5m0UgchVlv4jwthSlCj/+7zrv7AU bB3n+0qGQ87MQxMofw5F4yjF0AaUXRwncB0DI67Ftfsl4VWrl/Suvyh+PXC4t2PdVzCKgZw6kQFYI KycwsWJd6wshhBWHk9Jxu9FHf7p4vtkhArPDJa0GxVif9gQBgRD8enoJecIYyazLNYQvbfF5NjKgc vm6gHHpV1ZDwxpDvB1lTa9seuRouQ==; Message-Id: <39db33471909f8ab083e1a079eeae6975b55df13.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 14/19] 9pfs/9p.h: convert Doxygen -> kerneldoc format To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=39db33471909f8ab083e1a079eeae6975b55df13@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646657543144100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Based-on: Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <2b8f91de7bac3d3bc85d60eb08830a35a394be75.1646314856.git.qemu_o= ss@crudebyte.com> --- hw/9pfs/9p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 94b273b3d0..af2635fae9 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -100,8 +100,8 @@ typedef enum P9ProtoVersion { V9FS_PROTO_2000L =3D 0x02, } P9ProtoVersion; =20 -/** - * @brief Minimum message size supported by this 9pfs server. +/* + * Minimum message size supported by this 9pfs server. * * A client establishes a session by sending a Tversion request along with= a * 'msize' parameter which suggests the server a maximum message size ever= to be @@ -231,7 +231,7 @@ static inline void v9fs_readdir_init(P9ProtoVersion pro= to_version, V9fsDir *dir) } } =20 -/** +/* * Type for 9p fs drivers' (a.k.a. 9p backends) result of readdir requests, * which is a chained list of directory entries. */ @@ -289,8 +289,8 @@ typedef enum AffixType_t { AffixType_Suffix, /* A.k.a. postfix. */ } AffixType_t; =20 -/** - * @brief Unique affix of variable length. +/* + * Unique affix of variable length. * * An affix is (currently) either a suffix or a prefix, which is either * going to be prepended (prefix) or appended (suffix) with some other @@ -304,7 +304,7 @@ typedef struct VariLenAffix { AffixType_t type; /* Whether this affix is a suffix or a prefix. */ uint64_t value; /* Actual numerical value of this affix. */ /* - * Lenght of the affix, that is how many (of the lowest) bits of @c va= lue + * Lenght of the affix, that is how many (of the lowest) bits of ``val= ue`` * must be used for appending/prepending this affix to its final resul= ting, * unique number. */ --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646655336; cv=none; d=zohomail.com; s=zohoarc; b=C5ffhqgO3Yl46rj3k4kXCI7RLRlVDufbUW0/6ELoe6lDlLJbmu1jNCRowS9RWaAJPcPsidLPEMyD/ejQj2uXLufDkWP2lYRzJeKjiVxIIAfwvAMmwdcOyUxO0y5tvjhIzWZC3sjlieTQyKncXDQSiyz8JAwaVz8GRQMlkFK4d70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646655336; 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; bh=Vl2X3WYggHpA/TJOsUhXcKaCskBk2BTJ7HU+dytgZhY=; b=GpvdLNDtNibWkOCqDEgi6joLKe4u0uUnvfDX027ts7cGzrVad5ohpEb7zbRH6yUDuRxRot2GxMEXBUkBrZaW7pspH3uYNK56cqgWSUGl1bg9xhOgZKWD1zhOygjpEC2eeQJFt/MfEsXxvOTacLI9Exs9/vxqMvs5o3Hxo4bEZi8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646655336821173.83540495770853; Mon, 7 Mar 2022 04:15:36 -0800 (PST) Received: from localhost ([::1]:46120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCH2-0000nd-F0 for importer@patchew.org; Mon, 07 Mar 2022 07:15:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <1a7f2400148fd273536daa0adba5ecdea35c4bfb@lizzy.crudebyte.com>) id 1nRCEY-0006Tp-TA for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:13:02 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:34619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <1a7f2400148fd273536daa0adba5ecdea35c4bfb@lizzy.crudebyte.com>) id 1nRCEX-0007a4-2Q for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:13:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=Vl2X3WYggHpA/TJOsUhXcKaCskBk2BTJ7HU+dytgZhY=; b=Mj3z6 vERWVViegYaegb3q+0raO/CGHp2z/ToGcwZYJ5uxIlOYLc5VmVUC6gGFcvoX0aXOb7TKTOu7K0VZY 6cDkPRVazWoZgfIKeQXM6X6v4KTpJiucxKDDrCkvOrUnoNmf9BpNa4NvpV+KwJYLyxQ0nXwNWPu4z T3Xp0v2si+i8xHdkBbFQZqgNZ5bdfaR4ElHFTFcXHiM7RYLXmajjEe42nPF8LNOFUqjksTD6Nruou 6irlmLheu1hXacKPjzqOdVOtJnfcMlVV5jj0BYEw+j0DQ9Fta/cIk1tb7VvZ3v1DuPEGLPNVyfyg9 JqpWjgkmyLJUTG0YOrpIXYsMiCWNg==; Message-Id: <1a7f2400148fd273536daa0adba5ecdea35c4bfb.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 15/19] 9pfs/codir.c: convert Doxygen -> kerneldoc format To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=1a7f2400148fd273536daa0adba5ecdea35c4bfb@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646655367053100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: --- hw/9pfs/codir.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index f96d8ac4e6..75148bc985 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -184,14 +184,25 @@ out: } =20 /** - * @brief Reads multiple directory entries in one rush. + * v9fs_co_readdir_many() - Reads multiple directory entries in one rush. + * + * @pdu: the causing 9p (T_readdir) client request + * @fidp: already opened directory where readdir shall be performed on + * @entries: output for directory entries (must not be NULL) + * @offset: initial position inside the directory the function shall + * seek to before retrieving the directory entries + * @maxsize: maximum result message body size (in bytes) + * @dostat: whether a stat() should be performed and returned for + * each directory entry + * Return: resulting response message body size (in bytes) on success, + * negative error code otherwise * * Retrieves the requested (max. amount of) directory entries from the fs * driver. This function must only be called by the main IO thread (top ha= lf). * Internally this function call will be dispatched to a background IO thr= ead * (bottom half) where it is eventually executed by the fs driver. * - * @discussion Acquiring multiple directory entries in one rush from the fs + * Acquiring multiple directory entries in one rush from the fs * driver, instead of retrieving each directory entry individually, is very * beneficial from performance point of view. Because for every fs driver * request latency is added, which in practice could lead to overall @@ -199,20 +210,9 @@ out: * directory) if every directory entry was individually requested from fs * driver. * - * @note You must @b ALWAYS call @c v9fs_free_dirents(entries) after calli= ng + * NOTE: You must ALWAYS call v9fs_free_dirents(entries) after calling * v9fs_co_readdir_many(), both on success and on error cases of this - * function, to avoid memory leaks once @p entries are no longer needed. - * - * @param pdu - the causing 9p (T_readdir) client request - * @param fidp - already opened directory where readdir shall be performed= on - * @param entries - output for directory entries (must not be NULL) - * @param offset - initial position inside the directory the function shall - * seek to before retrieving the directory entries - * @param maxsize - maximum result message body size (in bytes) - * @param dostat - whether a stat() should be performed and returned for - * each directory entry - * @returns resulting response message body size (in bytes) on success, - * negative error code otherwise + * function, to avoid memory leaks once @entries are no longer needed. */ int coroutine_fn v9fs_co_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, struct V9fsDirEnt **entries, --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646655435; cv=none; d=zohomail.com; s=zohoarc; b=AYAQwFvODK3yeDFC9/NvLgpXBmQSpkKwB7omCpt8Aq7qusk114BjnPjP4AERby1HaIWAGuZrda4nzxaz87gkxfWkPp06ViqmZ1mYX9NmE+Tb93q6AbcS9TfPlbhQ8CM9EAhDbu6NUJWBfPxzV1WoSUwGVpwZ5vb/ys88lcOacaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646655435; 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; bh=JxwJG9r+Tf4XE67kO24LxoQgtYGtj/d4r4gjFVEHVJ0=; b=KhGGbSfWKLfLYOKyk0i/bb7a2NhwmSyeXO+oYL0wy64NeIGe6BxaHejS8k7jo85/ufo5dEZg+7xug+xdFlvSoCL1gon9mbAF4kCL2D0fkn2DrdrPT2nhbXJ8eS7jDoiKojaEno2dODG0FRgn0YHslnMs/Gox3epAaxbMlzoqB58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646655435663307.391052635656; Mon, 7 Mar 2022 04:17:15 -0800 (PST) Received: from localhost ([::1]:50794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCId-000408-Da for importer@patchew.org; Mon, 07 Mar 2022 07:17:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRCCR-0002r7-2o for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:10:51 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:33469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRCCP-0006fX-3d for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:10:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=JxwJG9r+Tf4XE67kO24LxoQgtYGtj/d4r4gjFVEHVJ0=; b=mWRJf l6SIcvzFc3PSVpQq7BvOnbQzHfp9WiM5uHM7yQkl3NTythf9Pz5GoOAm6tCottM4KHbVyAQ1nj2AU l639PQ235Kd+2OuP+PULQXnL2Y3pibity6QAmqwyJty6lvrlbk4FTd7dt1vjDLUKe2aW2rcAy/HG/ wHxBd0P5pwj3HAlP4bv84weShWnbFbDGezsg7PGjXk8JM7Ov4qkfcEdZ2CPx1Th/rH1ZbHV75teFX 7pk+t/obqiqAWwQqlRtyuKSBoKz4Ky8sbZPQoeRMVv+YaFVeOrvnlgE6s0axAOIvbW4rJ4v6ZbFVA qEPL8XPFEDOziD9wnZNSPHb0PTJhA==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 16/19] 9pfs/9p.c: convert Doxygen -> kerneldoc format To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=e16fea4156b6f0877df45104320164501ca689f6@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646655457714100004 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <4ece6ffa4465c271c6a7c42a3040f42780fcce87.1646314856.git.qemu_o= ss@crudebyte.com> --- hw/9pfs/9p.c | 62 +++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 7405352c37..a6d6b3f835 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -628,8 +628,8 @@ static inline uint64_t mirror64bit(uint64_t value) ((uint64_t)mirror8bit((value >> 56) & 0xff)); } =20 -/** - * @brief Parameter k for the Exponential Golomb algorihm to be used. +/* + * Parameter k for the Exponential Golomb algorihm to be used. * * The smaller this value, the smaller the minimum bit count for the Exp. * Golomb generated affixes will be (at lowest index) however for the @@ -642,28 +642,30 @@ static inline uint64_t mirror64bit(uint64_t value) * should be small, for a large amount of devices k might be increased * instead. The default of k=3D0 should be fine for most users though. * - * @b IMPORTANT: In case this ever becomes a runtime parameter; the value = of + * IMPORTANT: In case this ever becomes a runtime parameter; the value of * k should not change as long as guest is still running! Because that wou= ld * cause completely different inode numbers to be generated on guest. */ #define EXP_GOLOMB_K 0 =20 /** - * @brief Exponential Golomb algorithm for arbitrary k (including k=3D0). + * expGolombEncode() - Exponential Golomb algorithm for arbitrary k + * (including k=3D0). * - * The Exponential Golomb algorithm generates @b prefixes (@b not suffixes= !) + * @n: natural number (or index) of the prefix to be generated + * (1, 2, 3, ...) + * @k: parameter k of Exp. Golomb algorithm to be used + * (see comment on EXP_GOLOMB_K macro for details about k) + * Return: prefix for given @n and @k + * + * The Exponential Golomb algorithm generates prefixes (NOT suffixes!) * with growing length and with the mathematical property of being * "prefix-free". The latter means the generated prefixes can be prepended * in front of arbitrary numbers and the resulting concatenated numbers are * guaranteed to be always unique. * * This is a minor adjustment to the original Exp. Golomb algorithm in the - * sense that lowest allowed index (@param n) starts with 1, not with zero. - * - * @param n - natural number (or index) of the prefix to be generated - * (1, 2, 3, ...) - * @param k - parameter k of Exp. Golomb algorithm to be used - * (see comment on EXP_GOLOMB_K macro for details about k) + * sense that lowest allowed index (@n) starts with 1, not with zero. */ static VariLenAffix expGolombEncode(uint64_t n, int k) { @@ -677,7 +679,9 @@ static VariLenAffix expGolombEncode(uint64_t n, int k) } =20 /** - * @brief Converts a suffix into a prefix, or a prefix into a suffix. + * invertAffix() - Converts a suffix into a prefix, or a prefix into a suf= fix. + * @affix: either suffix or prefix to be inverted + * Return: inversion of passed @affix * * Simply mirror all bits of the affix value, for the purpose to preserve * respectively the mathematical "prefix-free" or "suffix-free" property @@ -701,16 +705,16 @@ static VariLenAffix invertAffix(const VariLenAffix *a= ffix) } =20 /** - * @brief Generates suffix numbers with "suffix-free" property. + * affixForIndex() - Generates suffix numbers with "suffix-free" property. + * @index: natural number (or index) of the suffix to be generated + * (1, 2, 3, ...) + * Return: Suffix suitable to assemble unique number. * * This is just a wrapper function on top of the Exp. Golomb algorithm. * * Since the Exp. Golomb algorithm generates prefixes, but we need suffixe= s, * this function converts the Exp. Golomb prefixes into appropriate suffix= es * which are still suitable for generating unique numbers. - * - * @param n - natural number (or index) of the suffix to be generated - * (1, 2, 3, ...) */ static VariLenAffix affixForIndex(uint64_t index) { @@ -810,8 +814,8 @@ static int qid_inode_prefix_hash_bits(V9fsPDU *pdu, dev= _t dev) return val->prefix_bits; } =20 -/** - * @brief Slow / full mapping host inode nr -> guest inode nr. +/* + * Slow / full mapping host inode nr -> guest inode nr. * * This function performs a slower and much more costly remapping of an * original file inode number on host to an appropriate different inode @@ -823,7 +827,7 @@ static int qid_inode_prefix_hash_bits(V9fsPDU *pdu, dev= _t dev) * qid_path_suffixmap() failed. In practice this slow / full mapping is not * expected ever to be used at all though. * - * @see qid_path_suffixmap() for details + * See qid_path_suffixmap() for details * */ static int qid_path_fullmap(V9fsPDU *pdu, const struct stat *stbuf, @@ -864,8 +868,8 @@ static int qid_path_fullmap(V9fsPDU *pdu, const struct = stat *stbuf, return 0; } =20 -/** - * @brief Quick mapping host inode nr -> guest inode nr. +/* + * Quick mapping host inode nr -> guest inode nr. * * This function performs quick remapping of an original file inode number * on host to an appropriate different inode number on guest. This remappi= ng @@ -1281,12 +1285,15 @@ static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu= , V9fsPath *path, =20 =20 /** - * Convert host filesystem's block size into an appropriate block size for - * 9p client (guest OS side). The value returned suggests an "optimum" blo= ck - * size for 9p I/O, i.e. to maximize performance. + * blksize_to_iounit() - Block size exposed to 9p client. + * Return: block size * * @pdu: 9p client request * @blksize: host filesystem's block size + * + * Convert host filesystem's block size into an appropriate block size for + * 9p client (guest OS side). The value returned suggests an "optimum" blo= ck + * size for 9p I/O, i.e. to maximize performance. */ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize) { @@ -2398,10 +2405,11 @@ out_nofid: } =20 /** - * Returns size required in Rreaddir response for the passed dirent @p nam= e. + * v9fs_readdir_response_size() - Returns size required in Rreaddir respon= se + * for the passed dirent @name. * - * @param name - directory entry's name (i.e. file name, directory name) - * @returns required size in bytes + * @name: directory entry's name (i.e. file name, directory name) + * Return: required size in bytes */ size_t v9fs_readdir_response_size(V9fsString *name) { --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646656402; cv=none; d=zohomail.com; s=zohoarc; b=CowtVGz/qQ1MEa3UROHJ4ixA4tme9+EjLOmn9+DC2S6xaM/M/wMCs42FRlmF5yOXV2lg2UFPF7d0xpHHwtLrzLJIHWm3MUoSbH5su3hbSXnVt2+t9UHbQrvhoXszQXXK76GlrWOI/It0CYbSZUDs/aajgJD7LjDvb8ZTLZmr+V4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646656402; 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; bh=rknlHOgpwDruDxO5phb53nMbnqNJL5CSSyJUNGTZy5I=; b=ZH4xXvSf95f6nQpZJkG89R/g/5v9UQ7/d9BuJw4e3MGR8ZmadQxlBoTCsuJRmGExVwAyqZRAslnfgYJcITogClmQ3UgLypd0iA9XInnWKwAIVqmB5QO5LYXjAlsdtUSktzZ2nTxKweYg78BKcq1bS3EeUsT7ZAgfOVDMuLvz86o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646656402986614.2302771758826; Mon, 7 Mar 2022 04:33:22 -0800 (PST) Received: from localhost ([::1]:37490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCYD-0007x1-Sx for importer@patchew.org; Mon, 07 Mar 2022 07:33:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <041b0945f98821fe4b1a3caf5c081ca35032279c@lizzy.crudebyte.com>) id 1nRCJo-0007iL-5e for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:18:32 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:33137) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <041b0945f98821fe4b1a3caf5c081ca35032279c@lizzy.crudebyte.com>) id 1nRCJm-0008SA-Lt for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:18:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=rknlHOgpwDruDxO5phb53nMbnqNJL5CSSyJUNGTZy5I=; b=UnK2A Npj8ybRMv+c8G00unkXTeLA6VscoeHw66GNb1pknCJYiQlErCni4bxdmYweC4fMxYCMzfaBM2l28z 3PcKSRvQLIIq2oCqjA/+yuuCS5oDSv/OmzI3d1Nhmh1MyNKKRcfKTuEv6BCaNBDnXCi5x0RzOAxPN OCiVrFeqF6MaMfjBtGcPseOpy3xu1OD6zx/9N1OGUtcezi4QoqiGpvKh1bFC4gC4lYga1v065pyjt dM5f20tKGWfBKbGEJTH0zk/2Adlio+oJ8SsmvfOR/bhXLOcVYwtD5joRHwXokj7nFEg8N4OkBDIb5 653JLix3/rDbalaupYAUr57TrFUog==; Message-Id: <041b0945f98821fe4b1a3caf5c081ca35032279c.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 17/19] 9pfs/9p-util.h: convert Doxygen -> kerneldoc format To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=041b0945f98821fe4b1a3caf5c081ca35032279c@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646656404206100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: --- hw/9pfs/9p-util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index d0de6be3e2..97e681e167 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -99,7 +99,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *file= name, ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, const char *name); =20 -/** +/* * Darwin has d_seekoff, which appears to function similarly to d_off. * However, it does not appear to be supported on all file systems, * so ensure it is manually injected earlier and call here when @@ -115,15 +115,15 @@ static inline off_t qemu_dirent_off(struct dirent *de= nt) } =20 /** - * Duplicate directory entry @dent. + * qemu_dirent_dup() - Duplicate directory entry @dent. + * + * @dent: original directory entry to be duplicated + * Return: duplicated directory entry which should be freed with g_free() * * It is highly recommended to use this function instead of open coding * duplication of dirent objects, because the actual struct dirent * size may be bigger or shorter than sizeof(struct dirent) and correct * handling is platform specific (see gitlab issue #841). - * - * @dent - original directory entry to be duplicated - * @returns duplicated directory entry which should be freed with g_free() */ static inline struct dirent *qemu_dirent_dup(struct dirent *dent) { --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646655898; cv=none; d=zohomail.com; s=zohoarc; b=CHhvTYpLc8ICTLKNEDKLWikDsMuNE/sUT3ysSYgIgTbQJa96hO9tlYx9LwaGpkUAZZPScVB6NirM/ExgdamCH0QX07sHHFV0SwsXIh6KWVtq6Z3ONFHJAkhzLLwmPxKTZ67bDxdG3WqiWQzng27Yo+Zbnkvkvzk4NSQCRLTDTpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646655898; 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; bh=Dis0cFCt3Kt62wTSFGnP7lUDxDeSvq1HWoewP11CBIo=; b=ltHYSx1kLm07O2UlAPwiLER6cZ4ySy4RSzXJIv4k/UutZjLg5VbQXSlVRFtBNOfYENohGuCXY9OyN3PkzO3aPCMPDLxQOTwmpJWwBhc8YtzgRrWkR6jGG/r6VB19lXUWG5aXysKoh+d3ShWx9ccMprKmJAqR3DUixDDYFpPzAF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646655898405543.4222146755507; Mon, 7 Mar 2022 04:24:58 -0800 (PST) Received: from localhost ([::1]:43328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRCQ4-0001BR-Hj for importer@patchew.org; Mon, 07 Mar 2022 07:24:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <09d19d58078767f14f9a602eb939743d0a7c7a85@lizzy.crudebyte.com>) id 1nRCIn-0005eQ-RI for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:17:25 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:60501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <09d19d58078767f14f9a602eb939743d0a7c7a85@lizzy.crudebyte.com>) id 1nRCIm-0008HM-FQ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 07:17:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=Dis0cFCt3Kt62wTSFGnP7lUDxDeSvq1HWoewP11CBIo=; b=dhLWx VRX1mdJJ996PiaaeTSDuxkdi+RTv1FkD9it+BTu0022iO6wttC6AQN3DmMZgQYLZfQf1LQp/4AGa7 m90pT8azDu+1n2TM6g1JloshOP7ATEyKJOHLN163DKFe0co7eUhOyJJFM9HMEmpXba7zwcG9L4R6M iCn+4xy6gh4jpPzK/XQnwFQY249ZCZtIFSWKLoV7ljXo1UVcgmNtALtCsZ8A/5wMBuuEWimnZkmqH qCM/ZPKcTbZhvEOa/VeBSXWvKdWoYv6Y/vpgrSAD8u0SU3VReno5Fj2A94XLMGvExfTTJ0ShEYCXA nQvyYzw5peB407s8ANBJ/OSYih75A==; Message-Id: <09d19d58078767f14f9a602eb939743d0a7c7a85.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 18/19] 9pfs/coth.h: drop Doxygen format on v9fs_co_run_in_worker() To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=09d19d58078767f14f9a602eb939743d0a7c7a85@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646655900531100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so drop Doxygen format used on v9fs_co_run_in_worker() macro. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: --- hw/9pfs/coth.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h index f83c7dda7b..1a1edbdc2a 100644 --- a/hw/9pfs/coth.h +++ b/hw/9pfs/coth.h @@ -19,7 +19,7 @@ #include "qemu/coroutine.h" #include "9p.h" =20 -/** +/* * we want to use bottom half because we want to make sure the below * sequence of events. * @@ -29,7 +29,7 @@ * we cannot swap step 1 and 2, because that would imply worker thread * can enter coroutine while step1 is still running * - * @b PERFORMANCE @b CONSIDERATIONS: As a rule of thumb, keep in mind + * PERFORMANCE CONSIDERATIONS: As a rule of thumb, keep in mind * that hopping between threads adds @b latency! So when handling a * 9pfs request, avoid calling v9fs_co_run_in_worker() too often, because * this might otherwise sum up to a significant, huge overall latency for --=20 2.20.1 From nobody Sat May 18 17:15:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646653701; cv=none; d=zohomail.com; s=zohoarc; b=gMiBnjRBiyLUBFA3kd9BCILmXG1I6EKV+9KW+KjOMtvNS9ofQwArqEKKYTIiib49spBWyZE4EEDTtS1+CUW8TXOVIlcc3eMTmyBPw0dUV4/+M+zArSYNHdMqJbTIfOEbJNhRd1GuM88h0w/adYL1pTIgIPtpPQe2feTPT3Jzv/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646653701; 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; bh=b0kJJvQRJXiKQl93Iwsx0o6lTjxaRMH0jAe0PwTHfuQ=; b=K1FZ67sIckJLphEHsasqarkyL7nP3KCCw9dLpGxPhHUu0fbWH5TVTn9dCWp+6oQeagaFZw4Y9Q//NkJz4IiCrOaB8RkdF/gJvmjnYG/OZsxjt8nSAUfcelYERdt0PpAWaheV/QSp0WnyOtKmZHQzOHsMQ3/rDk0q9QdnlA2d+qg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646653701144298.40824738150855; Mon, 7 Mar 2022 03:48:21 -0800 (PST) Received: from localhost ([::1]:42528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRBqd-0001Cf-U2 for importer@patchew.org; Mon, 07 Mar 2022 06:48:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <35b6466459f9234b9cb30296f243a70b6f1b44b7@lizzy.crudebyte.com>) id 1nRBnR-0004l0-Kw for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:45:01 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:53379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <35b6466459f9234b9cb30296f243a70b6f1b44b7@lizzy.crudebyte.com>) id 1nRBnP-00029D-Vq for qemu-devel@nongnu.org; Mon, 07 Mar 2022 06:45:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=b0kJJvQRJXiKQl93Iwsx0o6lTjxaRMH0jAe0PwTHfuQ=; b=AVzvI KRecvIX0WRvwvVNOHw4cXrYMih3tPbhIJDK50KmMFfgV9dGxQl7Hhghd2Dvm2qCTauTehX5ebjDJQ gvo8zx3psS3jtnLDVuZgxXSDjyd9VN/3bxf90gTUJa3cuuA4YRv6B2CzKKdQnK05E4bksxzeCPD/1 ly+8iQuGwW6p39EB/DFZc/Bpouf5rRpBh10W8hhKTa06ZjGkUkdH4gylKbMdFcWjtsSYif6IX5tII HRCtPMiZrt99moq7pC0v+ErygLhTeTF4M1hGVkKKeFDGUTIrKkEVselH0MA0CB5hXe8kG7KPNEP0D yuNj1+5TDgHKLTSDHiPp3+p02ppxQ==; Message-Id: <35b6466459f9234b9cb30296f243a70b6f1b44b7.1646651700.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 07 Mar 2022 12:15:00 +0100 Subject: [PULL v2 19/19] fsdev/p9array.h: convert Doxygen -> kerneldoc format To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz , Will Cohen , Keno Fischer , Michael Roitzsch , Fabian Franz , Paolo Bonzini Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=35b6466459f9234b9cb30296f243a70b6f1b44b7@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646653702307100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" API doc comments in QEMU are supposed to be in kerneldoc format, so convert API doc comments from Doxygen format to kerneldoc format. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <2e2d46a402560f155de322d95789ba107d728885.1646314856.git.qemu_o= ss@crudebyte.com> --- fsdev/p9array.h | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/fsdev/p9array.h b/fsdev/p9array.h index 6aa25327ca..90e83a7c7b 100644 --- a/fsdev/p9array.h +++ b/fsdev/p9array.h @@ -81,11 +81,11 @@ */ =20 /** - * Declares an array type for the passed @a scalar_type. + * P9ARRAY_DECLARE_TYPE() - Declares an array type for the passed @scalar_= type. * - * This is typically used from a shared header file. + * @scalar_type: type of the individual array elements * - * @param scalar_type - type of the individual array elements + * This is typically used from a shared header file. */ #define P9ARRAY_DECLARE_TYPE(scalar_type) \ typedef struct P9Array##scalar_type { \ @@ -97,14 +97,14 @@ void p9array_auto_free_##scalar_type(scalar_type **auto_var); \ =20 /** - * Defines an array type for the passed @a scalar_type and appropriate - * @a scalar_cleanup_func. + * P9ARRAY_DEFINE_TYPE() - Defines an array type for the passed @scalar_ty= pe + * and appropriate @scalar_cleanup_func. * - * This is typically used from a C unit file. + * @scalar_type: type of the individual array elements + * @scalar_cleanup_func: appropriate function to free memory dynamically + * allocated by individual array elements before * - * @param scalar_type - type of the individual array elements - * @param scalar_cleanup_func - appropriate function to free memory dynami= cally - * allocated by individual array elements bef= ore + * This is typically used from a C unit file. */ #define P9ARRAY_DEFINE_TYPE(scalar_type, scalar_cleanup_func) \ void p9array_new_##scalar_type(scalar_type **auto_var, size_t len) \ @@ -132,23 +132,27 @@ } \ =20 /** + * P9ARRAY_REF() - Declare a reference variable for an array. + * + * @scalar_type: type of the individual array elements + * * Used to declare a reference variable (unique pointer) for an array. Aft= er * leaving the scope of the reference variable, the associated array is * automatically freed. - * - * @param scalar_type - type of the individual array elements */ #define P9ARRAY_REF(scalar_type) \ __attribute((__cleanup__(p9array_auto_free_##scalar_type))) scalar_typ= e* =20 /** - * Allocates a new array of passed @a scalar_type with @a len number of ar= ray - * elements and assigns the created array to the reference variable - * @a auto_var. + * P9ARRAY_NEW() - Allocate a new array. * - * @param scalar_type - type of the individual array elements - * @param auto_var - destination reference variable - * @param len - amount of array elements to be allocated immediately + * @scalar_type: type of the individual array elements + * @auto_var: destination reference variable + * @len: amount of array elements to be allocated immediately + * + * Allocates a new array of passed @scalar_type with @len number of array + * elements and assigns the created array to the reference variable + * @auto_var. */ #define P9ARRAY_NEW(scalar_type, auto_var, len) \ QEMU_BUILD_BUG_MSG( \ --=20 2.20.1