From nobody Fri Sep 01 08:14:41 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 4RcW6B5k8Tz4sDV9; Fri, 1 Sep 2023 08:14:42 +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 4RcW6B1xPZz3KQ8; Fri, 1 Sep 2023 08:14:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693556082; 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=S+mntM+AxrwDbnpAxBTdlx+wwCbOAy2nMKovNdrtMIU=; b=E4amY46KmoCTyhtgxUNOY2Tan2LksxDMYuBveoWmxMPXGwgZBdEX4uAmHcXq6ltEzbrIVt b4lZaEwa+B32PH1vsortcjVfnp1n4fU8zw4zXxSKmr7/lYxRLS+tnP9KA+7Fp+buLbz499 5wsLz+Gd21M4RRhzCKraSpswokzeq8wFAAfuR7B28CTiG0XwvrLdUb+yTne44Hj0W+bj8M Nx8O7Wayno9EntErR1nHZafnU/Iom65wb9u2yscwUSxii/QdSMv/gUw2Q/tOzsrgqK0tC+ /UxKi0MLRvd2zQSK/+E2HrZy2O23FM+Hf/q9rjwKbKAMPS8AQJe1Kz4ATNfZKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693556082; a=rsa-sha256; cv=none; b=Jm+JRZ5eOhQ4OTa7jOG6YejBbRmDgOePHjh+/pTSgcXIcEsLp2iFt4qhrXhF4nkj4FxKpJ 8o/ksJLDJcmmtZQJBL/yPZq/glAHtSYC968zjzoyPak25UncEkB+DLReuCGiV7ceBaQaMe YPTyUE4acGKynIwKxK8Wk5UEe4N5Rh1AFFejaZ3PEgDxlpO5fe18uzqXVhCtpm9cpAl34B +KGHXHUeFYU1Zsz9PsG9L7qrD+Y2TXN93SkUQIAaahu+eCfE4ZM8rmBQXW6d/rkVo3Cp5J GZy7v+edTovmAU2+R+7QdyS4YJYN6VJHOa1pO1xUENwIuMrwLWCoutTXwF+qCA== 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=1693556082; 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=S+mntM+AxrwDbnpAxBTdlx+wwCbOAy2nMKovNdrtMIU=; b=TS6L7i/2HlR7ngiR8S6DYwlIyn4jIVZs1+RmpKpLQ7cBS9P5jay/xv6Nk7bJGDZ+82yfX4 PJygU+rirnLFdcvvprp+PglHb6w9fPUJ/mhVIK4wsOz7wsmvHQKyW3DtAfFZjVI76P03HD iMBqgFKJomyFmBz/mtnHKTLOo+sY3Gr+nbMHp0kW+m5MjZyvuC0fVs6gYGwGalk/32p5PT fdgcBLwS+lzsRphvta77c8hNsGZdhBUjNFC3m3Xg/wl61VS4EKTv1I8NB7+SI/ZxNHg+iQ Ix0k/ahtvG9Ivcpb59i02h/I25pRW9wnFyLttUEdMAGRVnqv64aQ7HbDE015GQ== 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 4RcW6B0WskztXH; Fri, 1 Sep 2023 08:14:42 +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 3818EfQl008379; Fri, 1 Sep 2023 08:14:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3818EfuU008376; Fri, 1 Sep 2023 08:14:41 GMT (envelope-from git) Date: Fri, 1 Sep 2023 08:14:41 GMT Message-Id: <202309010814.3818EfuU008376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: dfcc0237c3a9 - main - 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/main X-Git-Reftype: branch X-Git-Commit: dfcc0237c3a97f4f7962da854389f3c5d976145a Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=dfcc0237c3a97f4f7962da854389f3c5d976145a commit dfcc0237c3a97f4f7962da854389f3c5d976145a Author: Dmitry Chagin AuthorDate: 2023-09-01 08:10:44 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-01 08:10:44 +0000 linux(4): Merge removexattr for future error recode Tested by: zirias MFC after: 1 week --- 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