From patchwork Sun Feb 27 22:35:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Will Cohen X-Patchwork-Id: 12762166 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 D0938C433EF for ; Sun, 27 Feb 2022 22:37:09 +0000 (UTC) Received: from localhost ([::1]:45014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOSA8-0008ON-S8 for qemu-devel@archiver.kernel.org; Sun, 27 Feb 2022 17:37:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOS8k-0005rb-HJ for qemu-devel@nongnu.org; Sun, 27 Feb 2022 17:35:42 -0500 Received: from [2607:f8b0:4864:20::836] (port=34451 helo=mail-qt1-x836.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOS8j-00031o-3t for qemu-devel@nongnu.org; Sun, 27 Feb 2022 17:35:42 -0500 Received: by mail-qt1-x836.google.com with SMTP id c4so7506152qtx.1 for ; Sun, 27 Feb 2022 14:35:40 -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=NNqqtWfX+7r5Cvr34BgDX1k8to7b5IQs7giXGg/3I6o=; b=HwMnN0pMB2gGgGxuRKOWWkTghTw5vGD2fuevLWkxLc2t7SF2mTuoQlKHJrYrAkGc5V 6lWgkeBfjF1GBrbfmDmh/fA+XFN72KirbaXu3kUj6KaIC9/2F42MKPZO0UWyDCgYKa2Z ShbWRiz+RvkZuUZ3XnnUYOaq09AulKka01sMX7lgoTJPwRg4CLHfXXQZO2HTsbXlyvFw bGS+tzTLtKURLnex2gS/KtZJxOMSoxe5z+U9PDI2YZOPw4d9JLhUtpD0/3xCM1pjNU0P BT4g7b8o4FTIBbv+EBYbLRLmaUCr0MFvSkgy54E3IeNjF0AYUk6iq0e9FHKn90L7SWL5 rsrw== 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=NNqqtWfX+7r5Cvr34BgDX1k8to7b5IQs7giXGg/3I6o=; b=RxHnUel6mArgTtt7AERNCgKrVgChJDS3UiHY3XOcqYDkwPHGIMgNdnAVEnhNdh0uhT RtkIqgBZEzcqAUueOuPivIIUAgdXIOjrNFyOlsnydDdSs2M6XOvUsvmaTzJvQWCS5aAe ZaNGHCRQj3e5RVkhzeH+0HvI3EfnkgryRB6ameQR0YenPrWzOSGxDQKHtdwTC/NIBToA bo3QrDFmogGxPDnc1NYM0GxcvUp2uyIrG1718j4jkZeTgwOTelmj/TR1g030SJVzW7uT KWDUdxoYAU8xYGnFd4XimQZbCiC9gK9EUkmTFNdMyQTtoUx9sENENG5Io4hFNQimUnwF 1iAw== X-Gm-Message-State: AOAM532uuI9zvrC3h9jkbAPQbC7JKKpF9eqe5TI/bSvJ1Ob5eCMQi2uG XP4+2BKJ0JuTUrpMmXGpJ0zn+Dub1s+r9w== X-Google-Smtp-Source: ABdhPJwvOOUTOmjZebf8c391jD2yJ/KALCcJ2hG69JFOMp8J195wDRjzhobqeZfOu7HNhjtJO7MRyQ== X-Received: by 2002:a05:622a:34d:b0:2dd:1364:2555 with SMTP id r13-20020a05622a034d00b002dd13642555mr14592254qtw.404.1646001339930; Sun, 27 Feb 2022 14:35:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 14:35:39 -0800 (PST) From: Will Cohen To: qemu-devel@nongnu.org Subject: [PATCH v9 01/11] 9p: linux: Fix a couple Linux assumptions Date: Sun, 27 Feb 2022 17:35:12 -0500 Message-Id: <20220227223522.91937-2-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::836 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::836; envelope-from=wwcohen@gmail.com; helo=mail-qt1-x836.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 - 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é Reviewed-by: Greg Kurz --- 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 @@ #include #include -#include #include "qemu-fsdev-throttle.h" #include "p9array.h" +#ifdef CONFIG_LINUX +# include +#endif +#ifdef CONFIG_DARWIN +# include +# include +#endif + #define SM_LOCAL_MODE_BITS 0600 #define SM_LOCAL_DIR_MODE_BITS 0700 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 #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 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