From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A9D1C433F5 for ; Thu, 14 Oct 2021 00:58:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C685761164 for ; Thu, 14 Oct 2021 00:58:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C685761164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1map4S-0003G0-VF for qemu-devel@archiver.kernel.org; Wed, 13 Oct 2021 20:58:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1manIm-00049f-Qs for qemu-devel@nongnu.org; Wed, 13 Oct 2021 19:04:49 -0400 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:35838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1manIg-0004dm-HQ for qemu-devel@nongnu.org; Wed, 13 Oct 2021 19:04:48 -0400 Received: by mail-qk1-x72b.google.com with SMTP id bj31so1108911qkb.2 for ; Wed, 13 Oct 2021 16:04:40 -0700 (PDT) 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=VTtIDPrx3HUewUYCzhNC8D4az0OrC264W3SB2KneSJQ=; b=fuwJ6NSJqId2DPXlX9ULgt6hG4ixQZBEoOV6P5ENbllld2ki74qS1aRSQupBfvID+X gzh+OlFHc5Wi/x36Y3dgXJB3vAhMDd+sPOWbCjJpHYdqBxnMUq6G9UOfWES7He6JcsEn gEryQ11gX6mleAe/tjIjjqPVR+d70R3YIwGufBlAx9sURSHv/KNmhwRECnHk8Udh3naa 2yx33EE1uKeFzRz9jd6rQ54ZsZI1CFVShCpXdyHGLqGJhxYUXTeEMuL8c8SBkeRg03vF Uezajzw9CmtJtqJT8/f+bdQSfkmElShq7SJqy/yqqUbKezJEfLw8pend+7qqMUKd/f9J w1Sw== 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=VTtIDPrx3HUewUYCzhNC8D4az0OrC264W3SB2KneSJQ=; b=F22irDOVSIgvsaz3bZa5gJCPoxr7ArO0oo0j6XtwANcRyfDUI8kKOS1hW6K2Ub4DZy t3I5TujSV2uYUGBw494IBu3s/CcYoWXy7Q62DUNFMH1v0Bgf0wG4SOFgQBk88tIKBPKQ GDCEkleJ2FugIEZD7bM3hG5MyMpJa8bWCftgrKMLsldfJl38q8EajUIGlZXyUscGURAV 8FpAqkOJmwgcOWA2WshxlgoNqe5/btW+m1dPJCLkurcPg6HQ68PQ/i4Y/sEn0+Q0cDBi 7TYDv+yuJ4HZ2TQOQMYjW4mL4k9fLpU8DDYuX8XtyjulK5chibvH6c08t0Ylukya75ry qWwA== X-Gm-Message-State: AOAM532kVJXhpL85nCmQqG2/7+EKHoRIjiW1Cpff7W/KAWTTpTUq4W9Y gFppvZZ7tatOoARwRlbMzbPb8X+Mvj2rNw== X-Google-Smtp-Source: ABdhPJx7No89KZ+2yNrPAAjrLGqofui9CGHA1XtUcXBcYl4DoALgwDMRfx3AuKu4PgFybyI0gV9Obw== X-Received: by 2002:a37:9445:: with SMTP id w66mr1880130qkd.410.1634166279962; Wed, 13 Oct 2021 16:04:39 -0700 (PDT) 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 w11sm778680qta.50.2021.10.13.16.04.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Oct 2021 16:04:39 -0700 (PDT) From: Will Cohen To: qemu-devel@nongnu.org Subject: [PATCH 07/11] 9p: darwin: *xattr_nofollow implementations Date: Wed, 13 Oct 2021 19:04:01 -0400 Message-Id: <20211013230405.32170-8-wwcohen@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211013230405.32170-1-wwcohen@gmail.com> References: <20211013230405.32170-1-wwcohen@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=wwcohen@gmail.com; helo=mail-qk1-x72b.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 13 Oct 2021 20:55:22 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keno Fischer , Michael Roitzsch Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Michael Roitzsch --- 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 later. + * 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 = openat_file(dirfd, filename, + O_RDONLY | O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd == -1) { + return -1; + } + ret = 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 = openat_file(dirfd, filename, + O_RDONLY | O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd == -1) { + return -1; + } + ret = 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 = openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd == -1) { + return -1; + } + ret = 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 = openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0); + if (fd == -1) { + return -1; + } + ret = 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) -- 2.33.0