From patchwork Sun Feb 27 22:35:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Cohen X-Patchwork-Id: 12762173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A032FC433EF for ; Sun, 27 Feb 2022 22:40:10 +0000 (UTC) Received: from localhost ([::1]:54226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOSD3-00068S-HV for qemu-devel@archiver.kernel.org; Sun, 27 Feb 2022 17:40:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOS8t-00067J-NW for qemu-devel@nongnu.org; Sun, 27 Feb 2022 17:35:51 -0500 Received: from [2607:f8b0:4864:20::82f] (port=39607 helo=mail-qt1-x82f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOS8q-00032Y-OZ for qemu-devel@nongnu.org; Sun, 27 Feb 2022 17:35:51 -0500 Received: by mail-qt1-x82f.google.com with SMTP id b23so7513028qtt.6 for ; Sun, 27 Feb 2022 14:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=grWbFCldgL720wZ6+WoT8uC1/mR1urOqvneOp/KMncU=; b=UDn+KKvT3ayFoEx0t6JeCS+NUur0ZwTLj3T5ujPJZcWkzrsy6EIYRAlZfDFsPgvvyt 6L/AvTIIMMKErRLkRS+YJt+jQU3gQ2lKOV5gBKm6Hgrhl6ty1TTxcc93bjFSrVafxNi3 RyeX+aquvtSGMPBEFVuqYzlVCPh085WeDt8pIGRUGdIg50WKjopVfEppOEUuv8mMAYV+ cxU11Ui0MJVVMJuEOJc+IMrqGr2J7dIxCo6NA6DjXHL9e5ii2JyY69FCqqKKTUrnTnIe b76MZm+G6JBipOiJqYyEFIAtG1MEbHPJDZgsV5pVtA01bG9TsL6jozIoy0t/2uiz+qo8 PwYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=grWbFCldgL720wZ6+WoT8uC1/mR1urOqvneOp/KMncU=; b=Umf4zHJDL4V1GIudDUx2zEgODv2WUxHd3kMcyx2HET03TNc3z82fsRp+EAyPPcZtUy JvRp7LDQzjTpcpzBIypsnDSRwMWIAJt02yqXccIgbP8vrsLXW2G0k8HkCglaBifAowfe ji9GW0DuQXDJoAYjJD1BkyT2ZSndd2F2X5bm8swv4yWtIjnJOIS08+SBwPqLFUEAI0YJ Ur7Iejnqx4pgIrsm2OhjXRsdMcXn7GN3hpGvMJ7jE5ZLUbinSdhS0wYDaA8S5WzxQceR LPTucXYFRGRMd4wA1Yb5jZatDG4KxMUrX6ruoTVe/g5WLoLL2bj7evUVv5N5zabk/WJN CJbA== X-Gm-Message-State: AOAM531j0h5/at3QUFhKP1km4WP5Hg5GK71d1uWzsv45YFhIFLlKxbGb tckIW1hzdceZrTHRymru0nHuezdD0UTCSQ== X-Google-Smtp-Source: ABdhPJzNjhFRhDJYHqiDbh2vsWEvO4bwcob0BeP4Y6O8RGPNurFbHb+VsK9URG6IBjOvO4xxOGvFtg== X-Received: by 2002:ac8:7dd1:0:b0:2de:600:a5ab with SMTP id c17-20020ac87dd1000000b002de0600a5abmr14314391qte.532.1646001347593; Sun, 27 Feb 2022 14:35:47 -0800 (PST) Received: from localhost.localdomain (209-6-248-219.s2265.c3-0.wrx-ubr1.sbo-wrx.ma.cable.rcncustomer.com. [209.6.248.219]) by smtp.gmail.com with ESMTPSA id 85-20020a370758000000b00648b7e3b8a4sm4206485qkh.111.2022.02.27.14.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 14:35:47 -0800 (PST) From: Will Cohen To: qemu-devel@nongnu.org Subject: [PATCH v9 05/11] 9p: darwin: Ignore O_{NOATIME, DIRECT} Date: Sun, 27 Feb 2022 17:35:16 -0500 Message-Id: <20220227223522.91937-6-wwcohen@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220227223522.91937-1-wwcohen@gmail.com> References: <20220227223522.91937-1-wwcohen@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::82f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=wwcohen@gmail.com; helo=mail-qt1-x82f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Laurent Vivier , Thomas Huth , Christian Schoenebeck , Greg Kurz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , hi@alyssa.is, Michael Roitzsch , Will Cohen , Paolo Bonzini , Keno Fischer Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/9pfs/9p-util.h | 2 ++ hw/9pfs/9p.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 7449733c15..2b9ac74291 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -41,6 +41,7 @@ again: fd = openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, mode); if (fd == -1) { +#ifndef CONFIG_DARWIN if (errno == EPERM && (flags & O_NOATIME)) { /* * The client passed O_NOATIME but we lack permissions to honor it. @@ -53,6 +54,7 @@ again: flags &= ~O_NOATIME; goto again; } +#endif return -1; } 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 }, }; @@ -171,10 +180,12 @@ static int get_dotl_openflags(V9fsState *s, int oflags) */ flags = dotl_to_open_flags(oflags); flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT); +#ifndef CONFIG_DARWIN /* * Ignore direct disk access hint until the server supports it. */ flags &= ~O_DIRECT; +#endif return flags; }