/usr/src/open-vm-tools-10.0.7/vsock/linux/vsockVmci.h is in open-vm-tools-dkms 2:10.0.7-3227872-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /*********************************************************
* Copyright (C) 2007 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 and no later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*********************************************************/
/*
* vsockVmci.h --
*
* VSockets VMCI constants, types and functions.
*/
#ifndef _VSOCK_VMCI_H_
#define _VSOCK_VMCI_H_
extern VMCIId VMCI_GetContextID(void);
/*
*-----------------------------------------------------------------------------
*
* VSockVmci_IsLocal --
*
* Determine if the given handle points to the local context.
*
* Results:
* TRUE if the given handle is for the local context, FALSE otherwise.
*
* Side effects:
* None.
*
*-----------------------------------------------------------------------------
*/
static INLINE Bool
VSockVmci_IsLocal(VMCIHandle handle) // IN
{
return VMCI_GetContextID() == VMCI_HANDLE_TO_CONTEXT_ID(handle);
}
/*
*----------------------------------------------------------------------------
*
* VSockVmci_ErrorToVSockError --
*
* Converts from a VMCI error code to a VSock error code.
*
* Results:
* Appropriate error code.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------------
*/
static INLINE int32
VSockVmci_ErrorToVSockError(int32 vmciError) // IN
{
int32 err;
switch (vmciError) {
case VMCI_ERROR_NO_MEM:
#if defined(_WIN32)
err = ENOBUFS;
#else // _WIN32
err = ENOMEM;
#endif // _WIN32
break;
case VMCI_ERROR_DUPLICATE_ENTRY:
err = EADDRINUSE;
break;
case VMCI_ERROR_NO_ACCESS:
err = EPERM;
break;
case VMCI_ERROR_NO_RESOURCES:
err = ENOBUFS;
break;
case VMCI_ERROR_INVALID_RESOURCE:
err = EHOSTUNREACH;
break;
case VMCI_ERROR_MODULE_NOT_LOADED:
err = ESYSNOTREADY;
break;
case VMCI_ERROR_NO_HANDLE:
err = ENETUNREACH;
break;
case VMCI_ERROR_INVALID_ARGS:
default:
err = EINVAL;
}
return sockerr2err(err);
}
/*
*----------------------------------------------------------------------------
*
* 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_
|