]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Internal branch sync. Included in this change:
authorVMware, Inc <>
Wed, 18 Sep 2013 03:10:12 +0000 (20:10 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 21 Sep 2013 22:55:50 +0000 (15:55 -0700)
. 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 <dtor@vmware.com>
open-vm-tools/lib/file/fileLockPrimitive.c
open-vm-tools/lib/include/timeutil.h
open-vm-tools/lib/include/vm_product_versions.h
open-vm-tools/lib/include/win32util.h
open-vm-tools/lib/misc/timeutil.c
open-vm-tools/modules/shared/vmxnet/vmnet_def.h
open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h

index 5ba7de0d2b6cd79ff027eb09157b047ae56c4c33..cc0308b660cf01b64b1290dcdc40d785e83fc520 100644 (file)
@@ -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));
+            }
+         }
       }
    }
 
index e9b4b813a9e6f19539c9aa4330968f1a3d883680..e90c0c62c60db84bc1dea9cf5dcb6c8e9f9eb3c8 100644 (file)
@@ -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_
index 76cc00555a40b89cc6ef99be06026c6efbc3b281..19be23944928967f75444bf9db08148b18e727dd 100644 (file)
 #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
  * 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 */
index c1a99a17d0ff35168613e31047e63feeafe169da..167036c746d1793c38037d36eb98d04f20b1c2f0 100644 (file)
@@ -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);
index 34545b6220472484920a22ae78e8615f6589b9cf..bbd892c5c60e7e35cac6cfbb6f5956a2e870de25 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "safetime.h"
 #include "unicode.h"
+#include <stdio.h>
 
 #if defined(_WIN32)
 #  include <wtypes.h>
@@ -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;
+}
index f7f011cbda0530880ae756c543cfb5d55cd2ef4f..d9b75c7a375ef763aa75ab27b9b15da345013055 100644 (file)
 #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_
index 3e63afd7ac1197b348cdcb4d8533d00fc6f67020..eb9af751f6271ebbfab861860481d82527811358 100644 (file)
@@ -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