VirtualBox

source: vbox/trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h@ 81245

最後變更 在這個檔案從81245是 79112,由 vboxsync 提交於 6 年 前

os2/VBoxSF: More EA fun, now for CMD.EXE opening files for copying. Ignore empty EAOPs and non-creation/replace opens.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 9.1 KB
 
1/** $Id: VBoxSFInternal.h 79112 2019-06-13 03:33:29Z vboxsync $ */
2/** @file
3 * VBoxSF - OS/2 Shared Folder IFS, Internal Header.
4 */
5
6/*
7 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#ifndef GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h
32#define GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h
33#ifndef RT_WITHOUT_PRAGMA_ONCE
34# pragma once
35#endif
36
37
38#define INCL_BASE
39#define INCL_ERROR
40#define INCL_LONGLONG
41#define OS2EMX_PLAIN_CHAR
42#include <os2ddk/bsekee.h>
43#include <os2ddk/devhlp.h>
44#include <os2ddk/unikern.h>
45#include <os2ddk/fsd.h>
46#undef RT_MAX
47
48#include <iprt/types.h>
49#include <iprt/assert.h>
50#include <iprt/list.h>
51#include <VBox/VBoxGuest.h>
52#include <VBox/VBoxGuestLibSharedFoldersInline.h>
53
54
55/** Allocation header used by RTMemAlloc.
56 * This should be subtracted from round numbers. */
57#define ALLOC_HDR_SIZE (0x10 + 4)
58
59
60/**
61 * A shared folder
62 */
63typedef struct VBOXSFFOLDER
64{
65 /** For the shared folder list. */
66 RTLISTNODE ListEntry;
67 /** Magic number (VBOXSFFOLDER_MAGIC). */
68 uint32_t u32Magic;
69 /** Number of active references to this folder. */
70 uint32_t volatile cRefs;
71 /** Number of open files referencing this folder. */
72 uint32_t volatile cOpenFiles;
73 /** Number of open searches referencing this folder. */
74 uint32_t volatile cOpenSearches;
75 /** Number of drives this is attached to. */
76 uint8_t volatile cDrives;
77
78 /** The host folder handle. */
79 SHFLROOT idHostRoot;
80
81 /** OS/2 volume handle. */
82 USHORT hVpb;
83
84 /** The length of the name and tag, including zero terminators and such. */
85 uint16_t cbNameAndTag;
86 /** The length of the folder name. */
87 uint8_t cchName;
88 /** The shared folder name. If there is a tag it follows as a second string. */
89 char szName[RT_FLEXIBLE_ARRAY];
90} VBOXSFFOLDER;
91/** Pointer to a shared folder. */
92typedef VBOXSFFOLDER *PVBOXSFFOLDER;
93/** Magic value for VBOXSFVP (Neal Town Stephenson). */
94#define VBOXSFFOLDER_MAGIC UINT32_C(0x19591031)
95
96/** The shared mutex protecting folders list, drives and the connection. */
97extern MutexLock_t g_MtxFolders;
98/** List of active folder (PVBOXSFFOLDER). */
99extern RTLISTANCHOR g_FolderHead;
100
101
102/**
103 * VBoxSF Volume Parameter Structure.
104 *
105 * @remarks Overlays the 36 byte VPFSD structure (fsd.h).
106 * @note No self pointer as the kernel may reallocate these.
107 */
108typedef struct VBOXSFVP
109{
110 /** Magic value (VBOXSFVP_MAGIC). */
111 uint32_t u32Magic;
112 /** The folder. */
113 PVBOXSFFOLDER pFolder;
114} VBOXSFVP;
115AssertCompile(sizeof(VBOXSFVP) <= sizeof(VPFSD));
116/** Pointer to a VBOXSFVP struct. */
117typedef VBOXSFVP *PVBOXSFVP;
118/** Magic value for VBOXSFVP (Laurence van Cott Niven). */
119#define VBOXSFVP_MAGIC UINT32_C(0x19380430)
120
121
122/**
123 * VBoxSF Current Directory Structure.
124 *
125 * @remark Overlays the 8 byte CDFSD structure (fsd.h).
126 */
127typedef struct VBOXSFCD
128{
129 uint32_t u32Dummy;
130} VBOXSFCD;
131AssertCompile(sizeof(VBOXSFCD) <= sizeof(CDFSD));
132/** Pointer to a VBOXSFCD struct. */
133typedef VBOXSFCD *PVBOXSFCD;
134
135
136/**
137 * VBoxSF System File Structure.
138 *
139 * @remark Overlays the 30 byte SFFSD structure (fsd.h).
140 */
141typedef struct VBOXSFSYFI
142{
143 /** Magic value (VBOXSFSYFI_MAGIC). */
144 uint32_t u32Magic;
145 /** Self pointer for quick 16:16 to flat translation. */
146 struct VBOXSFSYFI *pSelf;
147 /** The host file handle. */
148 SHFLHANDLE hHostFile;
149 /** The shared folder (referenced). */
150 PVBOXSFFOLDER pFolder;
151} VBOXSFSYFI;
152AssertCompile(sizeof(VBOXSFSYFI) <= sizeof(SFFSD));
153/** Pointer to a VBOXSFSYFI struct. */
154typedef VBOXSFSYFI *PVBOXSFSYFI;
155/** Magic value for VBOXSFSYFI (Jon Ellis Meacham). */
156#define VBOXSFSYFI_MAGIC UINT32_C(0x19690520)
157
158
159/**
160 * More file search data (on physical heap).
161 */
162typedef struct VBOXSFFSBUF /**< @todo rename as is no longer buffer. */
163{
164 /** The request (must be first). */
165 VBOXSFLISTDIRREQ Req;
166 /** A magic number (VBOXSFFSBUF_MAGIC). */
167 uint32_t u32Magic;
168 /** The filter string (full path), NULL if all files are request. */
169 PSHFLSTRING pFilter;
170 /** Size of the buffer for directory entries. */
171 uint32_t cbBuf;
172 /** Buffer for directory entries on the physical heap. */
173 PSHFLDIRINFO pBuf;
174 /** Must have attributes (shifted down DOS attributes). */
175 uint8_t fMustHaveAttribs;
176 /** Non-matching attributes (shifted down DOS attributes). */
177 uint8_t fExcludedAttribs;
178 /** Set if FF_ATTR_LONG_FILENAME. */
179 bool fLongFilenames : 1;
180 uint8_t bPadding1;
181 /** The local time offset to use for this search. */
182 int16_t cMinLocalTimeDelta;
183 uint8_t abPadding2[2];
184 /** Number of valid bytes in the buffer. */
185 uint32_t cbValid;
186 /** Number of entries left in the buffer. */
187 uint32_t cEntriesLeft;
188 /** The next entry. */
189 PSHFLDIRINFO pEntry;
190 //uint32_t uPadding3;
191 /** Staging area for staging a full FILEFINDBUF4L (+ 32 safe bytes). */
192 uint8_t abStaging[RT_ALIGN_32(sizeof(FILEFINDBUF4L) + 32, 8)];
193} VBOXSFFSBUF;
194/** Pointer to a file search buffer. */
195typedef VBOXSFFSBUF *PVBOXSFFSBUF;
196/** Magic number for VBOXSFFSBUF (Robert Anson Heinlein). */
197#define VBOXSFFSBUF_MAGIC UINT32_C(0x19070707)
198
199
200/**
201 * VBoxSF File Search Structure.
202 *
203 * @remark Overlays the 24 byte FSFSD structure (fsd.h).
204 * @note No self pointer as the kernel may reallocate these.
205 */
206typedef struct VBOXSFFS
207{
208 /** Magic value (VBOXSFFS_MAGIC). */
209 uint32_t u32Magic;
210 /** The last file position position. */
211 uint32_t offLastFile;
212 /** The host directory handle. */
213 SHFLHANDLE hHostDir;
214 /** The shared folder (referenced). */
215 PVBOXSFFOLDER pFolder;
216 /** Search data buffer. */
217 PVBOXSFFSBUF pBuf;
218} VBOXSFFS;
219AssertCompile(sizeof(VBOXSFFS) <= sizeof(FSFSD));
220/** Pointer to a VBOXSFFS struct. */
221typedef VBOXSFFS *PVBOXSFFS;
222/** Magic number for VBOXSFFS (Isaak Azimov). */
223#define VBOXSFFS_MAGIC UINT32_C(0x19200102)
224
225
226extern VBGLSFCLIENT g_SfClient;
227extern uint32_t g_fHostFeatures;
228
229void vboxSfOs2InitFileBuffers(void);
230PSHFLSTRING vboxSfOs2StrAlloc(size_t cwcLength);
231PSHFLSTRING vboxSfOs2StrDup(PCSHFLSTRING pSrc);
232void vboxSfOs2StrFree(PSHFLSTRING pStr);
233
234APIRET vboxSfOs2ResolvePath(const char *pszPath, PVBOXSFCD pCdFsd, LONG offCurDirEnd,
235 PVBOXSFFOLDER *ppFolder, PSHFLSTRING *ppStrFolderPath);
236APIRET vboxSfOs2ResolvePathEx(const char *pszPath, PVBOXSFCD pCdFsd, LONG offCurDirEnd, uint32_t offStrInBuf,
237 PVBOXSFFOLDER *ppFolder, void **ppvBuf);
238void vboxSfOs2ReleasePathAndFolder(PSHFLSTRING pStrPath, PVBOXSFFOLDER pFolder);
239void vboxSfOs2ReleaseFolder(PVBOXSFFOLDER pFolder);
240APIRET vboxSfOs2ConvertStatusToOs2(int vrc, APIRET rcDefault);
241int16_t vboxSfOs2GetLocalTimeDelta(void);
242void vboxSfOs2DateTimeFromTimeSpec(FDATE *pDosDate, FTIME *pDosTime, RTTIMESPEC SrcTimeSpec, int16_t cMinLocalTimeDelta);
243PRTTIMESPEC vboxSfOs2DateTimeToTimeSpec(FDATE DosDate, FTIME DosTime, int16_t cMinLocalTimeDelta, PRTTIMESPEC pDstTimeSpec);
244APIRET vboxSfOs2FileStatusFromObjInfo(PBYTE pbDst, ULONG cbDst, ULONG uLevel, SHFLFSOBJINFO const *pSrc);
245APIRET vboxSfOs2SetInfoCommonWorker(PVBOXSFFOLDER pFolder, SHFLHANDLE hHostFile, ULONG fAttribs,
246 PFILESTATUS pTimestamps, PSHFLFSOBJINFO pObjInfoBuf, uint32_t offObjInfoInAlloc);
247
248APIRET vboxSfOs2CheckEaOpForCreation(EAOP const *pEaOp);
249APIRET vboxSfOs2MakeEmptyEaList(PEAOP pEaOp, ULONG uLevel);
250APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, uint32_t *pcbWritten, ULONG *poffError);
251
252DECLASM(PVBOXSFVP) Fsh32GetVolParams(USHORT hVbp, PVPFSI *ppVpFsi /*optional*/);
253DECLASM(APIRET) SafeKernStrToUcs(PUconvObj, UniChar *, char *, LONG, LONG);
254DECLASM(APIRET) SafeKernStrFromUcs(PUconvObj, char *, UniChar *, LONG, LONG);
255
256
257#endif /* !GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h */
258
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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