From owner-dev-commits-src-main@freebsd.org Mon Jan 25 21:58:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D201B4F3604; Mon, 25 Jan 2021 21:58:55 +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 4DPkKC5btFz3Qw2; Mon, 25 Jan 2021 21:58:55 +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 B311B1DFD9; Mon, 25 Jan 2021 21:58:55 +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 10PLwth0062194; Mon, 25 Jan 2021 21:58:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10PLwta2062193; Mon, 25 Jan 2021 21:58:55 GMT (envelope-from git) Date: Mon, 25 Jan 2021 21:58:55 GMT Message-Id: <202101252158.10PLwta2062193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 7a1591c1b625 - main - Rename kern_mmap_req to kern_mmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a1591c1b625ef47a9c9954f0143a6f0d78cc05c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 21:58:55 -0000 The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=7a1591c1b625ef47a9c9954f0143a6f0d78cc05c commit 7a1591c1b625ef47a9c9954f0143a6f0d78cc05c Author: Brooks Davis AuthorDate: 2021-01-23 00:08:59 +0000 Commit: Brooks Davis CommitDate: 2021-01-25 21:50:37 +0000 Rename kern_mmap_req to kern_mmap Replace all uses of kern_mmap with kern_mmap_req move the old kern_mmap. Reand rename kern_mmap_req to kern_mmap . The helper saved some code churn initially, but having multiple interfaces is sub-optimal. Obtained from: CheriBSD Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28292 --- sys/compat/cloudabi/cloudabi_mem.c | 10 +++++-- sys/compat/freebsd32/freebsd32_misc.c | 20 +++++++++++--- sys/compat/linux/linux_mmap.c | 4 +-- sys/sys/syscallsubr.h | 4 +-- sys/vm/vm_mmap.c | 49 ++++++++++++++++++----------------- 5 files changed, 52 insertions(+), 35 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_mem.c b/sys/compat/cloudabi/cloudabi_mem.c index a1ecf3623c02..426adb6ff43f 100644 --- a/sys/compat/cloudabi/cloudabi_mem.c +++ b/sys/compat/cloudabi/cloudabi_mem.c @@ -110,8 +110,14 @@ cloudabi_sys_mem_map(struct thread *td, struct cloudabi_sys_mem_map_args *uap) if (error != 0) return (error); - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags, - uap->fd, uap->off)); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = flags, + .mr_fd = uap->fd, + .mr_pos = uap->off, + })); } int diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index b7db1c4468d7..c2caa7c10544 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -502,8 +502,14 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) prot |= PROT_EXEC; #endif - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, - uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos))); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = PAIR32TO64(off_t, uap->pos), + })); } #ifdef COMPAT_FREEBSD6 @@ -519,8 +525,14 @@ freebsd6_freebsd32_mmap(struct thread *td, prot |= PROT_EXEC; #endif - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, - uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos))); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = PAIR32TO64(off_t, uap->pos), + })); } #endif diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c index 1b4b0b78280c..d7f12b782e96 100644 --- a/sys/compat/linux/linux_mmap.c +++ b/sys/compat/linux/linux_mmap.c @@ -217,12 +217,12 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot, (bsd_flags & MAP_EXCL) == 0) { mr_fixed = mr; mr_fixed.mr_flags |= MAP_FIXED | MAP_EXCL; - error = kern_mmap_req(td, &mr_fixed); + error = kern_mmap(td, &mr_fixed); if (error == 0) goto out; } - error = kern_mmap_req(td, &mr); + error = kern_mmap(td, &mr); out: LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 71e76f072693..9e889e9d5465 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -201,12 +201,10 @@ int kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, int mode, dev_t dev); int kern_mlock(struct proc *proc, struct ucred *cred, uintptr_t addr, size_t len); -int kern_mmap(struct thread *td, uintptr_t addr, size_t len, int prot, - int flags, int fd, off_t pos); +int kern_mmap(struct thread *td, const struct mmap_req *mrp); int kern_mmap_racct_check(struct thread *td, struct vm_map *map, vm_size_t size); int kern_mmap_maxprot(struct proc *p, int prot); -int kern_mmap_req(struct thread *td, const struct mmap_req *mrp); int kern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot); int kern_msgctl(struct thread *, int, int, struct msqid_ds *); int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *); diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 30c485010ac8..ecdcc1272db1 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -179,8 +179,14 @@ int sys_mmap(struct thread *td, struct mmap_args *uap) { - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot, - uap->flags, uap->fd, uap->pos)); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = uap->prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } int @@ -197,23 +203,7 @@ kern_mmap_maxprot(struct proc *p, int prot) } int -kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags, - int fd, off_t pos) -{ - struct mmap_req mr = { - .mr_hint = addr0, - .mr_len = len, - .mr_prot = prot, - .mr_flags = flags, - .mr_fd = fd, - .mr_pos = pos - }; - - return (kern_mmap_req(td, &mr)); -} - -int -kern_mmap_req(struct thread *td, const struct mmap_req *mrp) +kern_mmap(struct thread *td, const struct mmap_req *mrp) { struct vmspace *vms; struct file *fp; @@ -442,9 +432,14 @@ done: int freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) { - - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot, - uap->flags, uap->fd, uap->pos)); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = uap->prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } #endif @@ -496,8 +491,14 @@ ommap(struct thread *td, struct ommap_args *uap) flags |= MAP_PRIVATE; if (uap->flags & OMAP_FIXED) flags |= MAP_FIXED; - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags, - uap->fd, uap->pos)); + return (kern_mmap(td, &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } #endif /* COMPAT_43 */