From 4f0bd6fb09e631f793475b0447ea905d92299839 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 21 Mar 2013 02:29:17 +0000 Subject: [PATCH] Add wrapper FreeBSD_Version check at the break point for VM_OBJECT_RLOCK name change so we still build on stable branches. Suggested by: bdrewery --- emulators/virtualbox-ose-kmod/Makefile | 2 +- ...sd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c | 83 ++++++++++++++----- ...Runtime-r0drv-freebsd-the-freebsd-kernel.h | 8 +- 3 files changed, 66 insertions(+), 27 deletions(-) diff --git a/emulators/virtualbox-ose-kmod/Makefile b/emulators/virtualbox-ose-kmod/Makefile index 3ce1cab9fc4d..6331f86efc22 100644 --- a/emulators/virtualbox-ose-kmod/Makefile +++ b/emulators/virtualbox-ose-kmod/Makefile @@ -3,7 +3,7 @@ PORTNAME= virtualbox-ose DISTVERSION= 4.2.6 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= emulators kld MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \ http://tmp.chruetertee.ch/ \ diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c index 12da26c317a4..bdeaa2ff6cd0 100644 --- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c +++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd_VM_OBJECT_RENAME.c @@ -1,95 +1,132 @@ $FreeBSD$ ---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 14:45:46.594643103 -0700 -+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 14:33:00.483697105 -0700 -@@ -162,7 +162,7 @@ +--- /home/sbruno/ports/virtualbox-ose-kmod/work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:19:36.795745576 -0700 ++++ ../work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:15:35.164791970 -0700 +@@ -162,7 +162,11 @@ case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { -- VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#endif vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); #if __FreeBSD_version < 900000 /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */ -@@ -177,7 +177,7 @@ +@@ -177,7 +181,12 @@ #if __FreeBSD_version < 900000 vm_page_unlock_queues(); #endif -- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif ++ vm_object_deallocate(pMemFreeBSD->pObject); break; } -@@ -205,10 +205,10 @@ +@@ -205,10 +214,18 @@ while (cTries <= 1) { -- VM_OBJECT_LOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); -- VM_OBJECT_UNLOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif if (pPages) break; vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh); -@@ -228,7 +228,7 @@ +@@ -228,7 +245,11 @@ if (!pPages) return pPages; -- VM_OBJECT_LOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) { vm_page_t pPage = pPages + iPage; -@@ -240,7 +240,7 @@ +@@ -240,7 +261,11 @@ atomic_add_int(&cnt.v_wire_count, 1); } } -- VM_OBJECT_UNLOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif return pPages; #endif } -@@ -264,7 +264,7 @@ +@@ -264,7 +289,11 @@ if (!pPage) { /* Free all allocated pages */ -- VM_OBJECT_LOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pObject); ++#else + VM_OBJECT_LOCK(pObject); ++#endif while (iPage-- > 0) { pPage = vm_page_lookup(pObject, iPage); -@@ -278,7 +278,7 @@ +@@ -278,7 +307,11 @@ vm_page_unlock_queues(); #endif } -- VM_OBJECT_UNLOCK(pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pObject); ++#else + VM_OBJECT_UNLOCK(pObject); ++#endif return rcNoMem; } } -@@ -411,9 +411,9 @@ +@@ -411,9 +444,17 @@ if (fContiguous) { Assert(enmType == RTR0MEMOBJTYPE_PHYS); -- VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#endif pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); -- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif pMemFreeBSD->Core.u.Phys.fAllocated = true; } -@@ -823,9 +823,9 @@ +@@ -823,9 +864,17 @@ case RTR0MEMOBJTYPE_PHYS_NC: { RTHCPHYS addr; -- VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_LOCK(pMemFreeBSD->pObject); ++#endif addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); -- VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#if __FreeBSD_version >= 1000030 + VM_OBJECT_RUNLOCK(pMemFreeBSD->pObject); ++#else + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); ++#endif return addr; } diff --git a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h index 090be79634cc..fca9c12ae4e6 100644 --- a/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h +++ b/emulators/virtualbox-ose-kmod/files/patch-src-VBox-Runtime-r0drv-freebsd-the-freebsd-kernel.h @@ -1,12 +1,14 @@ $FreeBSD$ ---- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2012-12-19 10:27:29.000000000 -0800 -+++ src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2013-03-20 14:50:35.330638254 -0700 -@@ -50,6 +50,7 @@ +--- /home/sbruno/ports/virtualbox-ose-kmod/work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2012-12-19 10:27:29.000000000 -0800 ++++ ../work/VirtualBox-4.2.6/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h 2013-03-20 19:10:15.854804053 -0700 +@@ -50,6 +50,9 @@ #include #include #include ++#if __FreeBSD_version >= 1000030 +#include ++#endif #include #include #include