The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=eee9aab9cb5adfbf39ab5622b441d0021c13efea

commit eee9aab9cb5adfbf39ab5622b441d0021c13efea
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2022-07-13 13:39:26 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2022-07-13 13:39:26 +0000

    vm_mmap: Remove obsolete code and comments from vm_mmap()
    
    In preparation for removing OBJT_DEFAULT, eliminate some stale/unhelpful
    comments from vm_mmap(), and remove an unused case.  In particular, the
    remaining callers of vm_mmap() in the tree do not specify OBJT_DEFAULT.
    
    It's much more common to use vm_map_find() to map an object into user
    memory, so rather than adjusting vm_mmap() to handle OBJT_SWAP objects,
    let's further discourage its use and simply remove OBJT_DEFAULT
    handling.
    
    Reviewed by:    dougm, alc, kib
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35778
---
 sys/vm/vm_mmap.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 5f27b550b78d..1c02ba35fcfe 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1454,13 +1454,6 @@ vm_mmap_cdev(struct thread *td, vm_size_t objsize, 
vm_prot_t prot,
        return (0);
 }
 
-/*
- * vm_mmap()
- *
- * Internal version of mmap used by exec, sys5 shared memory, and
- * various device drivers.  Handle is either a vnode pointer, a
- * character device, or NULL for MAP_ANON.
- */
 int
 vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
        vm_prot_t maxprot, int flags,
@@ -1479,9 +1472,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, 
vm_prot_t prot,
        object = NULL;
        writecounted = FALSE;
 
-       /*
-        * Lookup/allocate object.
-        */
        switch (handle_type) {
        case OBJT_DEVICE: {
                struct cdevsw *dsw;
@@ -1501,12 +1491,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, 
vm_prot_t prot,
                error = vm_mmap_vnode(td, size, prot, &maxprot, &flags,
                    handle, &foff, &object, &writecounted);
                break;
-       case OBJT_DEFAULT:
-               if (handle == NULL) {
-                       error = 0;
-                       break;
-               }
-               /* FALLTHROUGH */
        default:
                error = EINVAL;
                break;

Reply via email to