From nobody Mon Sep 11 12:00:14 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 4Rkldp2lmHz4stvC; Mon, 11 Sep 2023 12:00:14 +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 4Rkldp2JWkz3QWW; Mon, 11 Sep 2023 12:00:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694433614; 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=gL78C7Fj8ONWK031i3KE0hmi/Ol8R7jbJEsyG5N6y60=; b=lBdRQnOT/Vc/la2f59mqRsp3PcIaUB5Yipq4EqpVCLNUNup3S7Urx6P/Awtz5SQsgHbv39 ETaPNNrHPS9qMONJx3m1ez4otafz9LD7nl2/RYjL3165gPyv0Zo+cigWYNXYZF8GugveN/ IlmLlq37mWHicGJkU1MqALx4O0ghJP5wxMBGL8meo551loyvocRoKddMHVjRXD+Jwdw3SN c1P12fgIxWy6sPn35/tt0uj8gw8O4l6cXBUU0usw4U2148y9Q4oGSYTMcknCiPBHTnomD7 fckXaCDXUY3+t+GWfy5H5eaJl2x3JYk8lu/AOZdMgd9aIhUB71bOKP6f/kNKBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694433614; a=rsa-sha256; cv=none; b=Lfsm/S40OhTc+v8Qx8UNZYqUW0MqK7GqfjP0zMHLj0i2WPNpsFF+eqnucncLNxjQ8D9SnL weUr/yEJuCZ4d9JKobRAm/whCgiA8s1DGa6LF+QYTE+uFgKSw8WFb1o7Y+BU3ALaO+rkLc huIkNSDdVwWXKSoOcdqtiQq5vU9J0E897NFlAU8aH30SZmP4kMfJWdW/0rXkNuyTvk/YiC 1xyvjEGJJ642bACT0X1PbZFS3rc5/Pjt7lHtigBllZb5FxlPRuc8djTt1ndV0EmMLpi5GY EAsrI928ZuKFDk8G8nfkqJe3CT0fX4zjgZFPou0Jy0E976OCM4xfod+5AMMUAg== 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=1694433614; 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=gL78C7Fj8ONWK031i3KE0hmi/Ol8R7jbJEsyG5N6y60=; b=EvR4BNcOlmh5NO3UFynM5i1UQhSYJSyP6jRLh1EeAOc9kUqj+fWZaJIvmyp+yOpdt4cw9t 9pESTRFaq7jTKjPs19Y5E5+qMwoWy2Mv8Z4JcjJ1HenDHnxLd9aSBMgDEYEzsJioYx/PN4 qn9cpnElskRmkrGt0Fc5rxhZupRath3N9dVD1y9L7YcSxevdVnS0z9K5wF+5EbvwRoPBLk nO7KWvMk2FBWeyeJNBODSNTYxv3J/c7p0EdMg+PdBGWLECFC83GAHr5u88X28Vk0460y8k Mm04jtAcYC+xZut5T4VrIT6QZXv0JIKBRj3yQSC0dmdUvne+gTlNmtUvrUbJ2g== 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 4Rkldp1NgYzpJg; Mon, 11 Sep 2023 12:00:14 +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 38BC0EDp098946; Mon, 11 Sep 2023 12:00:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38BC0EBZ098937; Mon, 11 Sep 2023 12:00:14 GMT (envelope-from git) Date: Mon, 11 Sep 2023 12:00:14 GMT Message-Id: <202309111200.38BC0EBZ098937@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: 803280ea07e9 - stable/14 - linux(4): Merge getxattr 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: 803280ea07e9c07007e0acd3864a18d40b86de2a Auto-Submitted: auto-generated The branch stable/14 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=803280ea07e9c07007e0acd3864a18d40b86de2a commit 803280ea07e9c07007e0acd3864a18d40b86de2a Author: Dmitry Chagin AuthorDate: 2023-09-01 08:09:49 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-11 11:58:50 +0000 linux(4): Merge getxattr for future error recode Tested by: zirias MFC after: 1 week (cherry picked from commit 6b46ec66129d9490c91876f72d98e514121996a6) --- sys/compat/linux/linux_xattr.c | 62 ++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c index b54a0d2f89ad..901123684154 100644 --- a/sys/compat/linux/linux_xattr.c +++ b/sys/compat/linux/linux_xattr.c @@ -68,6 +68,15 @@ struct setxattr_args { int follow; }; +struct getxattr_args { + int fd; + const char *path; + const char *name; + void *value; + l_size_t size; + int follow; +}; + static char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES; @@ -262,47 +271,66 @@ linux_fremovexattr(struct thread *td, struct linux_fremovexattr_args *args) } static int -linux_path_getxattr(struct thread *td, const char *upath, const char *uname, - void *value, l_size_t size, int follow) +getxattr(struct thread *td, struct getxattr_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_get_path(td, upath, attrnamespace, - attrname, value, size, follow, UIO_USERSPACE)); + if (args->path != NULL) + error = kern_extattr_get_path(td, args->path, attrnamespace, + attrname, args->value, args->size, args->follow, UIO_USERSPACE); + else + error = kern_extattr_get_fd(td, args->fd, attrnamespace, + attrname, args->value, args->size); + return (error); } int linux_getxattr(struct thread *td, struct linux_getxattr_args *args) { + struct getxattr_args eargs = { + .fd = -1, + .path = args->path, + .name = args->name, + .value = args->value, + .size = args->size, + .follow = FOLLOW, + }; - return (linux_path_getxattr(td, args->path, args->name, - args->value, args->size, FOLLOW)); + return (getxattr(td, &eargs)); } int linux_lgetxattr(struct thread *td, struct linux_lgetxattr_args *args) { + struct getxattr_args eargs = { + .fd = -1, + .path = args->path, + .name = args->name, + .value = args->value, + .size = args->size, + .follow = NOFOLLOW, + }; - return (linux_path_getxattr(td, args->path, args->name, - args->value, args->size, NOFOLLOW)); + return (getxattr(td, &eargs)); } int linux_fgetxattr(struct thread *td, struct linux_fgetxattr_args *args) { - char attrname[LINUX_XATTR_NAME_MAX + 1]; - int attrnamespace, error; + struct getxattr_args eargs = { + .fd = args->fd, + .path = NULL, + .name = args->name, + .value = args->value, + .size = args->size, + .follow = 0, + }; - error = xatrr_to_extattr(args->name, &attrnamespace, attrname); - if (error != 0) - return (error); - return (kern_extattr_get_fd(td, args->fd, attrnamespace, - attrname, args->value, args->size)); + return (getxattr(td, &eargs)); } static int