From nobody Mon Feb 9 09:18:05 2026 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