From nobody Tue Sep 12 16:44:11 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RlTv01R8nz4stk6; Tue, 12 Sep 2023 16:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RlTv00y8kz3dWk; Tue, 12 Sep 2023 16:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694537052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nhkvlxfUs/XetgSCxRPRhhhsAZ7jIYRoz6t+dl0wP9c=; b=kvpmFTm2xXOZPp0yq5v1/x4exaVixLPz8oyxHTKKeHK6s5uo4HC6zOQnt3rpu5+ZT0TLuF 1MGAURlkd6/sQpBaJiS5dqoT43NtAlVCW9ouBLwyZ7odAmaMmvJOvzVobRElEJEqMOB/sE W105XJI+Dqa7oPZ6QUBhaZU/A2uzLVvqdmWnAsW8dvoAsIBtmbEDOSTFy94AT9r7yELsDV VAG1Y6Sa76lMvyUdHydA9cTt3A09MInYYdPlcf6ca0bf5EGXEHv8uwN6mmyJNKXFsaBrK5 lGprcEhWFEGLq+UvZugmREXTQUHZH1rYJLoMaS0/47hCUxNeN9F7zYWrqgkGHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694537052; a=rsa-sha256; cv=none; b=F7gMJmiqiNDD7xoR8vPOPw2VHhObnSpnMp5fA8gUh5qm0Astwu/3f1TufiIREgvNiosbt4 dUXSdTvE5VWos2oQtnfUV9lGlAmnEqCNa6G/b+gj7iz3URnb7YHwJyhJbjiWtjbIMkSb19 lGu0L219MkpzAcOJ0UYM7HYrhS/O8GxEaUZsj4ksitjcjAstvJCOuDFs5bJShwRHFK6xZq D9FTjySIEnScoOD2rF+NLVHfO9mrLeuZH8W/ZznMThyqIEjFANtQ/uHRl0Z+6ABZuVNvvG zuMcG+3BYdeIAG166/Eiug0eDos9BKaM78RP+eOMAwmAruV/oKfZSP0dOXWYoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694537052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nhkvlxfUs/XetgSCxRPRhhhsAZ7jIYRoz6t+dl0wP9c=; b=JFmsp6jNtb1q0Q4kl/eHsqFOeKfLnTGZizqB7GthC61aQj2d575blQWeu/3aK7vlgZaUpt Xk4uD7SrTcB3/58PIWxCIpy5pkEYDQh9AtEi8EYFNld32iYWirX5eVUc4G0e+kmqELM2eL dU8kPgA9R9RVCVKVqrs+s2eiRiTBTSPXf7RiLaKIjO4S4Athg5du033EIcoWMkMa7A5bD7 LYxPnmSEpgJBPJ8bbAvibagHEgk/6ZV9UJbl6tFTk5kSPR5JsHdvs5LylN2HP76jbwrYuG i8qZCiOnR4+1a6gVBubtpwigUZdgpVcjqSy4YAR4FQZMJTMBwIrhWrdeELXv3g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RlTtz6v9pzfVk; Tue, 12 Sep 2023 16:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38CGiBMZ071037; Tue, 12 Sep 2023 16:44:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38CGiBUf071034; Tue, 12 Sep 2023 16:44:11 GMT (envelope-from git) Date: Tue, 12 Sep 2023 16:44:11 GMT Message-Id: <202309121644.38CGiBUf071034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: ed3248554e5f - releng/14.0 - linux(4): Merge removexattr for future error recode List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: ed3248554e5f4806cbda5198c7af8d3b112518c7 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ed3248554e5f4806cbda5198c7af8d3b112518c7 commit ed3248554e5f4806cbda5198c7af8d3b112518c7 Author: Dmitry Chagin AuthorDate: 2023-09-01 08:10:44 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-12 16:42:41 +0000 linux(4): Merge removexattr for future error recode Approved by: re (gjb) Tested by: zirias MFC after: 1 week (cherry picked from commit dfcc0237c3a97f4f7962da854389f3c5d976145a) (cherry picked from commit 0f35bf8b294e2c57ef0d9cd39f0f44e36cd4f7be) --- sys/compat/linux/linux_xattr.c | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c index b9717c62133c..2b46cf708c7d 100644 --- a/sys/compat/linux/linux_xattr.c +++ b/sys/compat/linux/linux_xattr.c @@ -77,6 +77,13 @@ struct getxattr_args { int follow; }; +struct removexattr_args { + int fd; + const char *path; + const char *name; + int follow; +}; + static char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES; @@ -227,47 +234,60 @@ linux_flistxattr(struct thread *td, struct linux_flistxattr_args *args) } static int -linux_path_removexattr(struct thread *td, const char *upath, const char *uname, - int follow) +removexattr(struct thread *td, struct removexattr_args *args) { char attrname[LINUX_XATTR_NAME_MAX + 1]; int attrnamespace, error; - error = xatrr_to_extattr(uname, &attrnamespace, attrname); + error = xatrr_to_extattr(args->name, &attrnamespace, attrname); if (error != 0) return (error); - - return (kern_extattr_delete_path(td, upath, attrnamespace, - attrname, follow, UIO_USERSPACE)); + if (args->path != NULL) + error = kern_extattr_delete_path(td, args->path, attrnamespace, + attrname, args->follow, UIO_USERSPACE); + else + error = kern_extattr_delete_fd(td, args->fd, attrnamespace, + attrname); + return (error); } int linux_removexattr(struct thread *td, struct linux_removexattr_args *args) { + struct removexattr_args eargs = { + .fd = -1, + .path = args->path, + .name = args->name, + .follow = FOLLOW, + }; - return (linux_path_removexattr(td, args->path, args->name, - FOLLOW)); + return (removexattr(td, &eargs)); } int linux_lremovexattr(struct thread *td, struct linux_lremovexattr_args *args) { + struct removexattr_args eargs = { + .fd = -1, + .path = args->path, + .name = args->name, + .follow = NOFOLLOW, + }; - return (linux_path_removexattr(td, args->path, args->name, - NOFOLLOW)); + return (removexattr(td, &eargs)); } int linux_fremovexattr(struct thread *td, struct linux_fremovexattr_args *args) { - char attrname[LINUX_XATTR_NAME_MAX + 1]; - int attrnamespace, error; + struct removexattr_args eargs = { + .fd = args->fd, + .path = NULL, + .name = args->name, + .follow = 0, + }; - error = xatrr_to_extattr(args->name, &attrnamespace, attrname); - if (error != 0) - return (error); - return (kern_extattr_delete_fd(td, args->fd, attrnamespace, - attrname)); + return (removexattr(td, &eargs)); } static int