]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Thu, 27 Oct 2011 18:16:58 +0000 (11:16 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 27 Oct 2011 18:16:58 +0000 (11:16 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
13 files changed:
open-vm-tools/lib/backdoor/backdoorGcc64.c
open-vm-tools/lib/file/file.c
open-vm-tools/lib/file/fileIO.c
open-vm-tools/lib/file/fileInt.h
open-vm-tools/lib/file/fileLockPrimitive.c
open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/include/file.h
open-vm-tools/lib/include/fileIO.h
open-vm-tools/lib/include/vm_version.h
open-vm-tools/lib/include/vmci_defs.h
open-vm-tools/modules/linux/shared/vmci_defs.h
open-vm-tools/modules/linux/vmci/common/vmciEvent.c
open-vm-tools/modules/shared/vmxnet/eth_public.h

index 48cd5b7c72f7db72709587217c2881f27e6bd91b..6453b7b61c991197d2275a60c365ad6e564d36d5 100644 (file)
@@ -139,7 +139,7 @@ Backdoor_InOut(Backdoor_proto *myBp) // IN/OUT
 void
 BackdoorHbIn(Backdoor_proto_hb *myBp) // IN/OUT
 {
-   uint32 dummy;
+   uint64 dummy;
 
    __asm__ __volatile__(
         "pushq %%rbp"           "\n\t"
index 845e183ed9fe2128b0aee0a3cb4c0f6e245e179d..5977a0bb94db1fa97826c631613c24fff6ff94b1 100644 (file)
@@ -1286,7 +1286,7 @@ File_Move(ConstUnicode oldFile,  // IN:
    Bool ret;
    Bool duringRename;
 
-   if (FileRename(oldFile, newFile) == 0) {
+   if (File_Rename(oldFile, newFile) == 0) {
       duringRename = TRUE;
       ret = TRUE;
       Err_SetErrno(0);
@@ -1356,7 +1356,7 @@ File_MoveTree(ConstUnicode srcName,   // IN:
       return FALSE;
    }
 
-   if (FileRename(srcName, dstName) == 0) {
+   if (File_Rename(srcName, dstName) == 0) {
       ret = TRUE;
    } else {
       struct stat statbuf;
@@ -2349,3 +2349,40 @@ File_Rotate(const char *fileName,  // IN: original file
 
    free(baseName);
 }
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * File_GetFSMountInfo --
+ *
+ *      Platform-independent wrapper around File_GetVMFSMountInfo
+ *
+ * Results:
+ *      On failure return -1.  Otherwise, return fsType, version,
+ *      remoteIP, remoteMountPoint, and localMountPoint.
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+int 
+File_GetFSMountInfo(ConstUnicode pathName,
+                    char **fsType,
+                    uint32 *version,
+                    char **remoteIP,
+                    char **remoteMountPoint,
+                    char **localMountPoint)
+{
+#if defined VMX86_SERVER
+   return  File_GetVMFSMountInfo(pathName, fsType, version,
+                                 remoteIP, remoteMountPoint,
+                                 localMountPoint);
+#else 
+   return -1;
+#endif
+}
+
+
index 6235ff4e7a6839a8b061b38e03380f4eac55dec9..b826be83c0e1986bbd294b63c67c3307c9c8783c 100644 (file)
@@ -425,6 +425,39 @@ FileIO_Filename(FileIODescriptor *fd)  // IN:
 }
 
 
+/*
+ *----------------------------------------------------------------------
+ *
+ * FileIO_CloseAndUnlink
+ *
+ *      Closes and unlinks the file associated with a FileIODescriptor.
+ *
+ * Results:
+ *      TRUE: An error occurred.
+ *      FALSE: The file was closed and unlinked.
+ *
+ * Side effects:
+ *      File is probably closed and unlinked.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Bool
+FileIO_CloseAndUnlink(FileIODescriptor *fd)  // IN:
+{
+   Unicode path;
+   Bool ret;
+
+   ASSERT(fd);
+
+   path = Unicode_Duplicate(fd->fileName);
+   ret = FileIO_Close(fd) || File_Unlink(path);
+   Unicode_Free(path);
+
+   return ret;
+}
+
+
 #if defined(_WIN32) || defined(__linux__) || defined(__APPLE__) || \
     defined(__FreeBSD__) || defined(sun)
 /*
index 5abf67012dc68f574eba10b380bb28a3b2570853..6b1f75a5669f6ed5190680f24f8a7f122d775678 100644 (file)
@@ -116,10 +116,6 @@ int FileAttributesRetry(ConstUnicode pathName,
                         uint32 msecMaxWaitTime,
                         FileData *fileData);
 
-int FileRenameRetry(ConstUnicode fromPath,
-                    ConstUnicode toPath,
-                    uint32 msecMaxWaitTime);
-
 int FileDeletionRetry(ConstUnicode pathName,
                       Bool handleLink,
                       uint32 msecMaxWaitTime);
@@ -136,7 +132,6 @@ int FileListDirectoryRetry(ConstUnicode pathName,
                            Unicode **ids);
 
 #define FileAttributes(a, b)       FileAttributesRetry((a), 0, (b))
-#define FileRename(a, b)           FileRenameRetry((a), (b), 0)
 #define FileDeletion(a, b)         FileDeletionRetry((a), (b), 0)
 #define FileCreateDirectory(a, b)  FileCreateDirectoryRetry((a), (b), 0)
 #define FileRemoveDirectory(a)     FileRemoveDirectoryRetry((a), 0)
@@ -146,7 +141,7 @@ int FileListDirectoryRetry(ConstUnicode pathName,
 #define FileAttributesRobust(a, b) \
                     FileAttributesRetry((a), FILE_MAX_WAIT_TIME_MS, (b))
 #define FileRenameRobust(a, b) \
-                    FileRenameRetry((a), (b), FILE_MAX_WAIT_TIME_MS)
+                    File_RenameRetry((a), (b), FILE_MAX_WAIT_TIME_MS)
 #define FileDeletionRobust(a, b) \
                     FileDeletionRetry((a), (b), FILE_MAX_WAIT_TIME_MS)
 #define FileCreateDirectoryRobust(a, b) \
@@ -166,9 +161,6 @@ char *FilePosixGetBlockDevice(char const *path);
 int FileAttributes(ConstUnicode pathName,
                    FileData *fileData);
 
-int FileRename(ConstUnicode fromPath,
-               ConstUnicode toPath);
-
 int FileDeletion(ConstUnicode pathName,
                  Bool handleLink);
 
@@ -179,7 +171,7 @@ int FileRemoveDirectory(ConstUnicode pathName);
 
 #define FileListDirectoryRobust(a, b)    File_ListDirectory((a), (b))
 #define FileAttributesRobust(a, b)       FileAttributes((a), (b))
-#define FileRenameRobust(a, b)           FileRename((a), (b))
+#define FileRenameRobust(a, b)           File_Rename((a), (b))
 #define FileDeletionRobust(a, b)         FileDeletion((a), (b))
 #define FileCreateDirectoryRobust(a, b)  FileCreateDirectory((a), (b))
 #define FileRemoveDirectoryRobust(a)     FileRemoveDirectory((a))
index ac21625148c767b92f5a8f151e2d32763e15f814..79bc72b90f93442d0d9d29fd83fb18ec43ec07a1 100644 (file)
@@ -1474,7 +1474,7 @@ FileLockCreateMemberFile(FileIODescriptor *desc,       // IN:
       return EIO;
    }
 
-   err = FileRename(entryFilePath, memberFilePath);
+   err = File_Rename(entryFilePath, memberFilePath);
 
    if (err != 0) {
       Warning(LGPFX" %s FileRename of '%s' to '%s' failed: %s\n",
index 14046806beea2752458088bf96ba3478dd764100..96d6a01826881619e4f52999f698ac2d2db60dec 100644 (file)
@@ -26,6 +26,7 @@
 
 #if defined(__FreeBSD__)
 # include <sys/param.h>
+# include <sys/mount.h>
 #else
 # if !defined(__APPLE__)
 #  include <sys/vfs.h>
@@ -147,7 +148,7 @@ FileRemoveDirectory(ConstUnicode pathName)  // IN:
 /*
  *-----------------------------------------------------------------------------
  *
- * FileRename --
+ * File_Rename --
  *
  *     Rename a file.
  *
@@ -162,13 +163,22 @@ FileRemoveDirectory(ConstUnicode pathName)  // IN:
  */
 
 int
-FileRename(ConstUnicode oldName,  // IN:
-           ConstUnicode newName)  // IN:
+File_Rename(ConstUnicode oldName,  // IN:
+            ConstUnicode newName)  // IN:
 {
    return (Posix_Rename(oldName, newName) == -1) ? errno : 0;
 }
 
 
+int
+File_RenameRetry(ConstUnicode oldFile,    // IN:
+                 ConstUnicode newFile,    // IN:
+                 uint32 msecMaxWaitTime)  // IN: Unused.
+{
+   return File_Rename(oldFile, newFile);
+}
+
+
 /*
  *----------------------------------------------------------------------
  *
@@ -1792,6 +1802,9 @@ FilePosixNearestExistingAncestor(char const *path)  // IN: File path
 }
 
 
+#endif /* !FreeBSD && !sun */
+
+
 /*
  *----------------------------------------------------------------------------
  *
@@ -1824,8 +1837,10 @@ File_IsSameFile(ConstUnicode path1,  // IN:
 {
    struct stat st1;
    struct stat st2;
+#if !defined(sun)  // Solaris does not have statfs
    struct statfs stfs1;
    struct statfs stfs2;
+#endif
 
    ASSERT(path1);
    ASSERT(path2);
@@ -1865,6 +1880,7 @@ File_IsSameFile(ConstUnicode path1,  // IN:
       return TRUE;
    }
 
+#if !defined(sun)  // Solaris does not have statfs
    if (Posix_Statfs(path1, &stfs1) != 0) {
       return FALSE;
    }
@@ -1873,7 +1889,7 @@ File_IsSameFile(ConstUnicode path1,  // IN:
       return FALSE;
    }
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__) 
    if ((stfs1.f_flags & MNT_LOCAL) && (stfs2.f_flags & MNT_LOCAL)) {
       return TRUE;
    }
@@ -1882,6 +1898,7 @@ File_IsSameFile(ConstUnicode path1,  // IN:
        (stfs2.f_type != NFS_SUPER_MAGIC)) {
       return TRUE;
    }
+#endif
 #endif
 
    /*
@@ -1913,9 +1930,6 @@ File_IsSameFile(ConstUnicode path1,  // IN:
 }
 
 
-#endif /* !FreeBSD && !sun */
-
-
 /*
  *-----------------------------------------------------------------------------
  *
index ca90cc867a10b5c2222094af912d6fbd58f5a658..d97a229de69125de02cec6f3a66abb680e9f23d4 100644 (file)
@@ -104,6 +104,7 @@ Bool FileMacos_IsOnSparseDmg(int fd);
 Bool FileMacos_IsSliceDevice(char const *bsdDev);
 
 char *FileMacos_DiskDevToUserFriendlyName(char const *bsdDiskDev);
+char *FileMacos_DiskDevToVolumeName(char const *bsdDiskDev);
 
 char *FileMacos_DiskDeviceToUniqueID(char const *bsdPath);
 char *FileMacos_UniqueIDToDiskDevice(char const *identifier);
@@ -276,6 +277,13 @@ Bool File_CopyTree(ConstUnicode srcName,
 Bool File_Replace(ConstUnicode oldFile,
                   ConstUnicode newFile);
 
+int File_Rename(ConstUnicode oldFile,
+                ConstUnicode newFile);
+
+int File_RenameRetry(ConstUnicode oldFile,
+                     ConstUnicode newFile,
+                     uint32 msecMaxWaitTime);
+
 Bool File_Move(ConstUnicode oldFile,
                ConstUnicode newFile,
                Bool *asRename);
@@ -285,6 +293,13 @@ void File_Rotate(const char *pathName,
                  Bool noRename,
                  char **newFileName);
 
+int File_GetFSMountInfo(ConstUnicode pathName,
+                        char **fsType,
+                        uint32 *version,
+                        char **remoteIP,
+                        char **remoteMountPoint,
+                        char **localMountPoint);
+
 /* Get size only for regular file. */
 int64 File_GetSize(ConstUnicode pathName);
 
index 8f932adb38681b938d35cf6280d8c903e941bb33..c4eeb7ca6943f8bee60663850525ea13a17b6a5c 100644 (file)
@@ -350,6 +350,8 @@ int64   FileIO_GetSizeByPath(ConstUnicode pathName);
 
 Bool    FileIO_Close(FileIODescriptor *file);
 
+Bool    FileIO_CloseAndUnlink(FileIODescriptor *file);
+
 uint32  FileIO_GetFlags(FileIODescriptor *file);
 
 Bool    FileIO_GetVolumeSectorSize(const char *name,
index 6e3b47656fc8d610e4cc11eebc2da5d85ae4a6de..e20e994e13004834f06afa12c85a190a044f6fd1 100644 (file)
 #define VMSERVER_VERSION "e.x.p"
 #define WORKSTATION_VERSION_NUMBER "8.0.0" /* this version number should always match real WS version number */
 #define WORKSTATION_VERSION "e.x.p"
+#define WORKSTATION_RELEASE_DESCRIPTION ""
 #define WORKSTATION_ENTERPRISE_VERSION "e.x.p"
 #define ACE_MANAGEMENT_SERVER_VERSION "e.x.p"
 #define MUI_VERSION "4.1.0"
 
 #define USB_ARBITRATOR_VERSION_MAJOR 9
 #define USB_ARBITRATOR_VERSION_MINOR 0
-#define USB_ARBITRATOR_VERSION_Z     38
+#define USB_ARBITRATOR_VERSION_Z     44
 
 #define USB_ARBITRATOR_VERSION_BASE  USB_ARBITRATOR_VERSION_MAJOR.\
                                      USB_ARBITRATOR_VERSION_MINOR
  * USB Arbitrator Component version. This version is used by the linux
  * installer. See USB_ARBITRATOR_COMPONENT_VERSION_NUMBER in mk/defs-onetime.mk
  */
-#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "9.0.38"
+#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "9.0.44"
 
 #ifdef VMX86_VPX
 #define VIM_API_TYPE "VirtualCenter"
index e433f8fff1d1925c13df9036e95568ebf0c295e4..a0e702a09e4b3c9b73c74f05aba65085843a15f1 100644 (file)
@@ -123,10 +123,6 @@ typedef uint32 VMCI_Resource;
 #define VMCI_QUEUEPAIR_ALLOC      10
 #define VMCI_QUEUEPAIR_DETACH     11
 
-/* VMCI reserved host datagram resource IDs */
-/* vsock control channel has resource id 1 */
-#define VMCI_DVFILTER_DATA_CHANNEL  2
-
 /*
  * VMCI_VSOCK_VMX_LOOKUP was assigned to 12 for Fusion 3.0/3.1,
  * WS 7.0/7.1 and ESX 4.1
index a262b60dc47e60388bf4643dec0dfed010dc2f60..21daa90119a46ab3a6e166027eb8bb763df2ec70 100644 (file)
@@ -123,10 +123,6 @@ typedef uint32 VMCI_Resource;
 #define VMCI_QUEUEPAIR_ALLOC      10
 #define VMCI_QUEUEPAIR_DETACH     11
 
-/* VMCI reserved host datagram resource IDs */
-/* vsock control channel has resource id 1 */
-#define VMCI_DVFILTER_DATA_CHANNEL  2
-
 /*
  * VMCI_VSOCK_VMX_LOOKUP was assigned to 12 for Fusion 3.0/3.1,
  * WS 7.0/7.1 and ESX 4.1
index 810bd4196573125d1ac3a44cd273d12a1dcd1486..2f4b35b53859aea018ce7faf3617d4f4c12cf6a9 100644 (file)
@@ -69,6 +69,10 @@ typedef struct VMCIDelayedEventInfo {
    uint8 eventPayload[sizeof(VMCIEventData_Max)];
 } VMCIDelayedEventInfo;
 
+typedef struct VMCIEventRef {
+   VMCISubscription *sub;
+   VMCIListItem   listItem;
+} VMCIEventRef;
 
 /*
  *----------------------------------------------------------------------
@@ -386,11 +390,13 @@ VMCIEventDeliver(VMCIEventMsg *eventMsg)  // IN
    VMCIListItem *iter;
    VMCILockFlags flags;
 
+   VMCIList noDelayList;
+   VMCIList_Init(&noDelayList);
+
    ASSERT(eventMsg);
 
    VMCI_GrabLock_BH(&subscriberLock, &flags);
    VMCIList_Scan(iter, &subscriberArray[eventMsg->eventData.event]) {
-      VMCI_EventData *ed;
       VMCISubscription *cur = VMCIList_Entry(iter, VMCISubscription,
                                              subscriberListItem);
       ASSERT(cur && cur->event == eventMsg->eventData.event);
@@ -419,6 +425,40 @@ VMCIEventDeliver(VMCIEventMsg *eventMsg)  // IN
          }
 
       } else {
+         VMCIEventRef *eventRef;
+
+         /*
+          * To avoid possible lock rank voilation when holding
+          * subscriberLock, we construct a local list of
+          * subscribers and release subscriberLock before
+          * invokes the callbacks. This is similar to delayed
+          * callbacks, but callbacks is invoked right away here.
+          */
+         if ((eventRef = VMCI_AllocKernelMem(sizeof *eventRef,
+                                             (VMCI_MEMORY_ATOMIC |
+                                              VMCI_MEMORY_NONPAGED))) == NULL) {
+            err = VMCI_ERROR_NO_MEM;
+            goto out;
+         }
+
+         VMCIEventGet(cur);
+         eventRef->sub = cur;
+         VMCIList_InitEntry(&eventRef->listItem);
+         VMCIList_Insert(&eventRef->listItem, &noDelayList);
+      }
+   }
+
+out:
+   VMCI_ReleaseLock_BH(&subscriberLock, flags);
+
+   if (!VMCIList_Empty(&noDelayList)) {
+      VMCI_EventData *ed;
+      VMCIListItem *iter2;
+
+      VMCIList_ScanSafe(iter, iter2, &noDelayList) {
+         VMCIEventRef *eventRef = VMCIList_Entry(iter, VMCIEventRef,
+                                                 listItem);
+         VMCISubscription *cur = eventRef->sub;
          uint8 eventPayload[sizeof(VMCIEventData_Max)];
 
          /* We set event data before each callback to ensure isolation. */
@@ -427,12 +467,14 @@ VMCIEventDeliver(VMCIEventMsg *eventMsg)  // IN
                 (size_t)eventMsg->hdr.payloadSize);
          ed = (VMCI_EventData *)eventPayload;
          cur->callback(cur->id, ed, cur->callbackData);
+
+         VMCI_GrabLock_BH(&subscriberLock, &flags);
+         VMCIEventRelease(cur);
+         VMCI_ReleaseLock_BH(&subscriberLock, flags);
+         VMCI_FreeKernelMem(eventRef, sizeof *eventRef);
       }
    }
 
-out:
-   VMCI_ReleaseLock_BH(&subscriberLock, flags);
-
    return err;
 }
 
index 0619375cb81595012588e5e3b057932687c40bfe..d4f60c5bef67c3d436d25019664580140aa77197 100644 (file)
@@ -209,7 +209,7 @@ enum {
    ETH_VMWARE_FRAME_TYPE_INVALID    = 0,
    ETH_VMWARE_FRAME_TYPE_BEACON     = 1,
    ETH_VMWARE_FRAME_TYPE_COLOR      = 2,
-   ETH_VMWARE_FRAME_TYPE_HEARTBEAT  = 3,
+   ETH_VMWARE_FRAME_TYPE_ECHO       = 3,
 };
 
 typedef