#include "vmci_call_defs.h"
+/* VMCI module namespace on vmkernel. */
+
+#define MOD_VMCI_NAMESPACE "com.vmware.vmci"
+
/* Define version 1. */
#undef VMCI_KERNEL_API_VERSION
*********************************************************/
/*
- * vmci_kernel_if.h --
- *
+ * vmci_kernel_if.h --
+ *
* This file defines helper functions for VMCI host _and_ guest
* kernel code. It must work for Windows, Mac OS, vmkernel, Linux and
* Solaris kernels, i.e. using defines where necessary.
*/
-
+
#ifndef _VMCI_KERNEL_IF_H_
#define _VMCI_KERNEL_IF_H_
#if defined(_WIN32)
#include <ntddk.h>
-#endif
+#endif
#if defined(linux) && !defined(VMKERNEL)
# include <linux/wait.h>
#ifdef VMKERNEL
#include "splock.h"
#include "semaphore_ext.h"
+#include "vmkapi.h"
#endif
#ifdef SOLARIS
/* Platform specific type definitions. */
-#if defined(linux) && !defined(VMKERNEL)
+#if defined(VMKERNEL)
+# define VMCI_EXPORT_SYMBOL(_SYMBOL) VMK_MODULE_EXPORT_SYMBOL(_SYMBOL);
+#elif defined(linux)
# define VMCI_EXPORT_SYMBOL(_symbol) EXPORT_SYMBOL(_symbol);
#elif defined(__APPLE__)
# define VMCI_EXPORT_SYMBOL(_symbol) __attribute__((visibility("default")))
/*
* The VMCI locks use a ranking scheme similar to the one used by
* vmkernel. While holding a lock L1 with rank R1, only locks with
- * rank higher than R1 may be grabbed. The available ranks for VMCI
+ * rank higher than R1 may be grabbed. The available ranks for VMCI
* locks are (in descending order):
* - VMCI_LOCK_RANK_HIGH_BH : to be used for locks grabbed while executing
* in a bottom half and not held while grabbing other locks.
#elif defined(__APPLE__)
struct Socket *socket; /* vmci Socket object on Mac OS. */
#elif defined(_WIN32)
- KEVENT *callEvent; /* Ptr to userlevel event used when signalling
+ KEVENT *callEvent; /* Ptr to userlevel event used when signalling
* new pending guestcalls in kernel.
*/
#elif defined(SOLARIS)
struct pollhead pollhead; /* Per datagram handle pollhead structure to
- * be treated as a black-box. None of its
+ * be treated as a black-box. None of its
* fields should be referenced.
*/
#endif
void VMCI_CreateEvent(VMCIEvent *event);
void VMCI_DestroyEvent(VMCIEvent *event);
void VMCI_SignalEvent(VMCIEvent *event);
-void VMCI_WaitOnEvent(VMCIEvent *event, VMCIEventReleaseCB releaseCB,
+void VMCI_WaitOnEvent(VMCIEvent *event, VMCIEventReleaseCB releaseCB,
void *clientData);
#if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32)) && !defined(VMKERNEL)
Bool VMCI_WaitOnEventInterruptible(VMCIEvent *event,
/*
*-----------------------------------------------------------------------------
*
- * VMCIDatagramCreateHndInt --
+ * VMCIDatagram_CreateHnd --
*
* Creates a datagram endpoint and returns a handle to it.
*
*-----------------------------------------------------------------------------
*/
-VMCI_EXPORT_SYMBOL(VMCIDatagramCreateHndInt)
+VMCI_EXPORT_SYMBOL(VMCIDatagram_CreateHnd)
int
-VMCIDatagramCreateHndInt(VMCIId resourceID, // IN:
- uint32 flags, // IN:
- VMCIDatagramRecvCB recvCB, // IN:
- void *clientData, // IN:
- VMCIHandle *outHandle) // OUT:
+VMCIDatagram_CreateHnd(VMCIId resourceID, // IN
+ uint32 flags, // IN
+ VMCIDatagramRecvCB recvCB, // IN
+ void *clientData, // IN
+ VMCIHandle *outHandle) // OUT
{
int result;
DatagramHashEntry *entry;
}
-/*
- *-----------------------------------------------------------------------------
- *
- * VMCIDatagram_CreateHnd --
- *
- * Creates a datagram endpoint and returns a handle to it.
- *
- * Results:
- * Returns handle if success, negative errno value otherwise.
- *
- * Side effects:
- * Datagram endpoint is created both in guest and on host.
- *
- *-----------------------------------------------------------------------------
- */
-
-VMCI_EXPORT_SYMBOL(VMCIDatagram_CreateHnd)
-int
-VMCIDatagram_CreateHnd(VMCIId resourceID, // IN:
- uint32 flags, // IN:
- VMCIDatagramRecvCB recvCB, // IN:
- void *clientData, // IN:
- VMCIHandle *outHandle) // OUT:
-{
- return VMCIDatagramCreateHndInt(resourceID, flags, recvCB, clientData, outHandle);
-}
-
-
/*
*-----------------------------------------------------------------------------
*
/*
*-----------------------------------------------------------------------------
*
- * VMCIDatagramCreateHndPriv --
- *
- * API provided for compatibility with the host vmci API. This function
- * doesn't ever succeed since you can't ask for elevated privileges from
- * the guest. Use VMCIDatagramCreateHndInt instead.
- *
- * Results:
- * Returns VMCI_ERROR_NO_ACCESS.
- *
- * Side effects:
- * None.
- *
- *-----------------------------------------------------------------------------
- */
-
-VMCI_EXPORT_SYMBOL(VMCIDatagramCreateHndPriv)
-int
-VMCIDatagramCreateHndPriv(VMCIId resourceID, // IN:
- uint32 flags, // IN:
- VMCIPrivilegeFlags privFlags, // IN:
- VMCIDatagramRecvCB recvCB, // IN:
- void *clientData, // IN:
- VMCIHandle *outHandle) // OUT:
-{
- return VMCI_ERROR_NO_ACCESS;
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * VMCIDatagramDestroyHndInt --
+ * VMCIDatagram_DestroyHnd --
*
* Destroys a handle.
*
*-----------------------------------------------------------------------------
*/
-VMCI_EXPORT_SYMBOL(VMCIDatagramDestroyHndInt)
+VMCI_EXPORT_SYMBOL(VMCIDatagram_DestroyHnd)
int
-VMCIDatagramDestroyHndInt(VMCIHandle handle) // IN
+VMCIDatagram_DestroyHnd(VMCIHandle handle) // IN
{
DatagramHashEntry *entry = DatagramHashGetEntry(handle);
if (entry == NULL) {
}
-/*
- *-----------------------------------------------------------------------------
- *
- * VMCIDatagram_DestroyHnd --
- *
- * Destroys a handle.
- *
- * Results:
- * VMCI_SUCCESS or error code.
- *
- * Side effects:
- * Host and guest state is cleaned up.
- *
- *-----------------------------------------------------------------------------
- */
-
-VMCI_EXPORT_SYMBOL(VMCIDatagram_DestroyHnd)
-int
-VMCIDatagram_DestroyHnd(VMCIHandle handle) // IN
-{
- return VMCIDatagramDestroyHndInt(handle);
-}
-
-
/*
*-----------------------------------------------------------------------------
*
Bool VMCIDatagram_CheckHostCapabilities(void);
int VMCIDatagram_Dispatch(VMCIId contextID, VMCIDatagram *msg);
-int VMCIDatagramCreateHndInt(VMCIId resourceID,
- uint32 flags,
- VMCIDatagramRecvCB recvCB,
- void *clientData,
- VMCIHandle *outHandle);
-int VMCIDatagramCreateHndPriv(VMCIId resourceID,
- uint32 flags,
- VMCIPrivilegeFlags privFlags,
- VMCIDatagramRecvCB recvCB,
- void *clientData,
- VMCIHandle *outHandle); /* Compat */
-int VMCIDatagramDestroyHndInt(VMCIHandle handle);
-
int VMCIDatagramProcess_Create(VMCIDatagramProcess **outDgmProc,
VMCIDatagramCreateProcessInfo *createInfo,
uintptr_t eventHnd);
/*
*----------------------------------------------------------------------
*
- * VMCIEventSubscribe --
+ * VMCIEvent_Subscribe --
*
* Subscribe to given event. The callback specified can be fired
* in different contexts depending on what flag is specified while
*----------------------------------------------------------------------
*/
-VMCI_EXPORT_SYMBOL(VMCIEventSubscribe)
+VMCI_EXPORT_SYMBOL(VMCIEvent_Subscribe)
int
-VMCIEventSubscribe(VMCI_Event event, // IN
- uint32 flags, // IN
- VMCI_EventCB callback, // IN
- void *callbackData, // IN
- VMCIId *subscriptionID) // OUT
+VMCIEvent_Subscribe(VMCI_Event event, // IN
+ uint32 flags, // IN
+ VMCI_EventCB callback, // IN
+ void *callbackData, // IN
+ VMCIId *subscriptionID) // OUT
{
int retval;
VMCISubscription *s = NULL;
}
-#ifndef VMKERNEL
/*
*----------------------------------------------------------------------
*
- * VMCIEvent_Subscribe --
- *
- * Subscribe to given event.
- *
- * Results:
- * VMCI_SUCCESS on success, error code otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-VMCI_EXPORT_SYMBOL(VMCIEvent_Subscribe)
-int
-VMCIEvent_Subscribe(VMCI_Event event, // IN
- uint32 flags, // IN
- VMCI_EventCB callback, // IN
- void *callbackData, // IN
- VMCIId *subscriptionID) // OUT
-{
- return VMCIEventSubscribe(event, flags, callback, callbackData,
- subscriptionID);
-}
-#endif /* !VMKERNEL */
-
-
-/*
- *----------------------------------------------------------------------
- *
- * VMCIEventUnsubscribe --
+ * VMCIEvent_Unsubscribe --
*
* Unsubscribe to given event. Removes it from list and frees it.
* Will return callbackData if requested by caller.
*----------------------------------------------------------------------
*/
-VMCI_EXPORT_SYMBOL(VMCIEventUnsubscribe)
+VMCI_EXPORT_SYMBOL(VMCIEvent_Unsubscribe)
int
-VMCIEventUnsubscribe(VMCIId subID) // IN
+VMCIEvent_Unsubscribe(VMCIId subID) // IN
{
VMCISubscription *s;
return VMCI_SUCCESS;
}
-
-
-#ifndef VMKERNEL
-/*
- *----------------------------------------------------------------------
- *
- * VMCIEvent_Unsubscribe --
- *
- * Unsubscribe to given event. Removes it from list and frees it.
- * Will return callbackData if requested by caller.
- *
- * Results:
- * VMCI_SUCCESS on success, error code otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-VMCI_EXPORT_SYMBOL(VMCIEvent_Unsubscribe)
-int
-VMCIEvent_Unsubscribe(VMCIId subID) // IN
-{
- return VMCIEventUnsubscribe(subID);
-}
-
-#endif /* !VMKERNEL */
#include "vmci_defs.h"
#include "vmci_call_defs.h"
-#include "vmciKernelAPI.h"
void VMCIEvent_Init(void);
void VMCIEvent_Exit(void);
Bool VMCIEvent_CheckHostCapabilities(void);
#endif
-/*
- * Non-public VMCI Event API for the kernel.
- */
-
-int VMCIEventSubscribe(VMCI_Event event, uint32 flags, VMCI_EventCB callback,
- void *callbackData, VMCIId *subID);
-int VMCIEventUnsubscribe(VMCIId subID);
-
#endif //__VMCI_EVENT_H__
*********************************************************/
/*
- * vmciKernelIf.c --
- *
+ * vmciKernelIf.c --
+ *
* This file implements defines and helper functions for VMCI
* host _and_ guest kernel code. This is the linux specific
* implementation.
- */
+ */
/* Must come before any kernel header file */
#include "driver-config.h"
# error "Linux kernels before 2.6.9 are not supported."
#endif
-#define EXPORT_SYMTAB
-#define __NO_VERSION__
-
#include <linux/mm.h> /* For vmalloc_to_page() and get_user_pages()*/
#include <linux/pagemap.h> /* For page_cache_release() */
#include <linux/socket.h> /* For memcpy_{to,from}iovec(). */
*-----------------------------------------------------------------------------
*/
-EXPORT_SYMBOL(VMCIMemcpyToQueue);
-
int
VMCIMemcpyToQueue(VMCIQueue *queue, // OUT:
uint64 queueOffset, // IN:
*-----------------------------------------------------------------------------
*/
-EXPORT_SYMBOL(VMCIMemcpyFromQueue);
-
int
VMCIMemcpyFromQueue(void *dest, // OUT:
size_t destOffset, // IN:
*----------------------------------------------------------------------------
*/
-EXPORT_SYMBOL(VMCIMemcpyToQueueV);
-
int
VMCIMemcpyToQueueV(VMCIQueue *queue, // OUT:
uint64 queueOffset, // IN:
*----------------------------------------------------------------------------
*/
-EXPORT_SYMBOL(VMCIMemcpyFromQueueV);
-
int
VMCIMemcpyFromQueueV(void *dest, // OUT: iovec
size_t destOffset, // IN: ignored
#ifndef _VMCI_NOTIFICATIONS_H_
#define _VMCI_NOTIFICATIONS_H_
+#include "vm_basic_types.h"
+#include "vmci_defs.h"
+#include "vmciKernelAPI.h"
+
void VMCINotifications_Init(void);
void VMCINotifications_Exit(void);
/* Must come before any kernel header file. */
#if defined(__linux__) && !defined(VMKERNEL)
-# define EXPORT_SYMTAB
# include "driver-config.h"
# include "compat_module.h"
#endif
}
#endif /* Systems that support struct iovec */
-
#include "vm_assert.h"
#include "vmci_kernel_if.h"
+#include "vmciEvent.h"
+#include "vmciInt.h"
+#include "vmciKernelAPI.h"
#include "vmciQueuePairInt.h"
#include "vmciUtil.h"
-#include "vmciInt.h"
-#include "vmciEvent.h"
#include "circList.h"
#define LGPFX "VMCIQueuePair: "