/* VMCI Utility API. */
VMCIId vmci_get_context_id(void);
+
+#if defined(linux) && !defined(VMKERNEL)
+/* Returned value is a bool, 0 for false, 1 for true. */
+int vmci_is_context_owner(VMCIId contextID, uid_t uid);
+#else // !linux || VMKERNEL
+/* Returned value is a VMCI error code. */
int vmci_is_context_owner(VMCIId contextID, void *hostUser);
+#endif // !linux || VMKERNEL
uint32 vmci_version(void);
int vmci_cid_2_host_vm_id(VMCIId contextID, void *hostVmID,
typedef void (*VMCI_EventCB)(VMCIId subID, VMCI_EventData *ed,
void *clientData);
-int vmci_event_subscribe(VMCI_Event event, uint32 flags,
+int vmci_event_subscribe(VMCI_Event event,
+#if !defined(linux) || defined(VMKERNEL)
+ uint32 flags,
+#endif // !linux || VMKERNEL
VMCI_EventCB callback,
void *callbackData, VMCIId *subID);
int vmci_event_unsubscribe(VMCIId subID);
* user is the owner of the VM/VMX.
*
* Results:
- * VMCI_SUCCESS if the hostUser is owner, error code otherwise.
+ * Linux: 1 (true) if hostUser is owner, 0 (false) otherwise.
+ * Other: VMCI_SUCCESS if the hostUser is owner, error code otherwise.
*
* Side effects:
* None.
*/
VMCI_EXPORT_SYMBOL(vmci_is_context_owner)
+#if defined(linux) && !defined(VMKERNEL)
+int
+vmci_is_context_owner(VMCIId contextID, // IN
+ uid_t uid) // IN
+{
+ int isOwner = 0;
+
+ if (VMCI_HostPersonalityActive()) {
+ VMCIContext *context = VMCIContext_Get(contextID);
+ if (context) {
+ if (context->validUser) {
+ if (VMCIHost_CompareUser((VMCIHostUser *)&uid,
+ &context->user) == VMCI_SUCCESS) {
+ isOwner = 1;
+ }
+ }
+ VMCIContext_Release(context);
+ }
+ }
+
+ return isOwner;
+}
+#else // !linux || VMKERNEL
int
vmci_is_context_owner(VMCIId contextID, // IN
void *hostUser) // IN
}
return VMCI_ERROR_UNAVAILABLE;
}
+#endif // !linux || VMKERNEL
/*
* We subscribe to the VMCI_EVENT_CTX_ID_UPDATE here so we can update the
* internal context id when needed.
*/
- if (vmci_event_subscribe(VMCI_EVENT_CTX_ID_UPDATE, VMCI_FLAG_EVENT_NONE,
+ if (vmci_event_subscribe(VMCI_EVENT_CTX_ID_UPDATE,
+#if !defined(linux) || defined(VMKERNEL)
+ VMCI_FLAG_EVENT_NONE,
+#endif // !linux || VMKERNEL
VMCIUtilCidUpdate, NULL,
&ctxUpdateSubID) < VMCI_SUCCESS) {
VMCI_WARNING((LGPFX"Failed to subscribe to event (type=%d).\n",
VMCI_EXPORT_SYMBOL(vmci_event_subscribe)
int
vmci_event_subscribe(VMCI_Event event, // IN
+#if !defined(linux) || defined(VMKERNEL)
uint32 flags, // IN
+#endif // !linux || VMKERNEL
VMCI_EventCB callback, // IN
void *callbackData, // IN
VMCIId *subscriptionID) // OUT
{
int retval;
+#if defined(linux) && !defined(VMKERNEL)
+ uint32 flags = VMCI_FLAG_EVENT_NONE;
+#endif // linux && !VMKERNEL
VMCISubscription *s = NULL;
if (subscriptionID == NULL) {
#ifndef _VMCI_VERSION_H_
#define _VMCI_VERSION_H_
-#define VMCI_DRIVER_VERSION 9.5.15.0
-#define VMCI_DRIVER_VERSION_COMMAS 9,5,15,0
-#define VMCI_DRIVER_VERSION_STRING "9.5.15.0"
+#define VMCI_DRIVER_VERSION 9.5.16.0
+#define VMCI_DRIVER_VERSION_COMMAS 9,5,16,0
+#define VMCI_DRIVER_VERSION_STRING "9.5.16.0"
#endif /* _VMCI_VERSION_H_ */
VSockVmciTrusted(VSockVmciSock *vsock, // IN: Local socket
VMCIId peerCid) // IN: Context ID of peer
{
- int res;
-
- if (vsock->trusted) {
- return TRUE;
- }
-
- res = vmci_is_context_owner(peerCid, &vsock->owner);
-
- return res == VMCI_SUCCESS;
+ return vsock->trusted || vmci_is_context_owner(peerCid, vsock->owner);
}
* specifying the ATTACH_ONLY flag below.
*/
err = vmci_event_subscribe(VMCI_EVENT_QP_PEER_DETACH,
- VMCI_FLAG_EVENT_NONE,
VSockVmciPeerDetachCB,
pending,
&detachSubId);
* once and add a way to lookup sockets by queue pair handle.
*/
err = vmci_event_subscribe(VMCI_EVENT_QP_PEER_ATTACH,
- VMCI_FLAG_EVENT_NONE,
VSockVmciPeerAttachCB,
sk,
&attachSubId);
}
err = vmci_event_subscribe(VMCI_EVENT_QP_PEER_DETACH,
- VMCI_FLAG_EVENT_NONE,
VSockVmciPeerDetachCB,
sk,
&detachSubId);
}
err = vmci_event_subscribe(VMCI_EVENT_QP_RESUMED,
- VMCI_FLAG_EVENT_NONE,
VSockVmciQPResumedCB,
NULL,
&qpResumedSubId);
#ifndef _VSOCK_VERSION_H_
#define _VSOCK_VERSION_H_
-#define VSOCK_DRIVER_VERSION 9.5.8.0
-#define VSOCK_DRIVER_VERSION_COMMAS 9,5,8,0
-#define VSOCK_DRIVER_VERSION_STRING "9.5.8.0"
+#define VSOCK_DRIVER_VERSION 9.5.9.0
+#define VSOCK_DRIVER_VERSION_COMMAS 9,5,9,0
+#define VSOCK_DRIVER_VERSION_STRING "9.5.9.0"
#endif /* _VSOCK_VERSION_H_ */