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
*/
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
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
#if defined (SOLARIS) || (defined(__APPLE__) && !defined (VMX86_TOOLS)) || \
- (defined(__linux__) && defined(__KERNEL__))
+ (defined(__linux__) && defined(__KERNEL__)) || \
+ (defined(_WIN32) && defined(WINNT_DDK))
/*
*-----------------------------------------------------------------------------
size_t iovSize, // IN
int bufType) // IN
{
- int64 result;
+ ssize_t result;
VMCIQPairLock(qpair);
size_t iovSize, // IN
int bufType) // IN
{
- int64 result;
+ ssize_t result;
VMCIQPairLock(qpair);
size_t iovSize, // IN
int bufType) // IN
{
- int64 result;
+ ssize_t result;
VMCIQPairLock(qpair);
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
+
+
/*
*-----------------------------------------------------------------------------
*
#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,
#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"
}
+/*
+ *----------------------------------------------------------------------------
+ *
+ * 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_