From nobody Sun Feb 8 22:50:54 2026 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 1527816927101606.3898488524568; Thu, 31 May 2018 18:35:27 -0700 (PDT) Received: from localhost ([::1]:46917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOYyQ-0008G9-5M for importer@patchew.org; Thu, 31 May 2018 21:35:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOYqx-0002yk-Ug for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOYqw-0002zT-Gv for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:39 -0400 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:45558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOYqw-0002z4-Bh for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:38 -0400 Received: by mail-qk0-x232.google.com with SMTP id c198-v6so18725321qkg.12 for ; Thu, 31 May 2018 18:27:38 -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 o68-v6sm2003842qkc.19.2018.05.31.18.27.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 May 2018 18:27:36 -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=/K+FKvBNps/a4B5+A2+Zx4W2/IBvsoRH15D/8qoQTK4=; b=lDe7rSi63w+ZnVHBR/bsrTNC26sHChy42oW0o3LJgRdqhKI5Edr1nyFA9mN4A6T2Cm yD5O2+k28CiYg837LUZ+ms2mQ7uXDuTS5lxOT+Nr52wlAIXsFNslYA+E1ZVrT0wnQ6yG rGHZYOAH0cCkC2hL66gp7SQOXoe1//xTd/CC7RIUOr/D2Xlbtrr2yNtfUmTnj+LMHxkp A++V1yV7crzLqT9DEAkC+Io1zvFgY+bOIzSdlVlPiKn6J0GDwCOCwipJ0IvYElaXam0Q ZfZK8f45FdNkvDCYq7ADn7OG+dgpqzz+UZG/XJYCvaRFBkOouBDIIUv/BQS6unFGx9oa bksA== 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=/K+FKvBNps/a4B5+A2+Zx4W2/IBvsoRH15D/8qoQTK4=; b=Ogf9n/ti6bXuT8xml1p3pkDo21CKdjt8YlkFXZNUfmzulaBXQv0v3OdFpqRn/P2oR9 anGDn6os2X3gyP9r/fVDa7dmrlOMbGaufq8n6bfFrEYTGXFrWRYCVNmnZcxyTCbucOOu rmgeGEfmi3AwNRVDnz5TxgtBcfYJyAQ+UQJsXvNVhZg3rrwF1amQM3i5l1nnvi3J1U7/ KatuO+894sorKFvKqxWwRji01rtRhXxPqFy72XmTilUVsokBcj0OTKckDuDegMSWu0rF hGCW+8kW0nYxtFcRylRsNhICuhnEaO5hYnP/UbNfd//1aOWxfwax8X4dp8zfeGh5DRXL Snvg== X-Gm-Message-State: APt69E1sXKymJk5UF5QBUqhOwg02+DbdCE4ipvTAGQcqwrPkU9TcPc+G X51KRHvdI8n+xj/c0r3eRHgO//lvNZc= X-Google-Smtp-Source: ADUXVKIRFlPOU4ARk3ZRSllZq/47mO3lZa5fbcfKEhXgSqFzu0FKEu3EeEaJFNqLtOlY6SmBC6ofrA== X-Received: by 2002:a37:3147:: with SMTP id x68-v6mr8500043qkx.358.1527816457389; Thu, 31 May 2018 18:27:37 -0700 (PDT) From: Keno Fischer To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:26:02 -0400 Message-Id: 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:c09::232 Subject: [Qemu-devel] [PATCH v2 07/20] 9p: Move a couple xattr functions to 9p-util 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 , 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" These functions will need custom implementations on Darwin. Since the implementation is very similar among all of them, and 9p-util already has the _nofollow version of fgetxattrat, let's move them all there. Signed-off-by: Keno Fischer --- Changes since v1: * fgetxattr_follow is dropped in favor of a different approach later in the series. hw/9pfs/9p-util.c | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p-util.h | 4 ++++ hw/9pfs/9p-xattr.c | 33 --------------------------------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/hw/9pfs/9p-util.c b/hw/9pfs/9p-util.c index f709c27..614b7fc 100644 --- a/hw/9pfs/9p-util.c +++ b/hw/9pfs/9p-util.c @@ -24,3 +24,36 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *file= name, const char *name, g_free(proc_path); return ret; } + +ssize_t flistxattrat_nofollow(int dirfd, const char *filename, + char *list, size_t size) +{ + char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); + int ret; + + ret =3D llistxattr(proc_path, list, size); + g_free(proc_path); + return ret; +} + +ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, + const char *name) +{ + char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); + int ret; + + ret =3D lremovexattr(proc_path, name); + g_free(proc_path); + return ret; +} + +int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, + void *value, size_t size, int flags) +{ + char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); + int ret; + + ret =3D lsetxattr(proc_path, name, value, size, flags); + g_free(proc_path); + return ret; +} diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index dc0d2e2..79ed6b2 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -60,5 +60,9 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *path,= const char *name, void *value, size_t size); int fsetxattrat_nofollow(int dirfd, const char *path, const char *name, void *value, size_t size, int flags); +ssize_t flistxattrat_nofollow(int dirfd, const char *filename, + char *list, size_t size); +ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, + const char *name); =20 #endif diff --git a/hw/9pfs/9p-xattr.c b/hw/9pfs/9p-xattr.c index d05c1a1..c696d8f 100644 --- a/hw/9pfs/9p-xattr.c +++ b/hw/9pfs/9p-xattr.c @@ -60,17 +60,6 @@ ssize_t pt_listxattr(FsContext *ctx, const char *path, return name_size; } =20 -static ssize_t flistxattrat_nofollow(int dirfd, const char *filename, - char *list, size_t size) -{ - char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); - int ret; - - ret =3D llistxattr(proc_path, list, size); - g_free(proc_path); - return ret; -} - /* * Get the list and pass to each layer to find out whether * to send the data or not @@ -196,17 +185,6 @@ ssize_t pt_getxattr(FsContext *ctx, const char *path, = const char *name, return local_getxattr_nofollow(ctx, path, name, value, size); } =20 -int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size, int flags) -{ - char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); - int ret; - - ret =3D lsetxattr(proc_path, name, value, size, flags); - g_free(proc_path); - return ret; -} - ssize_t local_setxattr_nofollow(FsContext *ctx, const char *path, const char *name, void *value, size_t size, int flags) @@ -235,17 +213,6 @@ int pt_setxattr(FsContext *ctx, const char *path, cons= t char *name, void *value, return local_setxattr_nofollow(ctx, path, name, value, size, flags); } =20 -static ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, - const char *name) -{ - char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); - int ret; - - ret =3D lremovexattr(proc_path, name); - g_free(proc_path); - return ret; -} - ssize_t local_removexattr_nofollow(FsContext *ctx, const char *path, const char *name) { --=20 2.8.1