]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Wed, 20 Jan 2010 21:26:16 +0000 (13:26 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Wed, 20 Jan 2010 21:26:16 +0000 (13:26 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/foundryMsg/foundryMsg.c
open-vm-tools/lib/foundryMsg/foundryPropertyListCommon.c
open-vm-tools/lib/include/vixCommands.h
open-vm-tools/modules/linux/shared/vmci_infrastructure.h
open-vm-tools/modules/linux/shared/vmci_kernel_if.h
open-vm-tools/modules/linux/vsock/linux/vmciContext.h

index 0987467f868ba4827cee887e071c0b8679562663..c9f532dca21d473e0d64745b984eb0a10382c132 100644 (file)
@@ -1648,3 +1648,95 @@ VixMsg_ParseGenericRequestMsg(const VixCommandGenericRequest *request,  // IN
 
    return err;
 } // VixMsg_ParseGenericRequestMsg
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixMsg_MallocClientData --
+ *
+ *      Allocates the memory needed to copy from a client-provided buffer.
+ *
+ * Results:
+ *      Pointer to allocated memory
+ *
+ * Side effects:
+ *      None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void *
+VixMsg_MallocClientData(size_t size)  // IN
+{
+   return malloc(size);
+} // VixMsg_MallocClientData
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixMsg_ReallocClientData --
+ *
+ *      Reallocates the memory needed to copy from a client-provided buffer.
+ *
+ * Results:
+ *      Pointer to allocated memory
+ *
+ * Side effects:
+ *      Frees memory pointed to by ptr.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void *
+VixMsg_ReallocClientData(void *ptr,   // IN
+                         size_t size) // IN
+{
+   return realloc(ptr, size);
+} // VixMsg_ReallocClientData
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixMsg_StrdupClientData --
+ *
+ *      Allocates memory and copies client-provided string.
+ *
+ * Results:
+ *      Pointer to allocated string
+ *
+ * Side effects:
+ *      None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+char *
+VixMsg_StrdupClientData(const char *s,          // IN
+                        Bool *allocateFailed)   // OUT
+{
+   char* newString = NULL;
+
+   ASSERT(allocateFailed);
+   if (NULL == allocateFailed) {
+      goto abort;
+   }
+
+   *allocateFailed = FALSE;
+
+   if (NULL != s) {
+#if defined(_WIN32)
+         newString = _strdup(s);
+#else
+         newString = strdup(s);
+#endif
+      if (NULL == newString) {
+         *allocateFailed = TRUE;
+      }
+   }
+
+abort:
+   return newString;
+} // VixMsg_StrdupClientData
index 66e36dd2515515083adbb1629b2a7867669c6a39..b00612d14b181a78b372305cd3380328bff29cea 100644 (file)
@@ -31,6 +31,7 @@
 #include "vm_version.h"
 #include "util.h"
 #include "str.h"
+#include "vixCommands.h"
 
 #include "vixOpenSource.h"
 
@@ -456,6 +457,7 @@ VixPropertyListDeserializeImpl(VixPropertyListImpl *propList,     // IN
    size_t propertyValueLengthSize;
    size_t headerSize;
    VixPropertyType *propertyTypePtr;
+   Bool allocateFailed;
 
    if ((NULL == propList)
        || (NULL == buffer)) {
@@ -536,7 +538,13 @@ VixPropertyListDeserializeImpl(VixPropertyListImpl *propList,     // IN
                goto abort;
             }
             free(property->value.strValue);
-            property->value.strValue = Util_SafeStrdup(strPtr);
+
+            property->value.strValue =
+               VixMsg_StrdupClientData(strPtr, &allocateFailed);
+            if (allocateFailed) {
+               err = VIX_E_OUT_OF_MEMORY;
+               goto abort;
+            }
             break;
 
          ////////////////////////////////////////////////////////
@@ -569,7 +577,8 @@ VixPropertyListDeserializeImpl(VixPropertyListImpl *propList,     // IN
              * pretty easy to handle.
              */
             free(property->value.blobValue.blobContents);
-            property->value.blobValue.blobContents = malloc(*lengthPtr);
+            property->value.blobValue.blobContents =
+               VixMsg_MallocClientData(*lengthPtr);
             if (NULL == property->value.blobValue.blobContents) {
                err = VIX_E_OUT_OF_MEMORY;
                goto abort;
index 2019882e3346e37aac8e79e25826449314fb2036..f5ecff10342f5142e80977e5e58fbaff687252d4 100644 (file)
@@ -2613,6 +2613,10 @@ VixError VixMsg_ParseGenericRequestMsg(const VixCommandGenericRequest *request,
                                        int *options,
                                        VixPropertyListImpl *propertyList);
 
+void *VixMsg_MallocClientData(size_t size);
+void *VixMsg_ReallocClientData(void *ptr, size_t size);
+char *VixMsg_StrdupClientData(const char *s, Bool *allocateFailed);
+
 #endif   // VIX_HIDE_FROM_JAVA
 
 
index 9f8cebae80f79e0e95c2e2e956b0e7b999a39538..35a5b53299c5c9ad198dbdcb27dc1bda7afd1ef3 100644 (file)
@@ -62,6 +62,7 @@ typedef enum {
 #define VMCI_DEV_QUIESCE          0x03
 #define VMCI_DEV_UNQUIESCE        0x04
 #define VMCI_DEV_QP_BREAK_SHARING 0x05  // DEPRECATED
+#define VMCI_DEV_RESTORE_SYNC     0x06
 
 
 /*
index 8448e1cb5516ea8737ff56b4f11d7c3aa45eea28..87ff609b7202b35b2623ff80d1ced16b56a43580 100644 (file)
@@ -188,7 +188,10 @@ typedef void * VMCIBuffer;
 
 typedef struct VMCIHost {
 #if defined(VMKERNEL)
-   World_ID vmmWorldID;
+   World_ID vmmWorldID[2];   /*
+                              * First one is the active one and the second
+                              * one is shadow world during FSR.
+                              */
 #elif defined(linux)
    wait_queue_head_t  waitQueue;
 #elif defined(__APPLE__)
@@ -223,6 +226,10 @@ Bool VMCIHost_WaitForCallLocked(VMCIHost *hostContext,
                                 Bool useBH);
 #ifdef VMKERNEL
 int VMCIHost_ContextToHostVmID(VMCIHost *hostContext, VMCIHostVmID *hostVmID);
+void VMCIHost_SetActiveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
+Bool VMCIHost_RemoveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
+Bool VMCIHost_IsActiveHnd(VMCIHost *hostContext, uintptr_t eventHnd);
+uint32 VMCIHost_NumHnds(VMCIHost *hostContext);
 #endif
 
 void *VMCI_AllocKernelMem(size_t size, int flags);
index 16f4022127cb1915dfa24bad7e07feea6b415fc8..602bcc7559267628d5e80dfb383e706340584d0f 100644 (file)
@@ -48,6 +48,21 @@ int VMCIContext_InitContext(VMCIId cid, VMCIPrivilegeFlags flags,
 int VMCIContext_SetDomainName(VMCIContext *context, const char *domainName);
 int VMCIContext_GetDomainName(VMCIId contextID, char *domainName,
                               size_t domainNameBufSize);
+void VMCIContext_SetFSRState(VMCIContext *context,
+                             Bool isQuiesced,
+                             VMCIId migrateCid,
+                             uintptr_t eventHnd,
+                             Bool isLocked);
+VMCIContext *VMCIContext_FindAndUpdateSrcFSR(VMCIId migrateCid,
+                                             uintptr_t eventHnd);
+Bool VMCIContext_IsActiveHnd(VMCIContext *context,
+                             uintptr_t eventHnd);
+Bool VMCIContext_RemoveHnd(VMCIContext *context,
+                           uintptr_t eventHnd,
+                           uint32 *numOld,
+                           uint32 *numNew);
+void VMCIContext_ClearDatagrams(VMCIContext *context);
+void VMCIContext_SetId(VMCIContext *context, VMCIId cid);
 #endif
 Bool VMCIContext_SupportsHostQP(VMCIContext *context);
 void VMCIContext_ReleaseContext(VMCIContext *context);