summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVMware, Inc <>2009-11-17 13:56:45 -0800
committerMarcelo Vanzin <mvanzin@vmware.com>2009-11-17 13:56:45 -0800
commit47f5871d0cb6367cbbdd803a9786cca0969e3f74 (patch)
tree05877d1c48ed8e631b49c2357a2ad04e9b300cef
parentb0bdffe127333e4ca5cc45c6de901ab51d027ebb (diff)
Internal branch sync. Included in this change:
. Fix probable memory leaks in vmxnet2 FreeBSD driver. . Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
-rw-r--r--open-vm-tools/lib/include/community_source.h1
-rw-r--r--open-vm-tools/lib/include/compat/compat_stdarg.h1
-rw-r--r--open-vm-tools/lib/include/cpuid_info.h1
-rw-r--r--open-vm-tools/lib/include/includeCheck.h10
-rw-r--r--open-vm-tools/lib/include/timeutil.h6
-rw-r--r--open-vm-tools/lib/include/unicode.h1
-rw-r--r--open-vm-tools/lib/include/unicodeBase.h1
-rw-r--r--open-vm-tools/lib/include/unicodeOperations.h1
-rw-r--r--open-vm-tools/lib/include/unicodeTransforms.h1
-rw-r--r--open-vm-tools/lib/include/unicodeTypes.h1
-rw-r--r--open-vm-tools/lib/include/vm_assert.h1
-rw-r--r--open-vm-tools/lib/include/vm_atomic.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_asm.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_asm_x86.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_asm_x86_64.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_defs.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_math.h1
-rw-r--r--open-vm-tools/lib/include/vm_basic_types.h1
-rw-r--r--open-vm-tools/lib/include/vm_product.h1
-rw-r--r--open-vm-tools/lib/include/vm_tools_version.h1
-rw-r--r--open-vm-tools/lib/include/vm_version.h1
-rw-r--r--open-vm-tools/lib/include/vmware.h1
-rw-r--r--open-vm-tools/lib/include/x86cpuid.h1
-rw-r--r--open-vm-tools/lib/include/x86cpuid_asm.h1
-rw-r--r--open-vm-tools/lib/misc/timeutil.c67
-rw-r--r--open-vm-tools/modules/freebsd/vmhgfs/sha1.h1
-rw-r--r--open-vm-tools/modules/freebsd/vmxnet/if_vxn.c39
-rw-r--r--open-vm-tools/modules/linux/pvscsi/scsi_defs.h1
-rw-r--r--open-vm-tools/modules/linux/shared/compat_version.h1
-rw-r--r--open-vm-tools/modules/linux/shared/driver-config.h1
-rw-r--r--open-vm-tools/modules/shared/vmxnet/net_sg.h1
-rw-r--r--open-vm-tools/modules/shared/vmxnet/vmnet_def.h1
-rw-r--r--open-vm-tools/modules/solaris/vmhgfs/sha1.h1
33 files changed, 108 insertions, 43 deletions
diff --git a/open-vm-tools/lib/include/community_source.h b/open-vm-tools/lib/include/community_source.h
index 4923270e..5c72e353 100644
--- a/open-vm-tools/lib/include/community_source.h
+++ b/open-vm-tools/lib/include/community_source.h
@@ -43,7 +43,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/compat/compat_stdarg.h b/open-vm-tools/lib/include/compat/compat_stdarg.h
index 65b64645..a0e12fce 100644
--- a/open-vm-tools/lib/include/compat/compat_stdarg.h
+++ b/open-vm-tools/lib/include/compat/compat_stdarg.h
@@ -45,7 +45,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/cpuid_info.h b/open-vm-tools/lib/include/cpuid_info.h
index add5bbb2..4527694b 100644
--- a/open-vm-tools/lib/include/cpuid_info.h
+++ b/open-vm-tools/lib/include/cpuid_info.h
@@ -21,7 +21,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMMEXT
diff --git a/open-vm-tools/lib/include/includeCheck.h b/open-vm-tools/lib/include/includeCheck.h
index 7d7452be..0ea2d779 100644
--- a/open-vm-tools/lib/include/includeCheck.h
+++ b/open-vm-tools/lib/include/includeCheck.h
@@ -70,7 +70,6 @@
* INCLUDE_ALLOW_VMMEXT
* INCLUDE_ALLOW_VMCORE
* INCLUDE_ALLOW_MODULE
- * INCLUDE_ALLOW_VMNIXMOD
* INCLUDE_ALLOW_VMKERNEL
* INCLUDE_ALLOW_DISTRIBUTE
* INCLUDE_ALLOW_VMK_MODULE
@@ -133,7 +132,7 @@
#endif
#undef INCLUDE_ALLOW_VMMEXT
-#if defined MODULE && !defined VMKERNEL_MODULE && !defined VMNIXMOD && \
+#if defined MODULE && !defined VMKERNEL_MODULE && \
!defined VMMON && !defined INCLUDE_ALLOW_MODULE
#error "The surrounding include file is not allowed in driver modules."
#endif
@@ -161,13 +160,6 @@
#undef INCLUDE_ALLOW_VMK_MODULE
#undef INCLUDE_ALLOW_VMKDRIVERS
-#if defined VMNIXMOD && !defined INCLUDE_ALLOW_VMNIXMOD
-#ifndef VMNIXMOD_VM
-#error "The surrounding include file is not allowed in vmnixmod."
-#endif
-#endif
-#undef INCLUDE_ALLOW_VMNIXMOD
-
#if defined VMIROM && ! defined INCLUDE_ALLOW_VMIROM
#error "The surrounding include file is not allowed in vmirom."
#endif
diff --git a/open-vm-tools/lib/include/timeutil.h b/open-vm-tools/lib/include/timeutil.h
index 6ae892ff..410712fb 100644
--- a/open-vm-tools/lib/include/timeutil.h
+++ b/open-vm-tools/lib/include/timeutil.h
@@ -50,6 +50,10 @@ typedef struct TimeUtil_Date {
unsigned int second; /* [0, 61] (for leap seconds) */
} TimeUtil_Date;
+typedef struct TimeUtil_TimeOfDay {
+ unsigned long seconds;
+ unsigned long useconds;
+} TimeUtil_TimeOfDay;
typedef struct TimeUtil_Expiration {
/*
@@ -93,6 +97,8 @@ EXTERN void TimeUtil_DaysAdd(TimeUtil_Date *d, // IN/OUT
EXTERN void TimeUtil_PopulateWithCurrent(Bool local, // IN
TimeUtil_Date *d); // OUT
+EXTERN void TimeUtil_GetTimeOfDay(TimeUtil_TimeOfDay *d); // OUT
+
EXTERN unsigned int TimeUtil_DaysLeft(TimeUtil_Date const *d); // IN
EXTERN Bool TimeUtil_ExpirationLowerThan(TimeUtil_Expiration const *left, // IN
diff --git a/open-vm-tools/lib/include/unicode.h b/open-vm-tools/lib/include/unicode.h
index 8aa91071..143f7c23 100644
--- a/open-vm-tools/lib/include/unicode.h
+++ b/open-vm-tools/lib/include/unicode.h
@@ -28,7 +28,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
// Start here: string creation, destruction, and encoding conversion.
diff --git a/open-vm-tools/lib/include/unicodeBase.h b/open-vm-tools/lib/include/unicodeBase.h
index df703b09..2d4fb353 100644
--- a/open-vm-tools/lib/include/unicodeBase.h
+++ b/open-vm-tools/lib/include/unicodeBase.h
@@ -28,7 +28,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
#ifdef __cplusplus
diff --git a/open-vm-tools/lib/include/unicodeOperations.h b/open-vm-tools/lib/include/unicodeOperations.h
index 8770ff2c..7502e447 100644
--- a/open-vm-tools/lib/include/unicodeOperations.h
+++ b/open-vm-tools/lib/include/unicodeOperations.h
@@ -41,7 +41,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
#include <string.h>
diff --git a/open-vm-tools/lib/include/unicodeTransforms.h b/open-vm-tools/lib/include/unicodeTransforms.h
index dfd02694..1b0df430 100644
--- a/open-vm-tools/lib/include/unicodeTransforms.h
+++ b/open-vm-tools/lib/include/unicodeTransforms.h
@@ -32,7 +32,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
#include "unicodeTypes.h"
diff --git a/open-vm-tools/lib/include/unicodeTypes.h b/open-vm-tools/lib/include/unicodeTypes.h
index d0b0b3c9..0af96dd1 100644
--- a/open-vm-tools/lib/include/unicodeTypes.h
+++ b/open-vm-tools/lib/include/unicodeTypes.h
@@ -29,7 +29,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
diff --git a/open-vm-tools/lib/include/vm_assert.h b/open-vm-tools/lib/include/vm_assert.h
index 09859b98..795fc473 100644
--- a/open-vm-tools/lib/include/vm_assert.h
+++ b/open-vm-tools/lib/include/vm_assert.h
@@ -74,7 +74,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/vm_atomic.h b/open-vm-tools/lib/include/vm_atomic.h
index 67be1fa8..9ac08d81 100644
--- a/open-vm-tools/lib/include/vm_atomic.h
+++ b/open-vm-tools/lib/include/vm_atomic.h
@@ -43,7 +43,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
diff --git a/open-vm-tools/lib/include/vm_basic_asm.h b/open-vm-tools/lib/include/vm_basic_asm.h
index 3a3861f1..da0488c7 100644
--- a/open-vm-tools/lib/include/vm_basic_asm.h
+++ b/open-vm-tools/lib/include/vm_basic_asm.h
@@ -45,7 +45,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86.h b/open-vm-tools/lib/include/vm_basic_asm_x86.h
index b266715e..4735c32f 100644
--- a/open-vm-tools/lib/include/vm_basic_asm_x86.h
+++ b/open-vm-tools/lib/include/vm_basic_asm_x86.h
@@ -43,7 +43,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h
index 75593694..b9e90324 100644
--- a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h
+++ b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h
@@ -47,7 +47,6 @@
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
#define INCLUDE_ALLOW_VMCORE
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
#ifndef VM_X86_64
diff --git a/open-vm-tools/lib/include/vm_basic_defs.h b/open-vm-tools/lib/include/vm_basic_defs.h
index d4c5aa49..ab3b5268 100644
--- a/open-vm-tools/lib/include/vm_basic_defs.h
+++ b/open-vm-tools/lib/include/vm_basic_defs.h
@@ -71,7 +71,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/vm_basic_math.h b/open-vm-tools/lib/include/vm_basic_math.h
index c8c204c6..1b8b9586 100644
--- a/open-vm-tools/lib/include/vm_basic_math.h
+++ b/open-vm-tools/lib/include/vm_basic_math.h
@@ -29,7 +29,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/vm_basic_types.h b/open-vm-tools/lib/include/vm_basic_types.h
index 87ae68c5..70b0a4d0 100644
--- a/open-vm-tools/lib/include/vm_basic_types.h
+++ b/open-vm-tools/lib/include/vm_basic_types.h
@@ -73,7 +73,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMK_MODULE
diff --git a/open-vm-tools/lib/include/vm_product.h b/open-vm-tools/lib/include/vm_product.h
index 9a35b5e7..90c87be2 100644
--- a/open-vm-tools/lib/include/vm_product.h
+++ b/open-vm-tools/lib/include/vm_product.h
@@ -24,7 +24,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMCORE
#include "includeCheck.h"
diff --git a/open-vm-tools/lib/include/vm_tools_version.h b/open-vm-tools/lib/include/vm_tools_version.h
index 5772f88d..5a76c375 100644
--- a/open-vm-tools/lib/include/vm_tools_version.h
+++ b/open-vm-tools/lib/include/vm_tools_version.h
@@ -25,7 +25,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMCORE
diff --git a/open-vm-tools/lib/include/vm_version.h b/open-vm-tools/lib/include/vm_version.h
index dc01a814..2d2f3bf2 100644
--- a/open-vm-tools/lib/include/vm_version.h
+++ b/open-vm-tools/lib/include/vm_version.h
@@ -24,7 +24,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMKDRIVERS
#define INCLUDE_ALLOW_VMCORE
diff --git a/open-vm-tools/lib/include/vmware.h b/open-vm-tools/lib/include/vmware.h
index 84061c2d..6568f5f0 100644
--- a/open-vm-tools/lib/include/vmware.h
+++ b/open-vm-tools/lib/include/vmware.h
@@ -71,7 +71,6 @@
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/lib/include/x86cpuid.h b/open-vm-tools/lib/include/x86cpuid.h
index 4d4e45af..a509fb6e 100644
--- a/open-vm-tools/lib/include/x86cpuid.h
+++ b/open-vm-tools/lib/include/x86cpuid.h
@@ -40,7 +40,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_DISTRIBUTE
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMCORE
diff --git a/open-vm-tools/lib/include/x86cpuid_asm.h b/open-vm-tools/lib/include/x86cpuid_asm.h
index 18f5ee0a..c3011ca7 100644
--- a/open-vm-tools/lib/include/x86cpuid_asm.h
+++ b/open-vm-tools/lib/include/x86cpuid_asm.h
@@ -43,7 +43,6 @@
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/lib/misc/timeutil.c b/open-vm-tools/lib/misc/timeutil.c
index 02a16ef3..583feb2e 100644
--- a/open-vm-tools/lib/misc/timeutil.c
+++ b/open-vm-tools/lib/misc/timeutil.c
@@ -522,6 +522,73 @@ TimeUtil_PopulateWithCurrent(Bool local, // IN
/*
+ *-----------------------------------------------------------------------------
+ *
+ * TimeUtil_GetTimeOfDay --
+ *
+ * Get the current time for local timezone in seconds and micro-seconds.
+ * same as gettimeofday on posix systems. Time is returned in the 'time'
+ * variable.
+ *
+ * Results:
+ * void
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+TimeUtil_GetTimeOfDay(TimeUtil_TimeOfDay *timeofday)
+{
+
+#ifdef _WIN32
+ FILETIME ft;
+ uint64 tmptime = 0;
+
+ ASSERT(timeofday != NULL);
+
+ /*
+ * May need to use QueryPerformanceCounter API if we need more
+ * refinement/accuracy than what we are doing below.
+ */
+
+ NOT_TESTED();
+
+ // Get the system time in UTC format.
+ GetSystemTimeAsFileTime(&ft);
+
+ // Convert ft structure to a uint64 containing the # of 100 ns from UTC.
+ tmptime |= ft.dwHighDateTime;
+ tmptime <<= 32;
+ tmptime |= ft.dwLowDateTime;
+
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+ // Convert file time to unix epoch.
+ tmptime -= DELTA_EPOCH_IN_MICROSECS;
+ // convert into microseconds (since the return is in 100 nseconds).
+ tmptime /= 10;
+ // Get the seconds and microseconds in the timeofday
+ timeofday->seconds = (unsigned long)(tmptime / 1000000UL);
+ timeofday->useconds = (unsigned long)(tmptime % 1000000UL);
+
+
+#undef DELTA_EPOCH_IN_MICROSECS
+#else
+ struct timeval curTime;
+
+ ASSERT(timeofday != NULL);
+
+ gettimeofday(&curTime, NULL);
+ timeofday->seconds = (unsigned long) curTime.tv_sec;
+ timeofday->useconds = (unsigned long) curTime.tv_usec;
+#endif // _WIN32
+
+}
+
+
+/*
*----------------------------------------------------------------------
*
* TimeUtil_DaysLeft --
diff --git a/open-vm-tools/modules/freebsd/vmhgfs/sha1.h b/open-vm-tools/modules/freebsd/vmhgfs/sha1.h
index 483f1c5e..77c2a208 100644
--- a/open-vm-tools/modules/freebsd/vmhgfs/sha1.h
+++ b/open-vm-tools/modules/freebsd/vmhgfs/sha1.h
@@ -28,7 +28,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_VMCORE
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
/* for uint32 */
diff --git a/open-vm-tools/modules/freebsd/vmxnet/if_vxn.c b/open-vm-tools/modules/freebsd/vmxnet/if_vxn.c
index caf15f4b..cd1f78f1 100644
--- a/open-vm-tools/modules/freebsd/vmxnet/if_vxn.c
+++ b/open-vm-tools/modules/freebsd/vmxnet/if_vxn.c
@@ -23,6 +23,7 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/socket.h>
+#include <sys/systm.h>
/*
* FreeBSD 5.3 introduced an MP-safe (multiprocessor-safe) network stack.
@@ -433,6 +434,10 @@ vxn_attach(device_t dev)
VXN_IF_FREE(sc);
}
+ pci_disable_io(dev, SYS_RES_IOPORT);
+ pci_disable_busmaster(dev);
+ VXN_MTX_DESTROY(&sc->vxn_mtx);
+
done:
splx(s);
@@ -475,12 +480,14 @@ vxn_detach(device_t dev)
/*
* Cleanup - release resources and memory
*/
+ VXN_IF_FREE(sc);
contigfree(sc->vxn_dd, sc->vxn_dd->length, M_DEVBUF);
bus_teardown_intr(dev, sc->vxn_irq, sc->vxn_intrhand);
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->vxn_irq);
bus_release_resource(dev, SYS_RES_IOPORT, VXN_PCIR_MAPS, sc->vxn_io);
+ pci_disable_io(dev, SYS_RES_IOPORT);
+ pci_disable_busmaster(dev);
VXN_MTX_DESTROY(&sc->vxn_mtx);
- VXN_IF_FREE(sc);
splx(s);
return 0;
@@ -1135,7 +1142,7 @@ vxn_rx(vxn_softc_t *sc)
m_new = NULL;
}
}
-
+
/*
* replace the current mbuf in the descriptor with the new one
* and pass the packet up to the kernel
@@ -1255,9 +1262,14 @@ vxn_init_rings(vxn_softc_t *sc)
*/
for (i = 0; i < sc->vxn_num_rx_bufs; i++) {
struct mbuf *m_new = NULL;
-
+
+ /*
+ * Allocate an mbuf and initialize it to contain a packet header and
+ * internal data.
+ */
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new != NULL) {
+ /* Allocate and attach an mbuf cluster to mbuf. */
MCLGET(m_new, M_DONTWAIT);
if (m_new->m_flags & M_EXT) {
m_adj(m_new, ETHER_ALIGN);
@@ -1267,12 +1279,16 @@ vxn_init_rings(vxn_softc_t *sc)
sc->vxn_rx_buffptr[i] = m_new;
sc->vxn_rx_ring[i].ownership = VMXNET2_OWNERSHIP_NIC;
} else {
+ /*
+ * Allocation and attachment of mbuf clusters failed.
+ */
m_freem(m_new);
m_new = NULL;
- return ENOMEM;
+ goto err_release_ring;
}
} else {
- return ENOMEM;
+ /* Allocation of mbuf failed. */
+ goto err_release_ring;
}
}
@@ -1299,6 +1315,19 @@ vxn_init_rings(vxn_softc_t *sc)
sc->vxn_rings_allocated = 1;
return 0;
+err_release_ring:
+ /*
+ * Clearup already allocated mbufs and attached clusters.
+ */
+ for (--i; i >= 0; i--) {
+ m_freem(sc->vxn_rx_buffptr[i]);
+ sc->vxn_rx_buffptr[i] = NULL;
+ sc->vxn_rx_ring[i].paddr = 0;
+ sc->vxn_rx_ring[i].bufferLength = 0;
+ sc->vxn_rx_ring[i].ownership = 0;
+ }
+ return ENOMEM;
+
}
/*
diff --git a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h
index 5885697c..649cab47 100644
--- a/open-vm-tools/modules/linux/pvscsi/scsi_defs.h
+++ b/open-vm-tools/modules/linux/pvscsi/scsi_defs.h
@@ -28,7 +28,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/modules/linux/shared/compat_version.h b/open-vm-tools/modules/linux/shared/compat_version.h
index baf9634e..a8f04b85 100644
--- a/open-vm-tools/modules/linux/shared/compat_version.h
+++ b/open-vm-tools/modules/linux/shared/compat_version.h
@@ -22,7 +22,6 @@
#define INCLUDE_ALLOW_VMMON
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMCORE
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_DISTRIBUTE
#include "includeCheck.h"
diff --git a/open-vm-tools/modules/linux/shared/driver-config.h b/open-vm-tools/modules/linux/shared/driver-config.h
index 95f27de7..62e3fd61 100644
--- a/open-vm-tools/modules/linux/shared/driver-config.h
+++ b/open-vm-tools/modules/linux/shared/driver-config.h
@@ -29,7 +29,6 @@
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMMON
#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
#include <linux/autoconf.h>
diff --git a/open-vm-tools/modules/shared/vmxnet/net_sg.h b/open-vm-tools/modules/shared/vmxnet/net_sg.h
index 9a33653c..77410e09 100644
--- a/open-vm-tools/modules/shared/vmxnet/net_sg.h
+++ b/open-vm-tools/modules/shared/vmxnet/net_sg.h
@@ -43,7 +43,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_VMNIXMOD
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
diff --git a/open-vm-tools/modules/shared/vmxnet/vmnet_def.h b/open-vm-tools/modules/shared/vmxnet/vmnet_def.h
index 6c6a3d71..f79e8efe 100644
--- a/open-vm-tools/modules/shared/vmxnet/vmnet_def.h
+++ b/open-vm-tools/modules/shared/vmxnet/vmnet_def.h
@@ -45,7 +45,6 @@
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
/*
diff --git a/open-vm-tools/modules/solaris/vmhgfs/sha1.h b/open-vm-tools/modules/solaris/vmhgfs/sha1.h
index f1787a2e..83b3b3df 100644
--- a/open-vm-tools/modules/solaris/vmhgfs/sha1.h
+++ b/open-vm-tools/modules/solaris/vmhgfs/sha1.h
@@ -26,7 +26,6 @@
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_VMCORE
-#define INCLUDE_ALLOW_VMNIXMOD
#include "includeCheck.h"
/* for uint32 */