]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Tue, 24 Aug 2010 17:49:44 +0000 (10:49 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 24 Aug 2010 17:49:44 +0000 (10:49 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/shared/vmciKernelAPI.h
open-vm-tools/modules/linux/shared/vmci_infrastructure.h
open-vm-tools/modules/linux/shared/vmci_iocontrols.h
open-vm-tools/modules/linux/vmci/vmciQPair.c
open-vm-tools/modules/linux/vmci/vmciQueue.h
open-vm-tools/modules/linux/vsock/linux/vsockCommon.h
open-vm-tools/modules/linux/vsock/linux/vsockVmci.h

index 2633907a8dbe93c57c328f31e9f8dc63643f5437..953c31758cb6243da68e6a3f4d958d54912d7e31 100644 (file)
@@ -132,7 +132,8 @@ ssize_t VMCIQPair_Peek(VMCIQPair *qpair,
                        int mode);
 
 #if defined (SOLARIS) || (defined(__APPLE__) && !defined (VMX86_TOOLS)) || \
-    (defined(__linux__) && defined(__KERNEL__))
+    (defined(__linux__) && defined(__KERNEL__)) || \
+    (defined(_WIN32) && defined(WINNT_DDK))
 /*
  * Environments that support struct iovec
  */
index 9de8600a24ed10f9f13d2b103378a457229af725..b05892f4e51235fb9a8e86ea64aa7189bed99d6b 100644 (file)
@@ -46,6 +46,12 @@ typedef enum {
    VMCIOBJ_NOT_SET,
 } VMCIObjType;
 
+/* For storing VMCI structures in file handles. */
+typedef struct VMCIObj {
+   void *ptr;
+   VMCIObjType type;
+} VMCIObj;
+
 /* Guestcalls currently support a maximum of 8 uint64 arguments. */
 #define VMCI_GUESTCALL_MAX_ARGS_SIZE 64
 
index ef3b9d42c10cca5bb731401eca4ffb20ab70bb58..d2e94e436e8099cb91593a4810582e7e9523a329 100644 (file)
@@ -362,14 +362,6 @@ enum IOCTLCmd_VMCI {
                VMCIIOCTL_BUFFERED(SOCKETS_SHUTDOWN)
 /* END VMCI SOCKETS */
 
-
-/*
- * For accessing VMCIOBJ_SOCKET in IOCTLs.  Both functions take a file object's
- * fs context and get or set the socket.
- */
-PVOID VMCIFsContext_GetSocket(PVOID fsContext);
-void VMCIFsContext_SetSocket(PVOID fsContext, PVOID socket);
-
 #endif // _WIN32
 
 
index 6ea9a3fd9ceb5466c26a45fe686f94d6111e107c..92ac7e167e8ad734fe7fdc74d16d47d6e69d2f93 100644 (file)
@@ -815,7 +815,8 @@ EXPORT_SYMBOL(VMCIQPair_Peek);
 
 
 #if defined (SOLARIS) || (defined(__APPLE__) && !defined (VMX86_TOOLS)) || \
-    (defined(__linux__) && defined(__KERNEL__))
+    (defined(__linux__) && defined(__KERNEL__)) || \
+    (defined(_WIN32) && defined(WINNT_DDK))
 
 /*
  *-----------------------------------------------------------------------------
@@ -840,7 +841,7 @@ VMCIQPair_EnqueueV(VMCIQPair *qpair,        // IN
                    size_t iovSize,          // IN
                    int bufType)             // IN
 {
-   int64 result;
+   ssize_t result;
 
    VMCIQPairLock(qpair);
 
@@ -879,7 +880,7 @@ VMCIQPair_DequeueV(VMCIQPair *qpair,         // IN
                    size_t iovSize,           // IN
                    int bufType)              // IN
 {
-   int64 result;
+   ssize_t result;
 
    VMCIQPairLock(qpair);
 
@@ -920,7 +921,7 @@ VMCIQPair_PeekV(VMCIQPair *qpair,           // IN
                 size_t iovSize,             // IN
                 int bufType)                // IN
 {
-   int64 result;
+   ssize_t result;
 
    VMCIQPairLock(qpair);
 
index c991f804cf19a7a9045979769348b1af2049e7db..b75dd06e59bdb95719353e6fa2fff91cf22d1b82 100644 (file)
@@ -102,6 +102,18 @@ typedef int VMCIMemcpyFromQueueFunc(void *dest, size_t destOffset,
                                     size_t size, BUF_TYPE bufType);
 
 
+#if defined(_WIN32) && defined(WINNT_DDK)
+/*
+ * Windows needs iovec for the V functions.  We use an MDL for the actual
+ * buffers, but we also have an offset that comes from WSK_BUF.
+ */
+typedef struct iovec {
+   PMDL mdl;     // List of memory descriptors.
+   ULONG offset; // Base offset.
+};
+#endif // _WIN32 && WINNT_DDK
+
+
 /*
  *-----------------------------------------------------------------------------
  *
@@ -128,12 +140,8 @@ int VMCIMemcpyFromQueue(void *dest, size_t destOffset, const VMCIQueue *queue,
 
 #if defined VMKERNEL || defined (SOLARIS)         || \
    (defined(__APPLE__) && !defined (VMX86_TOOLS)) || \
-   (defined(__linux__) && defined(__KERNEL__))
-
-   /*
-    * Solaris/Mac/Linux vmciKernelIf.c files provide these functions
-    */
-
+   (defined(__linux__) && defined(__KERNEL__))    || \
+   (defined(_WIN32) && defined(WINNT_DDK))
 int VMCIMemcpyToQueueV(VMCIQueue *queue, uint64 queueOffset, const void *src,
                        size_t srcOffset, size_t size, BUF_TYPE bufType);
 int VMCIMemcpyFromQueueV(void *dest, size_t destOffset, const VMCIQueue *queue,
index 411843073d647762d94166ae08ed71ed3b9e24b2..aa79747ea0d3c7377058db09d802675594f95cba 100644 (file)
@@ -81,6 +81,7 @@
 #include "vmware.h"
 #include "vmci_defs.h"
 #include "vmci_call_defs.h"
+#include "vmci_infrastructure.h"
 #include "vmci_sockets_int.h"
 #include "vmci_sockets.h"
 
index bedefdef6f466037a37a62800a3f139753786b1c..88331b34b91554b1566f77d7215f7f45da402009 100644 (file)
@@ -100,5 +100,61 @@ VSockVmci_ErrorToVSockError(int32 vmciError) // IN
 }
 
 
+/*
+ *----------------------------------------------------------------------------
+ *
+ * VSockVmci_GetVmciObjSocket --
+ *
+ *      Get a socket from a VMCI object, but only if the object is of the
+ *      appropriate type.
+ *
+ * Results:
+ *      A socket if the object is of the correct type, NULL otherwise.
+ *
+ * Side effects:
+ *      None.
+ *
+ *----------------------------------------------------------------------------
+ */
+
+static INLINE void *
+VSockVmci_GetVmciObjSocket(VMCIObj *obj) // IN
+{
+   ASSERT(obj);
+   if (NULL != obj->ptr && VMCIOBJ_SOCKET == obj->type) {
+      return obj->ptr;
+   }
+   return NULL;
+}
+
+
+/*
+ *----------------------------------------------------------------------------
+ *
+ * VSockVmci_SetVmciObjSocket --
+ *
+ *      Set the socket in a VMCI object.  This will also set the type
+ *      accordingly.
+ *
+ * Results:
+ *      None.
+ *
+ * Side effects:
+ *      None.
+ *
+ *----------------------------------------------------------------------------
+ */
+
+static INLINE void
+VSockVmci_SetVmciObjSocket(VMCIObj *obj, // OUT
+                           void *s)      // IN
+{
+   ASSERT(obj);
+   ASSERT(s);
+   obj->ptr = s;
+   obj->type = VMCIOBJ_SOCKET;
+}
+
+
 #endif // _VSOCK_VMCI_H_