~n-muench/ubuntu/quantal/open-vm-tools/open-vm-tools.may2.sid-sync

« back to all changes in this revision

Viewing changes to modules/linux/vsock/linux/vmciHostKernelAPI.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-05-30 09:48:43 UTC
  • mfrom: (1.1.5 upstream) (2.4.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090530094843-gdpza57r5iqsf124
Tags: 2009.05.22-167859-1
MergingĀ upstreamĀ versionĀ 2009.05.22-167859.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 2007 VMware, Inc. All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the
 
6
 * Free Software Foundation version 2 and no later version.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
10
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
11
 * for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
15
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
16
 *
 
17
 *********************************************************/
 
18
 
 
19
/*
 
20
 * vmciHostKernelAPI.h --
 
21
 *
 
22
 *    Kernel API exported from the VMCI host driver.
 
23
 */
 
24
 
 
25
#ifndef __VMCI_HOSTKERNELAPI_H__
 
26
#define __VMCI_HOSTKERNELAPI_H__
 
27
 
 
28
#define INCLUDE_ALLOW_MODULE
 
29
#define INCLUDE_ALLOW_VMMON
 
30
#define INCLUDE_ALLOW_VMCORE
 
31
#define INCLUDE_ALLOW_VMK_MODULE
 
32
#define INCLUDE_ALLOW_VMKERNEL
 
33
#define INCLUDE_ALLOW_DISTRIBUTE
 
34
#include "includeCheck.h"
 
35
 
 
36
 
 
37
/* VMCI host kernel API version number. */
 
38
#define VMCI_HOST_KERNEL_API_VERSION  1
 
39
 
 
40
/* Macros to operate on the driver version number. */
 
41
#define VMCI_MAJOR_VERSION(v)       (((v) >> 16) & 0xffff)
 
42
#define VMCI_MINOR_VERSION(v)       ((v) & 0xffff)
 
43
 
 
44
#include "vmci_defs.h"
 
45
#if defined(VMKERNEL)
 
46
#include "vm_atomic.h"
 
47
#include "return_status.h"
 
48
#include "util_copy_dist.h"
 
49
#endif
 
50
#include "vmci_call_defs.h"
 
51
 
 
52
#if !defined(VMKERNEL)
 
53
#include "vmci_queue_pair.h"
 
54
#endif
 
55
 
 
56
 
 
57
/* VMCI Datagram API. */
 
58
 
 
59
int VMCIHost_DatagramCreateHnd(VMCIId resourceID, uint32 flags,
 
60
                               VMCIDatagramRecvCB recvCB, void *clientData,
 
61
                               VMCIHandle *outHandle);
 
62
int VMCIDatagram_CreateHnd(VMCIId resourceID, uint32 flags,
 
63
                           VMCIDatagramRecvCB recvCB, void *clientData,
 
64
                           VMCIHandle *outHandle);
 
65
int VMCIDatagram_CreateHndPriv(VMCIId resourceID, uint32 flags,
 
66
                               VMCIPrivilegeFlags privFlags,
 
67
                               VMCIDatagramRecvCB recvCB, void *clientData,
 
68
                               VMCIHandle *outHandle);
 
69
int VMCIDatagram_DestroyHnd(VMCIHandle handle);
 
70
int VMCIDatagram_Send(VMCIDatagram *msg);
 
71
 
 
72
/* VMCI Utility API. */
 
73
 
 
74
#if defined(VMKERNEL)
 
75
int VMCI_ContextID2HostVmID(VMCIId contextID, void *hostVmID,
 
76
                            size_t hostVmIDLen);
 
77
#endif
 
78
 
 
79
/* VMCI Event API  */
 
80
 
 
81
typedef void (*VMCI_EventCB)(VMCIId subID, VMCI_EventData *ed,
 
82
                             void *clientData);
 
83
 
 
84
int VMCIEvent_Subscribe(VMCI_Event event, VMCI_EventCB callback,
 
85
                        void *callbackData, VMCIId *subID);
 
86
int VMCIEvent_Unsubscribe(VMCIId subID);
 
87
 
 
88
/* VMCI Context API */
 
89
 
 
90
VMCIPrivilegeFlags VMCIContext_GetPrivFlags(VMCIId contextID);
 
91
 
 
92
/*
 
93
 * Queue pair operations for manipulating the content of a queue
 
94
 * pair are defined in vmci_queue_pair.h for non-vmkernel hosts.
 
95
 * Here we define the API for allocating and detaching from queue
 
96
 * pairs for all hosts, and content manipulation functions for
 
97
 * VMKERNEL.
 
98
 */
 
99
 
 
100
#if defined(VMKERNEL)
 
101
 
 
102
/*
 
103
 * For guest kernels, the VMCIQueue is directly mapped onto the
 
104
 * metadata page of the queue. In vmkernel, we use the VMCIQueue
 
105
 * structure to store the information necessary to retrieve the MPNs
 
106
 * of the queue. By redefining the structure, queue pair code using
 
107
 * the API below will be portable between guests and host kernels.
 
108
 */
 
109
 
 
110
typedef struct VMCIQueue {
 
111
   uint32 offset;                // Start page of queue in backing store
 
112
   uint32 len;                   // Number of pages in the queue
 
113
   struct QueuePairEntry *entry; // Endpoint state for the queue pair
 
114
} VMCIQueue;
 
115
 
 
116
/* VMCI Queuepair API  */
 
117
void VMCIQueue_Init(const VMCIHandle handle, VMCIQueue *queue);
 
118
void VMCIQueue_GetPointers(const VMCIQueue *produceQ, const VMCIQueue *consumeQ,
 
119
                           uint64 *producerTail, uint64 *consumerHead);
 
120
int64 VMCIQueue_FreeSpace(const VMCIQueue *produceQueue,
 
121
                          const VMCIQueue *consumeQueue,
 
122
                          const uint64 produceQSize);
 
123
int64 VMCIQueue_BufReady(const VMCIQueue *consumeQueue,
 
124
                         const VMCIQueue *produceQueue,
 
125
                         const uint64 consumeQSize);
 
126
ssize_t VMCIQueue_Enqueue(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
127
                          const uint64 produceQSize, const void *buf,
 
128
                          size_t bufSize, Util_BufferType bufType);
 
129
ssize_t VMCIQueue_Peek(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
130
                       const uint64 consumeQSize, void *buf,
 
131
                       size_t bufSize, Util_BufferType bufType);
 
132
ssize_t VMCIQueue_PeekV(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
133
                        const uint64 consumeQSize, void *buf,
 
134
                        size_t bufSize, Util_BufferType bufType);
 
135
ssize_t VMCIQueue_Discard(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
136
                          const uint64 consumeQSize, size_t bufSize);
 
137
ssize_t VMCIQueue_Dequeue(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
138
                          const uint64 consumeQSize, void *buf,
 
139
                          size_t bufSize, Util_BufferType bufType);
 
140
ssize_t VMCIQueue_EnqueueV(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
141
                           const uint64 produceQSize, const void *buf,
 
142
                           size_t bufSize, Util_BufferType bufType);
 
143
ssize_t VMCIQueue_DequeueV(VMCIQueue *produceQueue, const VMCIQueue *consumeQueue,
 
144
                           const uint64 consumeQSize, void *buf,
 
145
                           size_t bufSize, Util_BufferType bufType);
 
146
#endif  /* VMKERNEL  */
 
147
 
 
148
int VMCIQueuePair_Alloc(VMCIHandle *handle, VMCIQueue **produceQ,
 
149
                        uint64 produceSize, VMCIQueue **consumeQ,
 
150
                        uint64 consumeSize, VMCIId peer, uint32 flags);
 
151
int VMCIQueuePair_AllocPriv(VMCIHandle *handle, VMCIQueue **produceQ,
 
152
                            uint64 produceSize, VMCIQueue **consumeQ,
 
153
                            uint64 consumeSize, VMCIId peer, uint32 flags,
 
154
                            VMCIPrivilegeFlags privFlags);
 
155
int VMCIQueuePair_Detach(VMCIHandle handle);
 
156
 
 
157
#endif /* !__VMCI_HOSTKERNELAPI_H__ */
 
158