]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Link the VMCI socket common code into the VMX.
authorVMware, Inc <>
Fri, 12 Apr 2013 19:47:27 +0000 (12:47 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 17 Apr 2013 19:16:53 +0000 (12:16 -0700)
Use the common VMCI socket driver code in the VMX to provide access to
raw VMCI sockets. This functionality has some limitations, for example
blocking calls are not possible because blocking a VMX thread can
prevent the guest from making the necessary progress and cause deadlock.

A new lock parameter has been added to VSockSocket_Socket to allow the
caller to provide a lock for use by the socket. This is similar to the
lock provided to AsyncSocket and allows an AsyncSocket and VSockSocket
to share the same lock.

VMCI_DatagramSend requires a needsLock parameter. This is currently
hardcoded to FALSE in all cases. This may not be correct and needs to be
analyzed.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/include/loglevel_user.h
open-vm-tools/modules/linux/vsock/linux/vsockCommon.h
open-vm-tools/modules/linux/vsock/linux/vsockPacket.h
open-vm-tools/modules/linux/vsock/linux/vsockSocketWrapper.h

index 0ddb0f40737fa47f607c1eaabdd7e76d08edf305..6665b5f8d302c9abb9b84df0fac1cffe2be2dbe1 100644 (file)
@@ -99,6 +99,7 @@
    LOGLEVEL_VAR(vcpuNUMA), \
    LOGLEVEL_VAR(heci), \
    LOGLEVEL_VAR(vmiopluginlib), \
+   LOGLEVEL_VAR(vsock), \
    \
    /* user/disk */ \
    LOGLEVEL_VAR(aioMgr), \
index ae10536679d9762bdb7da09ac94878692b266179..745c8474ecc760879fa5822f284acc24e4f03c0d 100644 (file)
  * than external kernel modules using VMCI Sockets api inside the kernel.
  */
 
-#if defined _WIN32
+#if defined VMX86_VMX
+   /*
+    * The VMX is a very special case because hypervisor sockets do not go
+    * through the host kernel and thus do not require an address family.
+    */
+#  define VMCI_SOCKETS_AF_VALUE 0
+#  define VMCISockGetAFValueInt() VMCI_SOCKETS_AF_VALUE
+#elif defined _WIN32
 #  define VMCI_SOCKETS_AF_VALUE 28
 #  if defined WINNT_DDK
 #     define _WIN2K_COMPAT_SLIST_USAGE
index 18a6a2ecc353e6f5766550fcaeddc5748ca961da..a301338b891b581f150554334ce387f022a8600c 100644 (file)
 
 #include "vmci_sockets_packet.h"
 
-#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__)
+#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) || defined(VMX86_VMX)
 # include "vsockOSInt.h"
 #else
 # define VSockOS_ClearMemory(_dst, _sz)   memset(_dst, 0, _sz)
 # define VSockOS_Memcpy(_dst, _src, _sz)  memcpy(_dst, _src, _sz)
 #endif
 
+#include "vsockCommon.h"
+
 
 /*
  *-----------------------------------------------------------------------------
index 3517dcc9d8511b0acc153cf96177fa8a88390861..d7fcaf740f7e62ebd63ea566c4a7745ae7fd76cf 100644 (file)
@@ -64,7 +64,7 @@
 #define SO_NONBLOCKING  0x1200
 #endif // __APPLE__
 
-#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__)
+#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) || defined(VMX86_VMX)
 #  define SS_FREE             0
 #  define SS_UNCONNECTED      1
 #  define SS_CONNECTING       2
@@ -87,7 +87,7 @@
 #  define SOCKET_EVENT_CONNECT FD_CONNECT
 #  define SOCKET_EVENT_CLOSE   FD_CLOSE
 #else
-#if defined(VMKERNEL)  || defined(__APPLE__)
+#if defined(VMKERNEL)  || defined(__APPLE__) || defined(VMX86_VMX)
 #  define SOCKET_EVENT_READ    0x1
 #  define SOCKET_EVENT_WRITE   0x2
 #  define SOCKET_EVENT_ACCEPT  0x8
 #  define ESYSNOTREADY        EOPNOTSUPP
 #elif defined(linux)
 #  define ESYSNOTREADY        EOPNOTSUPP
+#  define __ELOCALSHUTDOWN    EPIPE
+#  define __ELOCALRCVSHUTDOWN 0
+#  define __EPEERSHUTDOWN     EPIPE
+#  define __ECONNINPROGRESS   EINPROGRESS
+#  define __ESNDRCVTIMEDOUT   EAGAIN
 #endif // _WIN32