contigmem: update for FreeBSD 13
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 3 Jan 2020 11:52:43 +0000 (11:52 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 20 Jan 2020 16:53:42 +0000 (17:53 +0100)
FreeBSD 13 has changed the definition of vm_page_replace so we need
to have slightly different code paths around this function depending on
the BSD version.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
kernel/freebsd/contigmem/contigmem.c

index 64e0a7f..7ea0bc6 100644 (file)
@@ -297,19 +297,22 @@ contigmem_cdev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot,
                VM_OBJECT_WLOCK(object);
                vm_page_updatefake(page, paddr, memattr);
        } else {
-               vm_page_t mret;
                /*
                 * Replace the passed in reqpage page with our own fake page and
                 * free up the original page.
                 */
                page = vm_page_getfake(paddr, memattr);
                VM_OBJECT_WLOCK(object);
-               mret = vm_page_replace(page, object, (*mres)->pindex);
+#if __FreeBSD__ >= 13
+               vm_page_replace(page, object, (*mres)->pindex, *mres);
+#else
+               vm_page_t mret = vm_page_replace(page, object, (*mres)->pindex);
                KASSERT(mret == *mres,
                    ("invalid page replacement, old=%p, ret=%p", *mres, mret));
                vm_page_lock(mret);
                vm_page_free(mret);
                vm_page_unlock(mret);
+#endif
                *mres = page;
        }