From owner-dev-commits-src-all@freebsd.org Mon May 31 19:58:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E90164E814; Mon, 31 May 2021 19:58:33 +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 4Fv5h90sLVz4qFv; Mon, 31 May 2021 19:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 015E016781; Mon, 31 May 2021 19:58:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14VJwWIN086928; Mon, 31 May 2021 19:58:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJwW0t086927; Mon, 31 May 2021 19:58:32 GMT (envelope-from git) Date: Mon, 31 May 2021 19:58:32 GMT Message-Id: <202105311958.14VJwW0t086927@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: 2a0fa277f66b - main - linux(4): Microoptimize futimesat, utimes, utime. While here wrap long line. 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: 2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:58:33 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c commit 2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c Author: Dmitry Chagin AuthorDate: 2021-05-31 19:54:18 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 19:54:18 +0000 linux(4): Microoptimize futimesat, utimes, utime. While here wrap long line. Differential Revision: https://reviews.freebsd.org/D30488 MFC after: 2 weeks --- sys/compat/linux/linux_misc.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 9676cad893c1..c3f783694d84 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -722,18 +722,10 @@ linux_utime(struct thread *td, struct linux_utime_args *args) struct l_utimbuf lut; char *fname; int error; - bool convpath; - - convpath = LUSECONVPATH(td); - if (convpath) - LCONVPATHEXIST(td, args->fname, &fname); if (args->times) { - if ((error = copyin(args->times, &lut, sizeof lut))) { - if (convpath) - LFREEPATH(fname); + if ((error = copyin(args->times, &lut, sizeof lut)) != 0) return (error); - } tv[0].tv_sec = lut.l_actime; tv[0].tv_usec = 0; tv[1].tv_sec = lut.l_modtime; @@ -742,10 +734,11 @@ linux_utime(struct thread *td, struct linux_utime_args *args) } else tvp = NULL; - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { + LCONVPATHEXIST(td, args->fname, &fname); error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); LFREEPATH(fname); @@ -762,17 +755,10 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) struct timeval tv[2], *tvp = NULL; char *fname; int error; - bool convpath; - - convpath = LUSECONVPATH(td); - if (convpath) - LCONVPATHEXIST(td, args->fname, &fname); if (args->tptr != NULL) { - if ((error = copyin(args->tptr, ltv, sizeof ltv))) { - LFREEPATH(fname); + if ((error = copyin(args->tptr, ltv, sizeof ltv)) != 0) return (error); - } tv[0].tv_sec = ltv[0].tv_sec; tv[0].tv_usec = ltv[0].tv_usec; tv[1].tv_sec = ltv[1].tv_sec; @@ -780,10 +766,11 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) tvp = tv; } - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { + LCONVPATHEXIST(td, args->fname, &fname); error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); LFREEPATH(fname); @@ -897,19 +884,12 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args) struct timeval tv[2], *tvp = NULL; char *fname; int error, dfd; - bool convpath; - convpath = LUSECONVPATH(td); dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; - if (convpath) - LCONVPATHEXIST_AT(td, args->filename, &fname, dfd); if (args->utimes != NULL) { - if ((error = copyin(args->utimes, ltv, sizeof ltv))) { - if (convpath) - LFREEPATH(fname); + if ((error = copyin(args->utimes, ltv, sizeof ltv)) != 0) return (error); - } tv[0].tv_sec = ltv[0].tv_sec; tv[0].tv_usec = ltv[0].tv_usec; tv[1].tv_sec = ltv[1].tv_sec; @@ -917,11 +897,13 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args) tvp = tv; } - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, dfd, args->filename, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { - error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); + LCONVPATHEXIST_AT(td, args->filename, &fname, dfd); + error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, + tvp, UIO_SYSSPACE); LFREEPATH(fname); } return (error);