From cfea1fe89df4df3ef4569ec65a587e92f4700e9a Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Sat, 19 Oct 2013 14:39:55 +0000 Subject: [PATCH] - Fix build with clang and recent kernel API changes. - Use new style LIB_DEPENDS. PR: 173038, 174290, 180499 Submitted by: Garrett Cooper Approved by: swills (maintainer) --- emulators/open-vm-tools/Makefile | 15 ++-- emulators/open-vm-tools/files/patch-checkvm.c | 47 ++++++++++++ .../open-vm-tools/files/patch-dndLinux.c | 11 +++ .../open-vm-tools/files/patch-hgfsProto.h | 22 ++++++ .../open-vm-tools/files/patch-hgfsserver.c | 11 +++ .../files/patch-hgfsserverlinux.c | 11 +++ .../files/patch-vmblock-vfsops.c | 11 +++ .../open-vm-tools/files/patch-vmhgfs-os.c | 11 +++ .../open-vm-tools/files/patch-vmhgfs-vfsops.c | 12 +++ .../open-vm-tools/files/patch-vmmemctl-os.c | 75 ++++++++++++++++--- 10 files changed, 209 insertions(+), 17 deletions(-) create mode 100644 emulators/open-vm-tools/files/patch-checkvm.c create mode 100644 emulators/open-vm-tools/files/patch-dndLinux.c create mode 100644 emulators/open-vm-tools/files/patch-hgfsProto.h create mode 100644 emulators/open-vm-tools/files/patch-hgfsserver.c create mode 100644 emulators/open-vm-tools/files/patch-hgfsserverlinux.c create mode 100644 emulators/open-vm-tools/files/patch-vmblock-vfsops.c create mode 100644 emulators/open-vm-tools/files/patch-vmhgfs-os.c create mode 100644 emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c diff --git a/emulators/open-vm-tools/Makefile b/emulators/open-vm-tools/Makefile index c7d40c51423a..fe441e7e4e21 100644 --- a/emulators/open-vm-tools/Makefile +++ b/emulators/open-vm-tools/Makefile @@ -3,7 +3,7 @@ PORTNAME= open-vm-tools PORTVERSION= ${BUILD_VER} -PORTREVISION= 3 +PORTREVISION= 4 PORTEPOCH= 1 CATEGORIES= emulators kld MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/stable-8.6.x @@ -21,6 +21,7 @@ BUILD_VER= 425873 WRKSRC= ${WRKDIR}/open-vm-tools-${RELEASE_VER}-${BUILD_VER} GNU_CONFIGURE= yes USES= pkgconfig +USE_GNOME= glib20 USE_LDCONFIG= yes CPPFLAGS+= -Wno-deprecated-declarations @@ -28,26 +29,24 @@ SSP_UNSAFE= kernel module does not support ssp CONFIGURE_ARGS+= --without-procps --sysconfdir=${LOCALBASE}/etc .if defined(WITHOUT_X11) -LIB_DEPENDS+= glib-2.0:${PORTSDIR}/devel/glib20 CONFIGURE_ARGS+= --without-x --without-gtk2 --without-gtkmm PLIST_SUB+= X11="@comment " CONFLICTS= open-vm-tools-[0-9]* .else .if !defined(WITHOUT_LIBNOTIFY) -LIB_DEPENDS+= notify.4:${PORTSDIR}/devel/libnotify +LIB_DEPENDS+= libnotify.so:${PORTSDIR}/devel/libnotify .endif .if defined(WITH_UNITY) CONFIGURE_ENV+= CUSTOM_URIPARSER_CPPFLAGS="-I${LOCALBASE}/include/uriparser" -LIB_DEPENDS+= uriparser.1:${PORTSDIR}/net/uriparser +LIB_DEPENDS+= liburiparser.so:${PORTSDIR}/net/uriparser .else CONFIGURE_ARGS+= --disable-unity .endif -LIB_DEPENDS+= gtkmm-2.4:${PORTSDIR}/x11-toolkits/gtkmm24 CONFIGURE_ARGS+= --with-x LDFLAGS+= -L${LOCALBASE}/lib USE_XORG= x11 ice sm xext xineramaproto xinerama xrandr xrender \ xtst -USE_GNOME= gtk20 glib20 +USE_GNOME+= gtk20 gtkmm24 PLIST_SUB+= X11="" CONFLICTS= open-vm-tools-nox11-[0-9]* .endif @@ -65,13 +64,13 @@ SUB_FILES= pkg-message .if defined(WITHOUT_DNET) CONFIGURE_ARGS+= --without-dnet .else -LIB_DEPENDS+= dnet:${PORTSDIR}/net/libdnet +LIB_DEPENDS+= libdnet.so:${PORTSDIR}/net/libdnet .endif .if defined(WITHOUT_ICU) CONFIGURE_ARGS+= --without-icu .else -LIB_DEPENDS+= icuuc:${PORTSDIR}/devel/icu +LIB_DEPENDS+= libicuuc.so:${PORTSDIR}/devel/icu .endif USE_RC_SUBR= vmware-guestd vmware-kmod diff --git a/emulators/open-vm-tools/files/patch-checkvm.c b/emulators/open-vm-tools/files/patch-checkvm.c new file mode 100644 index 000000000000..81cbec9239e9 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-checkvm.c @@ -0,0 +1,47 @@ +--- checkvm/checkvm.c.orig ++++ checkvm/checkvm.c +@@ -56,7 +56,7 @@ + uint32 val + ) + { +- __asm__ volatile("out%L0 (%%dx)" : :"a" (val), "d" (port)); ++ __asm__ volatile("outl %%eax, %%dx" : :"a" (val), "d" (port)); + } + + static __inline__ uint32 +@@ -66,7 +66,7 @@ + { + uint32 ret; + +- __asm__ volatile("in%L0 (%%dx)" : "=a" (ret) : "d" (port)); ++ __asm__ volatile("inl %%dx, %%eax" : "=a" (ret) : "d" (port)); + return ret; + } + +@@ -79,7 +79,7 @@ + { + uint32 eax, ebx, ecx, edx; + +- __asm__ volatile("inl (%%dx)" : ++ __asm__ volatile("inl %%dx, %%eax" : + "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : + "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETVERSION), + "2"(BDOOR_PORT) : "memory"); +@@ -96,7 +96,7 @@ + { + uint32 eax, ebx, ecx, edx; + +- __asm__ volatile("inl (%%dx)" : ++ __asm__ volatile("inl %%dx, %%eax" : + "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : + "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETHWVERSION), + "2"(BDOOR_PORT) : "memory"); +@@ -112,7 +112,7 @@ + { + uint32 eax, ebx, ecx, edx; + +- __asm__ volatile("inl (%%dx)" : ++ __asm__ volatile("inl %%dx, %%eax" : + "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : + "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETSCREENSIZE), + "2"(BDOOR_PORT) : "memory"); diff --git a/emulators/open-vm-tools/files/patch-dndLinux.c b/emulators/open-vm-tools/files/patch-dndLinux.c new file mode 100644 index 000000000000..1f525f5a44e0 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-dndLinux.c @@ -0,0 +1,11 @@ +--- services/plugins/dndcp/dnd/dndLinux.c.orig ++++ services/plugins/dndcp/dnd/dndLinux.c +@@ -455,7 +455,7 @@ + DnD_CheckBlockFuse(int blockFd) // IN + { + char buf[sizeof(VMBLOCK_FUSE_READ_RESPONSE)]; +- size_t size; ++ ssize_t size; + + size = read(blockFd, buf, sizeof(VMBLOCK_FUSE_READ_RESPONSE)); + if (size < 0) { diff --git a/emulators/open-vm-tools/files/patch-hgfsProto.h b/emulators/open-vm-tools/files/patch-hgfsProto.h new file mode 100644 index 000000000000..fc8ca5e92d61 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-hgfsProto.h @@ -0,0 +1,22 @@ +--- lib/include/hgfsProto.h.orig ++++ lib/include/hgfsProto.h +@@ -148,6 +148,9 @@ + HGFS_OP_SET_EAS_V4, /* Add or modify extended attributes. */ + + HGFS_OP_MAX, /* Dummy op, must be last in enum */ ++ ++/* If a V4 packet is being processed as a legacy packet it will have this opcode. */ ++ HGFS_V4_LEGACY_OPCODE = 0xff, + } HgfsOp; + + +@@ -155,9 +158,6 @@ + #define HGFS_VERSION_OLD (1 << 0) + #define HGFS_VERSION_3 (1 << 1) + +-/* If a V4 packet is being processed as a legacy packet it will have this opcode. */ +-#define HGFS_V4_LEGACY_OPCODE 0xff +- + /* XXX: Needs change when VMCI is supported. */ + #define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest)) + #define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply)) diff --git a/emulators/open-vm-tools/files/patch-hgfsserver.c b/emulators/open-vm-tools/files/patch-hgfsserver.c new file mode 100644 index 000000000000..1a544b4c6e52 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-hgfsserver.c @@ -0,0 +1,11 @@ +--- lib/hgfsServer/hgfsServer.c.orig ++++ lib/hgfsServer/hgfsServer.c +@@ -3557,7 +3557,7 @@ + * delimiter on copy. Allow 0 length drives so that hidden feature "" can + * work. + */ +- if (pathLength < 0 || pathLength >= sizeof p.mountPoint) { ++ if (pathLength >= sizeof p.mountPoint) { + LOG(4, ("%s: could not get the volume name\n", __FUNCTION__)); + + return FALSE; diff --git a/emulators/open-vm-tools/files/patch-hgfsserverlinux.c b/emulators/open-vm-tools/files/patch-hgfsserverlinux.c new file mode 100644 index 000000000000..8e3393dc8be1 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-hgfsserverlinux.c @@ -0,0 +1,11 @@ +--- lib/hgfsServer/hgfsServerLinux.c.orig ++++ lib/hgfsServer/hgfsServerLinux.c +@@ -551,7 +551,7 @@ + + arraySize = ARRAYSIZE(HgfsServerOpenFlags); + +- if (flagsIn < 0 || flagsIn >= arraySize) { ++ if (flagsIn >= arraySize) { + Log("%s: Invalid HgfsOpenFlags %d\n", __FUNCTION__, flagsIn); + + return FALSE; diff --git a/emulators/open-vm-tools/files/patch-vmblock-vfsops.c b/emulators/open-vm-tools/files/patch-vmblock-vfsops.c new file mode 100644 index 000000000000..37f58025064b --- /dev/null +++ b/emulators/open-vm-tools/files/patch-vmblock-vfsops.c @@ -0,0 +1,11 @@ +--- modules/freebsd/vmblock/vfsops.c.orig ++++ modules/freebsd/vmblock/vfsops.c +@@ -236,7 +236,7 @@ + */ + MNT_ILOCK(mp); + mp->mnt_flag |= lowerrootvp->v_mount->mnt_flag & MNT_LOCAL; +-#if __FreeBSD_version >= 600000 ++#if __FreeBSD_version >= 600000 && __FreeBSD_version < 1000021 + mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE; + #endif + MNT_IUNLOCK(mp); diff --git a/emulators/open-vm-tools/files/patch-vmhgfs-os.c b/emulators/open-vm-tools/files/patch-vmhgfs-os.c new file mode 100644 index 000000000000..95cf151f7760 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-vmhgfs-os.c @@ -0,0 +1,11 @@ +--- modules/freebsd/vmhgfs/os.c.orig ++++ modules/freebsd/vmhgfs/os.c +@@ -647,7 +647,7 @@ + OS_THREAD_T *newThread) // OUT + { + return compat_kthread_create(function, parameter, +- newThread, 0, 0, threadName); ++ newThread, 0, 0, "%s", threadName); + } + + diff --git a/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c b/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c new file mode 100644 index 000000000000..60e6b48a7a30 --- /dev/null +++ b/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c @@ -0,0 +1,12 @@ +--- modules/freebsd/vmhgfs/vfsops.c.orig ++++ modules/freebsd/vmhgfs/vfsops.c +@@ -201,7 +201,9 @@ + * structures, not oplocks/leases with the VM's host.) + */ ++#if __FreeBSD_version < 1000021 + MNT_ILOCK(mp); + mp->mnt_kern_flag |= MNTK_MPSAFE; + MNT_IUNLOCK(mp); ++#endif + + /* Get a new unique filesystem ID */ diff --git a/emulators/open-vm-tools/files/patch-vmmemctl-os.c b/emulators/open-vm-tools/files/patch-vmmemctl-os.c index 41757d1b84c8..af18715f6fc6 100644 --- a/emulators/open-vm-tools/files/patch-vmmemctl-os.c +++ b/emulators/open-vm-tools/files/patch-vmmemctl-os.c @@ -1,12 +1,56 @@ ---- modules/freebsd/vmmemctl/os.c.orig 2011-09-21 14:25:15.000000000 -0400 -+++ modules/freebsd/vmmemctl/os.c 2012-06-20 09:44:40.434083000 -0400 -@@ -344,12 +344,22 @@ +--- modules/freebsd/vmmemctl/os.c.orig 2011-09-21 20:25:15.000000000 +0200 ++++ modules/freebsd/vmmemctl/os.c 2013-10-19 11:01:27.000000000 +0200 +@@ -37,9 +37,11 @@ + #include + #include + #include ++#include + #include + #include + #include ++#include + #include + + #include +@@ -264,14 +266,23 @@ + p->size = (p->size + sizeof(unsigned long) - 1) & + ~(sizeof(unsigned long) - 1); + ++#if __FreeBSD_version >= 1000042 ++ p->bitmap = (unsigned long *)kmem_malloc(kernel_arena, p->size, ++ M_WAITOK | M_ZERO); ++#else + p->bitmap = (unsigned long *)kmem_alloc(kernel_map, p->size); ++#endif + } + + + static void + os_pmap_free(os_pmap *p) // IN + { ++#if __FreeBSD_version >= 1000042 ++ kmem_free(kernel_arena, (vm_offset_t)p->bitmap, p->size); ++#else + kmem_free(kernel_map, (vm_offset_t)p->bitmap, p->size); ++#endif + p->size = 0; + p->bitmap = NULL; + } +@@ -344,12 +355,31 @@ os_state *state = &global_state; os_pmap *pmap = &state->pmap; - if ( !vm_page_lookup(state->vmobject, page->pindex) ) { - return; +- } + +- os_pmap_putindex(pmap, page->pindex); +- vm_page_free(page); ++#if __FreeBSD_version > 1000029 ++ VM_OBJECT_WLOCK(state->vmobject); ++#else + VM_OBJECT_LOCK(state->vmobject); ++#endif + if ( vm_page_lookup(state->vmobject, page->pindex) ) { + os_pmap_putindex(pmap, page->pindex); +#if __FreeBSD_version >= 900000 @@ -20,31 +64,44 @@ +#else + vm_page_unlock_queues(); +#endif - } -- -- os_pmap_putindex(pmap, page->pindex); -- vm_page_free(page); ++ } ++#if __FreeBSD_version > 1000029 ++ VM_OBJECT_WUNLOCK(state->vmobject); ++#else + VM_OBJECT_UNLOCK(state->vmobject); ++#endif } -@@ -361,8 +371,11 @@ +@@ -361,8 +391,19 @@ os_state *state = &global_state; os_pmap *pmap = &state->pmap; ++#if __FreeBSD_version > 1000029 ++ VM_OBJECT_WLOCK(state->vmobject); ++#else + VM_OBJECT_LOCK(state->vmobject); ++#endif + pindex = os_pmap_getindex(pmap); if (pindex == (vm_pindex_t)-1) { ++#if __FreeBSD_version > 1000029 ++ VM_OBJECT_WUNLOCK(state->vmobject); ++#else + VM_OBJECT_UNLOCK(state->vmobject); ++#endif return NULL; } -@@ -383,6 +396,7 @@ +@@ -383,6 +424,11 @@ if (!page) { os_pmap_putindex(pmap, pindex); } ++#if __FreeBSD_version > 1000029 ++ VM_OBJECT_WUNLOCK(state->vmobject); ++#else + VM_OBJECT_UNLOCK(state->vmobject); ++#endif return page; }