/usr/src/open-vm-tools-10.0.7/vmci/common/vmciCommonInt.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 | /*********************************************************
* Copyright (C) 2006-2012 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
*
*********************************************************/
/*
* vmciCommonInt.h --
*
* Struct definitions for VMCI internal common code.
*/
#ifndef _VMCI_COMMONINT_H_
#define _VMCI_COMMONINT_H_
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMCORE
#define INCLUDE_ALLOW_VMKERNEL
#include "includeCheck.h"
#include "vm_atomic.h"
#include "vmci_defs.h"
#include "vmci_call_defs.h"
#include "vmci_infrastructure.h"
#include "vmci_handle_array.h"
#include "vmci_kernel_if.h"
/*
* The DatagramQueueEntry is a queue header for the in-kernel VMCI
* datagram queues. It is allocated in non-paged memory, as the
* content is accessed while holding a spinlock. The pending datagram
* itself may be allocated from paged memory. We shadow the size of
* the datagram in the non-paged queue entry as this size is used
* while holding the same spinlock as above.
*/
typedef struct DatagramQueueEntry {
VMCIListItem listItem; /* For queuing. */
size_t dgSize; /* Size of datagram. */
VMCIDatagram *dg; /* Pending datagram. */
} DatagramQueueEntry;
/*
* The VMCIFilterState captures the state of all VMCI filters in one
* direction. The ranges array contains all filter list in a single
* memory chunk, and the filter list pointers in the VMCIProtoFilters
* point into the ranges array.
*/
typedef struct VMCIFilterState {
VMCIProtoFilters filters;
VMCIIdRange *ranges;
size_t rangesSize;
} VMCIFilterState;
struct VMCIContext {
VMCIListItem listItem; /* For global VMCI list. */
VMCIId cid;
Atomic_uint32 refCount;
VMCIList datagramQueue; /* Head of per VM queue. */
uint32 pendingDatagrams;
size_t datagramQueueSize;/* Size of datagram queue in bytes. */
int userVersion; /*
* Version of the code that created
* this context; e.g., VMX.
*/
VMCILock lock; /*
* Locks datagramQueue, inFilters,
* doorbellArray, pendingDoorbellArray
* and notifierArray.
*/
VMCIHandleArray *queuePairArray; /*
* QueuePairs attached to. The array of
* handles for queue pairs is accessed
* from the code for QP API, and there
* it is protected by the QP lock. It
* is also accessed from the context
* clean up path, which does not
* require a lock. VMCILock is not
* used to protect the QP array.
*/
VMCIHandleArray *doorbellArray; /* Doorbells created by context. */
VMCIHandleArray *pendingDoorbellArray; /* Doorbells pending for context. */
VMCIHandleArray *notifierArray; /* Contexts current context is subscribing to. */
VMCIHost hostContext;
VMCIPrivilegeFlags privFlags;
VMCIHostUser user;
Bool validUser;
#ifdef VMKERNEL
Bool isQuiesced; /* Whether current VM is quiesced */
VMCIId migrateCid; /* The migrate cid if it is migrating */
VMCIMutex guestMemMutex; /*
* Coordinates guest memory
* registration/release during FSR.
*/
VMCIGuestMemID curGuestMemID; /* ID of current registered guest mem */
VMCIFilterState *inFilters; /* Ingoing filters for VMCI traffic. */
#endif
#ifndef VMX86_SERVER
Bool *notify; /* Notify flag pointer - hosted only. */
# ifdef __linux__
struct page *notifyPage; /* Page backing the notify UVA. */
# endif
#endif
};
/*
*------------------------------------------------------------------------------
*
* VMCIDenyInteraction --
*
* Utilility function that checks whether two entities are allowed
* to interact. If one of them is restricted, the other one must
* be trusted.
*
* Result:
* TRUE if the two entities are not allowed to interact. FALSE otherwise.
*
* Side effects:
* None.
*
*------------------------------------------------------------------------------
*/
static INLINE Bool
VMCIDenyInteraction(VMCIPrivilegeFlags partOne, // IN
VMCIPrivilegeFlags partTwo) // IN
{
return (((partOne & VMCI_PRIVILEGE_FLAG_RESTRICTED) &&
!(partTwo & VMCI_PRIVILEGE_FLAG_TRUSTED)) ||
((partTwo & VMCI_PRIVILEGE_FLAG_RESTRICTED) &&
!(partOne & VMCI_PRIVILEGE_FLAG_TRUSTED)));
}
#endif /* _VMCI_COMMONINT_H_ */
|