From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:10:12 +0000 (-0700) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2013.09.16-1328054~129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a8d296cc68cf6687f9cb8084669aa585ec8da0a;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . File locking: tolerate another race in FileUnlockIntrinsic . Add util function for getting the epoch from a TimeUtil_Date . Add LRO defines for VMXNET3 . changes in shared code that don't affect open-vm-tools functionality Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/file/fileLockPrimitive.c b/open-vm-tools/lib/file/fileLockPrimitive.c index 5ba7de0d2..cc0308b66 100644 --- a/open-vm-tools/lib/file/fileLockPrimitive.c +++ b/open-vm-tools/lib/file/fileLockPrimitive.c @@ -1031,19 +1031,28 @@ FileUnlockIntrinsic(FileLockToken *tokenPtr) // IN: } else { ASSERT(FileIO_IsValid(&tokenPtr->u.mandatory.lockFd)); - if (FileIO_CloseAndUnlink(&tokenPtr->u.mandatory.lockFd)) { - /* - * Should succeed, but there is an unavoidable race: - * close() must preceed unlink(), but another locker could acquire - * lock between close() and unlink(). Solution: treat EBUSY as - * success. - */ - if (Err_Errno() == EBUSY) { - LOG(0, ("Tolerating EBUSY on unlink of advisory lock at %s\n", - UTF8(tokenPtr->pathName))); - } else { - err = Err_Errno(); - } + if (FileIO_CloseAndUnlink(&tokenPtr->u.mandatory.lockFd)) { + /* + * Should succeed, but there is an unavoidable race: + * close() must preceed unlink(), but another thread could touch + * the file between close() and unlink(). We only worry about other + * FileLock-like manipulations; the advisory lock file should not + * experience any name collisions. Treat races as success. + * Specific errors: + * EBUSY: other locked file + * ENOENT: other locked + unlocked (w/ implicit unlink) file + */ + if (Err_Errno() == EBUSY || Err_Errno() == ENOENT) { + LOG(0, ("Tolerating %s on unlink of advisory lock at %s\n", + Err_Errno() == EBUSY ? "EBUSY" : "ENOENT", + UTF8(tokenPtr->pathName))); + } else { + err = Err_Errno(); + if (vmx86_debug) { + Log(LGPFX" %s failed for advisory lock '%s': %s\n", __FUNCTION__, + UTF8(tokenPtr->pathName), strerror(err)); + } + } } } diff --git a/open-vm-tools/lib/include/timeutil.h b/open-vm-tools/lib/include/timeutil.h index e9b4b813a..e90c0c62c 100644 --- a/open-vm-tools/lib/include/timeutil.h +++ b/open-vm-tools/lib/include/timeutil.h @@ -86,7 +86,7 @@ typedef struct TimeUtil_Expiration { } TimeUtil_Expiration; -time_t TimeUtil_MakeTime(const TimeUtil_Date *d); +time_t TimeUtil_MakeTime(const TimeUtil_Date *d); // IN Bool TimeUtil_StringToDate(TimeUtil_Date *d, // IN/OUT char const *date); // IN: 'YYYYMMDD' or 'YYYY/MM/DD' or 'YYYY-MM-DD' @@ -132,4 +132,6 @@ Bool TimeUtil_UTCTimeToSystemTime(const __time64_t utcTime, // IN int TimeUtil_GetLocalWindowsTimeZoneIndexAndName(char **ptzName); +time_t TimeUtil_SecondsSinceEpoch(TimeUtil_Date *d); // IN + #endif // _TIMEUTIL_H_ diff --git a/open-vm-tools/lib/include/vm_product_versions.h b/open-vm-tools/lib/include/vm_product_versions.h index 76cc00555..19be23944 100644 --- a/open-vm-tools/lib/include/vm_product_versions.h +++ b/open-vm-tools/lib/include/vm_product_versions.h @@ -207,6 +207,7 @@ #define HOSTD_VERSION "e.x.p" #define RECOVERYLIBS_VERSION "2.0.0" #define PRECHECK_VERSION "e.x.p" +#define VIEW_FEATUREPACK_VERSION "5.2.0" #ifndef MAKESTR @@ -325,7 +326,7 @@ * a parameter that no longer match the content of the dormant license * file. */ -#define PRODUCT_MAC_DESKTOP_VERSION_STRING_FOR_LICENSE "5.0" +#define PRODUCT_MAC_DESKTOP_VERSION_STRING_FOR_LICENSE "6.0" #if defined(VMX86_TOOLS) /* This product doesn't use a license */ diff --git a/open-vm-tools/lib/include/win32util.h b/open-vm-tools/lib/include/win32util.h index c1a99a17d..167036c74 100644 --- a/open-vm-tools/lib/include/win32util.h +++ b/open-vm-tools/lib/include/win32util.h @@ -67,7 +67,6 @@ Unicode W32Util_GetCommonAppDataFilePath(ConstUnicode fileName); Unicode W32Util_GetVmwareCommonAppDataFilePath(ConstUnicode fileName); Unicode W32Util_GetMyDocumentPath(void); -Unicode W32Util_GetMyVideoPath(BOOL myDocumentsOnFail); Unicode W32Util_GetDefaultVMPath(ConstUnicode pref); Unicode W32Util_GetInstalledFilePath(ConstUnicode fileName); diff --git a/open-vm-tools/lib/misc/timeutil.c b/open-vm-tools/lib/misc/timeutil.c index 34545b622..bbd892c5c 100644 --- a/open-vm-tools/lib/misc/timeutil.c +++ b/open-vm-tools/lib/misc/timeutil.c @@ -25,6 +25,7 @@ #include "safetime.h" #include "unicode.h" +#include #if defined(_WIN32) # include @@ -130,7 +131,7 @@ TimeUtil_MakeTime(const TimeUtil_Date *d) // IN * while the time will be left unmodified. * The string 'date' needs to be in the format of 'YYYYMMDD' or * 'YYYY/MM/DD' or 'YYYY-MM-DD'. - * Unsuccesful initialization will leave the 'd' argument unmodified. + * Unsuccessful initialization will leave the 'd' argument unmodified. * * Results: * TRUE or FALSE. @@ -1546,3 +1547,59 @@ static int Win32TimeUtilLookupZoneIndex(const char* targetName) return timeZoneIndex; } #endif // _WIN32 + + +/* + *---------------------------------------------------------------------- + * + * TimeUtil_SecondsSinceEpoch -- + * + * Converts a date into the the number of seconds since the unix epoch in UTC. + * + * Parameters: + * date to be converted. + * + * Results: + * Returns the numbers of seconds since the unix epoch. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +time_t +TimeUtil_SecondsSinceEpoch(TimeUtil_Date *d) // IN +{ + const int DAY_IN_SECONDS = 60*60*24; + struct tm tmval1970 = {0}; + struct tm tmval = {0}; + + /* + * We can't handle negative time. + */ + if (d->year < 1970) { + ASSERT(0); + return -1; + } + + /* + * Get the localtime for Jan 2nd 1970. We need to get the 2nd because + * if we are in a timezone that is + UTC then mktime will return -1 + * for Jan 1st. + */ + tmval1970.tm_year= 1970 - 1900; + tmval1970.tm_mon = 0; + tmval1970.tm_mday = 2; + + tmval.tm_year = d->year - 1900; + tmval.tm_mon = d->month - 1; + tmval.tm_mday = d->day; + tmval.tm_hour = d->hour; + tmval.tm_min = d->minute; + tmval.tm_sec = d->second; + + /* + * Add back in the day. + */ + return mktime(&tmval) - mktime(&tmval1970) + DAY_IN_SECONDS; +} diff --git a/open-vm-tools/modules/shared/vmxnet/vmnet_def.h b/open-vm-tools/modules/shared/vmxnet/vmnet_def.h index f7f011cbd..d9b75c7a3 100644 --- a/open-vm-tools/modules/shared/vmxnet/vmnet_def.h +++ b/open-vm-tools/modules/shared/vmxnet/vmnet_def.h @@ -107,6 +107,7 @@ #define VMNET_CAP_RESTART_NEG CONST64U(0x400000000000) /* Ability to restart negotiation of link speed/duplexity */ #define VMNET_CAP_LRO CONST64U(0x800000000000) /* Hardware supported LRO */ #define VMNET_CAP_OFFLOAD_ALIGN_ANY CONST64U(0x1000000000000) /* Nic requires no header alignment */ +#define VMNET_CAP_GENERIC_OFFLOAD CONST64U(0x2000000000000) /* Generic hardware offloading (eg. vxlan encap offload and offset based offload) */ #define VMNET_CAP_LEGACY CONST64U(0x8000000000000000) /* Uplink is compatible with vmklinux drivers */ #endif // _VMNET_DEF_H_ diff --git a/open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h b/open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h index 3e63afd7a..eb9af751f 100644 --- a/open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h +++ b/open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h @@ -421,6 +421,7 @@ typedef union Vmxnet3_GenericDesc { /* completion descriptor types */ #define VMXNET3_CDTYPE_TXCOMP 0 /* Tx Completion Descriptor */ #define VMXNET3_CDTYPE_RXCOMP 3 /* Rx Completion Descriptor */ +#define VMXNET3_CDTYPE_RXCOMP_LRO 4 /* Rx Completion Descriptor for LRO */ #define VMXNET3_GOS_BITS_UNK 0 /* unknown */ #define VMXNET3_GOS_BITS_32 1