VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h@ 44558

Last change on this file since 44558 was 44558, checked in by vboxsync, 12 years ago

VBOXSF: use page list for read/write buffer.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 KB
Line 
1/** @file
2 * VBoxGuestLib - Central calls header.
3 */
4
5/*
6 * Copyright (C) 2006-2013 Oracle Corporation
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 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h
27#define ___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h
28
29#include <VBox/VBoxGuestLib.h>
30#ifndef _NTIFS_
31# ifdef RT_OS_WINDOWS
32# undef PAGE_SIZE
33# undef PAGE_SHIFT
34# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
35# include <iprt/asm.h>
36# define _InterlockedExchange _InterlockedExchange_StupidDDKvsCompilerCrap
37# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKvsCompilerCrap
38# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKvsCompilerCrap
39# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKvsCompilerCrap
40# pragma warning(disable : 4163)
41 RT_C_DECLS_BEGIN
42# include <ntddk.h>
43 RT_C_DECLS_END
44# pragma warning(default : 4163)
45# undef _InterlockedExchange
46# undef _InterlockedExchangeAdd
47# undef _InterlockedCompareExchange
48# undef _InterlockedAddLargeStatistic
49# else
50 RT_C_DECLS_BEGIN
51# include <ntddk.h>
52 RT_C_DECLS_END
53# endif
54# endif
55#endif
56
57#if defined(RT_OS_WINDOWS) && 0
58/** @todo remove this legacy and use VBox/log.h and/or iprt/log.h. */
59/* => Done. The next person who needs logging in Windows guests will have the
60 * honour of making it work. */
61# ifdef DEBUG
62# define LOG_ENABLED
63# endif
64# include "VBoxGuestLog.h"
65#endif
66#if defined(RT_OS_WINDOWS)
67# include <VBox/log.h>
68#endif
69
70#include <iprt/assert.h>
71#define ASSERTVBSF AssertRelease
72
73#include <VBox/shflsvc.h>
74
75typedef struct _VBSFCLIENT
76{
77 uint32_t ulClientID;
78 VBGLHGCMHANDLE handle;
79} VBSFCLIENT;
80typedef VBSFCLIENT *PVBSFCLIENT;
81
82typedef struct _VBSFMAP
83{
84 SHFLROOT root;
85} VBSFMAP, *PVBSFMAP;
86
87
88#define VBSF_DRIVE_LETTER_FIRST L'A'
89#define VBSF_DRIVE_LETTER_LAST L'Z'
90
91#define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
92
93/* Poller thread flags. */
94#define VBSF_TF_NONE (0x0000)
95#define VBSF_TF_STARTED (0x0001)
96#define VBSF_TF_TERMINATE (0x0002)
97#define VBSF_TF_START_PROCESSING (0x0004)
98
99#define DRIVE_FLAG_WORKING (0x1)
100#define DRIVE_FLAG_LOCKED (0x2)
101#define DRIVE_FLAG_WRITE_PROTECTED (0x4)
102
103#ifdef RT_OS_WINDOWS
104/** Device extension structure for each drive letter we created. */
105typedef struct _VBSFDRIVE
106{
107 /* A pointer to the Driver object we created for the drive. */
108 PDEVICE_OBJECT pDeviceObject;
109
110 /** Root handle to access the drive. */
111 SHFLROOT root;
112
113 /** Informational string - the resource name on host. */
114 WCHAR awcNameHost[256];
115
116 /** Guest drive letter. */
117 WCHAR wcDriveLetter;
118
119 /** DRIVE_FLAG_* */
120 uint32_t u32DriveFlags;
121
122 /** Head of FCB list. */
123 LIST_ENTRY FCBHead;
124
125 /* Synchronise requests directed to the drive. */
126 ERESOURCE DriveResource;
127} VBSFDRIVE;
128typedef VBSFDRIVE *PVBSFDRIVE;
129#endif /* RT_OS_WINDOWS */
130
131/* forward decl */
132struct _MRX_VBOX_DEVICE_EXTENSION;
133typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
134
135DECLVBGL(int) vboxInit (void);
136DECLVBGL(void) vboxUninit (void);
137DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
138DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
139
140DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
141
142DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
143
144/**
145 * Create a new file or folder or open an existing one in a shared folder. Proxies
146 * to vbsfCreate in the host shared folder service.
147 *
148 * @returns IPRT status code, but see note below
149 * @param pClient Host-guest communication connection
150 * @param pMap The mapping for the shared folder in which the file
151 * or folder is to be created
152 * @param pParsedPath The path of the file or folder relative to the shared
153 * folder
154 * @param pCreateParms Parameters for file/folder creation. See the
155 * structure description in shflsvc.h
156 * @retval pCreateParms See the structure description in shflsvc.h
157 *
158 * @note This function reports errors as follows. The return value is always
159 * VINF_SUCCESS unless an exceptional condition occurs - out of
160 * memory, invalid arguments, etc. If the file or folder could not be
161 * opened or created, pCreateParms->Handle will be set to
162 * SHFL_HANDLE_NIL on return. In this case the value in
163 * pCreateParms->Result provides information as to why (e.g.
164 * SHFL_FILE_EXISTS). pCreateParms->Result is also set on success
165 * as additional information.
166 */
167DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
168
169DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
170DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
171DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
172DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
173
174DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
175DECLVBGL(int) VbglR0SharedFolderReadPageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
176 uint64_t offset, uint32_t *pcbBuffer,
177 uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
178DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
179DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
180DECLVBGL(int) VbglR0SharedFolderWritePageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
181 uint64_t offset, uint32_t *pcbBuffer,
182 uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
183
184DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
185
186DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
187 uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
188DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
189
190DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
191DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
192DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
193
194DECLVBGL(int) vboxReadLink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING ParsedPath, uint32_t pcbBuffer, uint8_t *pBuffer);
195DECLVBGL(int) vboxCallSymlink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pNewPath, PSHFLSTRING pOldPath, PSHFLFSOBJINFO pBuffer);
196DECLVBGL(int) vboxCallSetSymlinks (PVBSFCLIENT pClient);
197
198#endif /* !___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h */
199
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