From nobody Sun Nov 2 11:51:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527312449843737.6503596873453; Fri, 25 May 2018 22:27:29 -0700 (PDT) Received: from localhost ([::1]:47815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMRjl-0000TI-3A for importer@patchew.org; Sat, 26 May 2018 01:27:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMRgV-0006FX-92 for qemu-devel@nongnu.org; Sat, 26 May 2018 01:24:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMRgU-0004Vc-2s for qemu-devel@nongnu.org; Sat, 26 May 2018 01:24:07 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:42997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMRgT-0004VL-Ut for qemu-devel@nongnu.org; Sat, 26 May 2018 01:24:06 -0400 Received: by mail-qt0-x241.google.com with SMTP id c2-v6so9177445qtn.9 for ; Fri, 25 May 2018 22:24:05 -0700 (PDT) Received: from localhost.localdomain (96-86-104-61-static.hfc.comcastbusiness.net. [96.86.104.61]) by smtp.gmail.com with ESMTPSA id n128-v6sm17675166qkf.42.2018.05.25.22.24.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 May 2018 22:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=x977hr+RdmnR+12WiHOXzE3IjJrpojHT9P2ugtsq2SM=; b=dJ3LAovSsWKlP6do3iCTbs8MTBD3/oFLkb/ef4/64QROEFhO1lKDpc882wNrRcrJsm niSsmI6B2jnOvDe/PPtK9LTLGumb/8F0nY9gbYJtP8XFdMLti7qgq0P2wtRiZmekjmhl vwPT/5iiVrvzH4NCXissZBeGqkqf+2OGwgjXCM9cZpNzkj1t0LtXWjFxtHjIiLljjbxe ddoETRFXy3S1l8NuywAMVl9sATQdP/z8RWPDsuEMugHLS5cnD8tdUo3kKZkbjExQogFu 5lRASUB5wKUQs6GZTvuvcNbA40EEssxIPUPL66ydH3EiOqKCO5uktNTEJ8GjZ/f2Zipx t6/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=x977hr+RdmnR+12WiHOXzE3IjJrpojHT9P2ugtsq2SM=; b=Qa+U/L1OVXiCi8kEorEqeHS96dtGdGAzIO06P266g4crmONDKckgBAHOL2UbT5l1Us h2DW/wNBxDsAUBMmrryISxhbSAkSt0gz3zbZuK9120DQQbvgaPdny5p5qKFgfLNrmjIl DD3SkcJ7Y9xyE5gvnCwP6rDqQSkvOTEHf/SQg3k1xHSWQMmdPzK+FfDkvgnF454JFBaA Fzh8R8e4G5X58fHV/jalqgwIqxvAyDj5Y/UMACyymBZ3zTJ04Ph15bB3rvUGJpsCWwNM 2TDGocQNMKNZCVIeR1OfElMqw0pORKolBLY2KzvT8/80jDJkzKof8WLNRa9A0rSoZSwH Clyg== X-Gm-Message-State: ALKqPwfInt3+J/e2MClrcuGSvmn8ZjhZ1ZgvnY9/jPSemEoBTLdDYpxs 2daAwb7SkBlw4YzunqjXXY2mad5Sjto= X-Google-Smtp-Source: ADUXVKKHCemlhSl1Dv0Ek1ZY7JhmdprOoaBit4ICooyj+oIADwBuWng5xBA0lE8quo5cV/4GWoYZLg== X-Received: by 2002:ac8:1842:: with SMTP id n2-v6mr688476qtk.124.1527312245007; Fri, 25 May 2018 22:24:05 -0700 (PDT) From: keno@juliacomputing.com To: qemu-devel@nongnu.org Date: Sat, 26 May 2018 01:23:07 -0400 Message-Id: <6205f39b495ee7356478cc53faf5e32289f57182.1527310210.git.keno@alumni.harvard.edu> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 05/13] 9p: darwin: Handle struct dirent differences X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keno Fischer , Keno Fischer , groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Signed-off-by: Keno Fischer --- hw/9pfs/9p-synth.c | 4 ++++ hw/9pfs/9p.c | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index eb68b42..3c0a6d8 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -221,7 +221,11 @@ static void synth_direntry(V9fsSynthNode *node, { strcpy(entry->d_name, node->name); 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.c b/hw/9pfs/9p.c index 1cfdf7d..49654ae 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1801,7 +1801,11 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9= fsPDU *pdu, count +=3D len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); +#ifdef CONFIG_DARWIN + saved_dir_pos =3D v9fs_co_telldir(pdu, fidp); +#else saved_dir_pos =3D dent->d_off; +#endif } =20 v9fs_readdir_unlock(&fidp->fs.dir); @@ -1952,9 +1956,19 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu= , V9fsFidState *fidp, qid.type =3D 0; qid.version =3D 0; =20 +#ifdef CONFIG_DARWIN + // Darwin has d_seekoff, which appears to function + // analogously to d_off. However, it does not appear + // to be supported on all file systems, so use + // telldir for correctness. + off_t off =3D v9fs_co_telldir(pdu, fidp); +#else + off_t off =3D dent->d_off; +#endif + /* 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_readdir_unlock(&fidp->fs.dir); @@ -1966,7 +1980,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, } count +=3D len; v9fs_string_free(&name); - saved_dir_pos =3D dent->d_off; + saved_dir_pos =3D off; } =20 v9fs_readdir_unlock(&fidp->fs.dir); --=20 2.8.1