From nobody Mon Sep 11 12:00:16 2023 X-Original-To: dev-commits-src-all@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 4Rkldr4WFzz4stn9; Mon, 11 Sep 2023 12:00:16 +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 4Rkldr3jp0z3Qcg; Mon, 11 Sep 2023 12:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694433616; 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=LE494aq4ByRDJUBRidFVYUR9S8JppemvaT5iV7f2WKc=; b=eFZ/Kvw7F38YN456Q+2Y75rbO5+J4BedzKN/UiuBpDiFJRnMdIOWj2TeDAAREmZv/HPxqw XeB6ggi4v2ERc5HTl90zySybVdF7SGYs3dk/eUa9mILb9aT7Q9CkGUsRmtfZuk+dU+yP5D VIBq/sukQgFYOrvpsREgaevev8Bs5zM1s8gu//fK8Dy0DOLi4vWWpeOS5d87Jf7Xpgi1N7 MqwezRTTd7TyZ6/fStkDQh+2+BAEcbCYxE4iEAIQ0DiPU7RZHlkvz6Ri1DjEyUkHnxd2YD hj5/RUoBzgDE3Gg3Adi5UzhFFMd4MXvJc/8IlBgtOCbDQo3pD+tgRa0koV2FEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694433616; a=rsa-sha256; cv=none; b=VwthqqIk4PbFTT2s0P4i1dMhqG0hdgqBQc9ShpbWNjHSDkhx8K9bvvRm4KfwF4Dbe6gj0U VSc8wWvxDZbzjyKOjz0ME3Is/j17IL2f7d8GNc0tYIPCoMmFOuZLl6o9rR9cJqXnf8onLx x1dErgK7oXVFmMOEmjqY86yutP0MKd6TX+bQaBccQPt18ZHoMUVeVj18tn9Xk87QCcq12y F/ovYqMq/ZyTW7jSOZxLP9JQlQs2Ib+X4Ywjedn2lzt00TN38njyq6Z1Iqf+ZjH8sAWIBo Vg1S4b9ulvxsRbd6dyuXvhjX2OprmUzXEul0rOXL0K2oouSNjcZ/jde5YVp0bA== 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=1694433616; 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=LE494aq4ByRDJUBRidFVYUR9S8JppemvaT5iV7f2WKc=; b=rCYRdCCJp9umbacOCT+YtRxwXzWk5OZnTDEwVNhRU+GsWFvQKEKAM/t6v1tk7KNN/DPyoO /IWFbsxK5pxhtuBTmwL/SVspMv+f4UwD8PKpsdpVHc3aEXnPBLq+bhNaVdPwK8q8ZmW7Kd 7g3tvS+UFYlNU2TvF3Eyy+hNtjEFiUlG8bDFI7W/RQ85a+sl+W4Ww0U/ejV/IYuUkaWg3L zP3ysqK8266zYseS1b+jcg4yYw/KfPtyv6YjwGQ7gPjWRFcsfC82XoyUveIJeP+EPyFjsG 5E3nZ8dzptD4DBroIcJxiYwOszfFyvUS1BwG2Fp0FLMiukl3U1ZDFLSVhDKIrw== 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 4Rkldr2Yxzzp5J; Mon, 11 Sep 2023 12:00:16 +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 38BC0Gb1000354; Mon, 11 Sep 2023 12:00:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38BC0GHN000346; Mon, 11 Sep 2023 12:00:16 GMT (envelope-from git) Date: Mon, 11 Sep 2023 12:00:16 GMT Message-Id: <202309111200.38BC0GHN000346@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: 0f35bf8b294e - stable/14 - linux(4): Merge removexattr for future error recode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 0f35bf8b294e2c57ef0d9cd39f0f44e36cd4f7be Auto-Submitted: auto-generated The branch stable/14 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0f35bf8b294e2c57ef0d9cd39f0f44e36cd4f7be commit 0f35bf8b294e2c57ef0d9cd39f0f44e36cd4f7be Author: Dmitry Chagin AuthorDate: 2023-09-01 08:10:44 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-11 11:59:38 +0000 linux(4): Merge removexattr for future error recode Tested by: zirias MFC after: 1 week (cherry picked from commit dfcc0237c3a97f4f7962da854389f3c5d976145a) --- 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