VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.h@ 23835

Last change on this file since 23835 was 21511, checked in by vboxsync, 15 years ago

vboxvfs/linux: playing with using physical page lists for writing. Tiny speed up.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/** @file
2 * VBoxGuestLib - Central calls header.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
17 * Clara, CA 95054 USA or visit http://www.sun.com if you need
18 * additional information or have any questions.
19 */
20
21#ifndef __VBOXCALLS__H
22#define __VBOXCALLS__H
23
24#include <VBox/VBoxGuestLib.h>
25#ifndef _NTIFS_
26# ifdef RT_OS_WINDOWS
27# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
28# include <iprt/asm.h>
29# define _InterlockedExchange _InterlockedExchange_StupidDDKvsCompilerCrap
30# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKvsCompilerCrap
31# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKvsCompilerCrap
32# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKvsCompilerCrap
33# pragma warning(disable : 4163)
34 RT_C_DECLS_BEGIN
35# include <ntddk.h>
36 RT_C_DECLS_END
37# pragma warning(default : 4163)
38# undef _InterlockedExchange
39# undef _InterlockedExchangeAdd
40# undef _InterlockedCompareExchange
41# undef _InterlockedAddLargeStatistic
42# else
43 RT_C_DECLS_BEGIN
44# include <ntddk.h>
45 RT_C_DECLS_END
46# endif
47# endif
48#endif
49
50#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
51/** @todo remove this legacy and use VBox/log.h and/or iprt/log.h. */
52# ifdef DEBUG
53# define LOG_ENABLED
54# endif
55# include "VBoxGuestLog.h"
56#endif
57
58#include <iprt/assert.h>
59#define ASSERTVBSF AssertRelease
60
61#include <VBox/shflsvc.h>
62
63typedef struct _VBSFCLIENT
64{
65 uint32_t ulClientID;
66 VBGLHGCMHANDLE handle;
67} VBSFCLIENT;
68typedef VBSFCLIENT *PVBSFCLIENT;
69
70typedef struct _VBSFMAP
71{
72 SHFLROOT root;
73} VBSFMAP, *PVBSFMAP;
74
75
76#define VBSF_DRIVE_LETTER_FIRST L'A'
77#define VBSF_DRIVE_LETTER_LAST L'Z'
78
79#define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
80
81/* Poller thread flags. */
82#define VBSF_TF_NONE (0x0000)
83#define VBSF_TF_STARTED (0x0001)
84#define VBSF_TF_TERMINATE (0x0002)
85#define VBSF_TF_START_PROCESSING (0x0004)
86
87#define DRIVE_FLAG_WORKING (0x1)
88#define DRIVE_FLAG_LOCKED (0x2)
89#define DRIVE_FLAG_WRITE_PROTECTED (0x4)
90
91#ifdef RT_OS_WINDOWS
92/** Device extension structure for each drive letter we created. */
93typedef struct _VBSFDRIVE
94{
95 /* A pointer to the Driver object we created for the drive. */
96 PDEVICE_OBJECT pDeviceObject;
97
98 /** Root handle to access the drive. */
99 SHFLROOT root;
100
101 /** Informational string - the resource name on host. */
102 WCHAR awcNameHost[256];
103
104 /** Guest drive letter. */
105 WCHAR wcDriveLetter;
106
107 /** DRIVE_FLAG_* */
108 uint32_t u32DriveFlags;
109
110 /** Head of FCB list. */
111 LIST_ENTRY FCBHead;
112
113 /* Synchronise requests directed to the drive. */
114 ERESOURCE DriveResource;
115} VBSFDRIVE;
116typedef VBSFDRIVE *PVBSFDRIVE;
117#endif /* RT_OS_WINDOWS */
118
119/* forward decl */
120struct _MRX_VBOX_DEVICE_EXTENSION;
121typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
122
123DECLVBGL(int) vboxInit (void);
124DECLVBGL(void) vboxUninit (void);
125DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
126DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
127
128DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
129
130DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
131
132/**
133 * Create a new file or folder or open an existing one in a shared folder. Proxies
134 * to vbsfCreate in the host shared folder service.
135 *
136 * @returns IPRT status code, but see note below
137 * @param pClient Host-guest communication connection
138 * @param pMap The mapping for the shared folder in which the file
139 * or folder is to be created
140 * @param pParsedPath The path of the file or folder relative to the shared
141 * folder
142 * @param pCreateParms Parameters for file/folder creation. See the
143 * structure description in shflsvc.h
144 * @retval pCreateParms See the structure description in shflsvc.h
145 *
146 * @note This function reports errors as follows. The return value is always
147 * VINF_SUCCESS unless an exceptional condition occurrs - out of
148 * memory, invalid arguments, etc. If the file or folder could not be
149 * opened or created, pCreateParms->Handle will be set to
150 * SHFL_HANDLE_NIL on return. In this case the value in
151 * pCreateParms->Result provides information as to why (e.g.
152 * SHFL_FILE_EXISTS). pCreateParms->Result is also set on success
153 * as additional information.
154 */
155DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
156
157DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
158DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
159DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
160DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
161
162DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
163DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
164DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
165
166DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
167
168DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
169 uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
170DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
171
172DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
173DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
174DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
175
176#endif /* __VBOXCALLS__H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette