/usr/src/open-vm-tools-10.0.7/vmhgfs/hgfsServer.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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | /*********************************************************
* Copyright (C) 1998-2015 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 2.1 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 Lesser GNU General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*
*********************************************************/
#ifndef _HGFS_SERVER_H_
#define _HGFS_SERVER_H_
#include "hgfs.h" /* for HGFS_PACKET_MAX */
#include "dbllnklst.h"
typedef struct HgfsVmxIov {
void *va; /* Virtual addr */
uint64 pa; /* Physical address passed by the guest */
uint32 len; /* length of data; should be <= PAGE_SIZE for VMCI; arbitrary for backdoor */
void *context; /* Mapping context */
} HgfsVmxIov;
typedef enum {
BUF_READABLE, /* Establish readable mappings */
BUF_WRITEABLE, /* Establish writeable mappings */
BUF_READWRITEABLE, /* Establish read-writeable mappings */
} MappingType;
typedef uint64 HgfsStateFlags;
#define HGFS_STATE_CLIENT_REQUEST (1 << 0)
#define HGFS_STATE_ASYNC_REQUEST (1 << 1)
typedef struct HgfsPacket {
uint64 id;
HgfsStateFlags state;
/* For metapacket we always establish writeable mappings */
void *metaPacket;
size_t metaPacketSize;
uint32 metaPacketMappedIov;
size_t metaPacketDataSize;
Bool metaPacketIsAllocated;
MappingType metaMappingType;
void *dataPacket;
size_t dataPacketSize;
uint32 dataPacketMappedIov;
size_t dataPacketDataSize;
uint32 dataPacketIovIndex;
Bool dataPacketIsAllocated;
/* What type of mapping was established - readable/ writeable ? */
MappingType dataMappingType;
void *replyPacket;
size_t replyPacketSize;
size_t replyPacketDataSize;
Bool replyPacketIsAllocated;
/* Iov for the packet private to the channel. */
HgfsVmxIov channelIov[2];
uint32 iovCount;
HgfsVmxIov iov[1];
} HgfsPacket;
/*
* Function used for sending replies to the client for a session.
* Passed by the caller at session connect time.
*/
/*
* Send flags.
*
* Contains a bitwise OR of a combination of the following flags:
* HGFS_SEND_CAN_DELAY - directs the channel to try and optimize
* otherwise it will send the data immediately.
* HGFS_SEND_NO_COMPLETE - directs the channel to not call the
* send complete callback. Caller does not call completion notification
* callback, for example to free buffers.
*/
typedef uint32 HgfsSendFlags;
#define HGFS_SEND_CAN_DELAY (1 << 0)
#define HGFS_SEND_NO_COMPLETE (1 << 1)
// Channel capability flags
typedef uint32 HgfsChannelFlags;
#define HGFS_CHANNEL_SHARED_MEM (1 << 0)
#define HGFS_CHANNEL_ASYNC (1 << 1)
typedef struct HgfsServerChannelData {
HgfsChannelFlags flags;
uint32 maxPacketSize;
}HgfsServerChannelData;
/* Default maximum number of open nodes. */
#define HGFS_MAX_CACHED_FILENODES 30
typedef uint32 HgfsConfigFlags;
#define HGFS_CONFIG_USE_HOST_TIME (1 << 0)
#define HGFS_CONFIG_NOTIFY_ENABLED (1 << 1)
#define HGFS_CONFIG_VOL_INFO_MIN (1 << 2)
#define HGFS_CONFIG_OPLOCK_ENABLED (1 << 3)
#define HGFS_CONFIG_SHARE_ALL_HOST_DRIVES_ENABLED (1 << 4)
typedef struct HgfsServerConfig {
HgfsConfigFlags flags;
uint32 maxCachedOpenNodes;
}HgfsServerConfig;
/*
* Function used to notify HGFS server that a shared folder has been created or updated.
* It allows HGFS server to maintain up-to-date list of shared folders and its
* properties.
*/
typedef uint32 HgfsSharedFolderHandle;
#define HGFS_INVALID_FOLDER_HANDLE ((HgfsSharedFolderHandle)~((HgfsSharedFolderHandle)0))
typedef HgfsSharedFolderHandle (*HgfsRegisterSharedFolderFunc)(const char *shareName,
const char *sharePath,
Bool addFolder);
/*
* Callback functions to enumerate the share resources.
* Filled in by the HGFS server policy and passed in to the HGFS server
* so that it can call out to them to enumerate the shares.
*/
typedef void * (*HgfsServerResEnumInitFunc)(void);
typedef Bool (*HgfsServerResEnumGetFunc)(void *data,
char const **name,
size_t *len,
Bool *done);
typedef Bool (*HgfsServerResEnumExitFunc)(void *);
typedef struct HgfsServerResEnumCallbacks {
HgfsServerResEnumInitFunc init;
HgfsServerResEnumGetFunc get;
HgfsServerResEnumExitFunc exit;
} HgfsServerResEnumCallbacks;
/*
* Server Manager callback functions to enumerate the share resources and state logging.
* Passed to the HGFS server on initialization.
*/
typedef struct HgfsServerMgrCallbacks {
HgfsServerResEnumCallbacks enumResources;
} HgfsServerMgrCallbacks;
/*
* Function used for invalidating nodes and searches that fall outside of a
* share when the list of shares changes.
*/
typedef void (*HgfsInvalidateObjectsFunc)(DblLnkLst_Links *shares);
typedef Bool (*HgfsChannelSendFunc)(void *opaqueSession,
HgfsPacket *packet,
HgfsSendFlags flags);
typedef void * (*HgfsChannelMapVirtAddrFunc)(uint64 pa, uint32 size, void **context);
typedef void (*HgfsChannelUnmapVirtAddrFunc)(void **context);
typedef struct HgfsServerChannelCallbacks {
HgfsChannelMapVirtAddrFunc getReadVa;
HgfsChannelMapVirtAddrFunc getWriteVa;
HgfsChannelUnmapVirtAddrFunc putVa;
HgfsChannelSendFunc send;
}HgfsServerChannelCallbacks;
typedef struct HgfsServerSessionCallbacks {
Bool (*connect)(void *, HgfsServerChannelCallbacks *, HgfsServerChannelData *,void **);
void (*disconnect)(void *);
void (*close)(void *);
void (*receive)(HgfsPacket *packet, void *);
void (*invalidateObjects)(void *, DblLnkLst_Links *);
uint32 (*invalidateInactiveSessions)(void *);
void (*sendComplete)(HgfsPacket *, void *);
} HgfsServerSessionCallbacks;
typedef struct HgfsServerCallbacks {
HgfsServerSessionCallbacks session;
HgfsRegisterSharedFolderFunc registerShare;
} HgfsServerCallbacks;
Bool HgfsServer_InitState(HgfsServerCallbacks **,
HgfsServerConfig *,
HgfsServerMgrCallbacks *);
void HgfsServer_ExitState(void);
uint32 HgfsServer_GetHandleCounter(void);
void HgfsServer_SetHandleCounter(uint32 newHandleCounter);
void HgfsServer_Quiesce(Bool freeze);
#endif // _HGFS_SERVER_H_
|