Changeset 76716 in vbox
- Timestamp:
- Jan 8, 2019 11:36:02 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLibSharedFoldersInline.h
r76715 r76716 1 /* *$Id$ */1 /* $Id$ */ 2 2 /** @file 3 * VBox SF - OS/2 Shared Folder IFS, Internal Header.3 * VBoxGuestLib - Shared Folders Host Request Helpers (ring-0). 4 4 */ 5 5 6 6 /* 7 * Copyright ( c) 2007 knut st. osmundsen <[email protected]>7 * Copyright (C) 2006-2019 Oracle Corporation 8 8 * 9 9 * Permission is hereby granted, free of charge, to any person … … 22 22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING … … 29 29 */ 30 30 31 #ifndef GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h32 #define GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h31 #ifndef VBOX_INCLUDED_VBoxGuestLibSharedFoldersInline_h 32 #define VBOX_INCLUDED_VBoxGuestLibSharedFoldersInline_h 33 33 #ifndef RT_WITHOUT_PRAGMA_ONCE 34 34 # pragma once 35 35 #endif 36 36 37 38 #define INCL_BASE39 #define INCL_ERROR40 #define INCL_LONGLONG41 #define OS2EMX_PLAIN_CHAR42 #include <os2ddk/bsekee.h>43 #include <os2ddk/devhlp.h>44 #include <os2ddk/unikern.h>45 #include <os2ddk/fsd.h>46 #undef RT_MAX47 48 37 #include <iprt/types.h> 49 38 #include <iprt/assert.h> 50 #include <iprt/list.h> 39 #include <VBox/shflsvc.h> 40 #include <VBox/VBoxGuest.h> 41 #include <VBox/VBoxGuestLib.h> 51 42 #include <VBox/VBoxGuestLibSharedFolders.h> 52 #include <VBox/VBoxGuest.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 */ 63 typedef 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. */ 92 typedef 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. */ 97 extern MutexLock_t g_MtxFolders; 98 /** List of active folder (PVBOXSFFOLDER). */ 99 extern 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 */ 108 typedef struct VBOXSFVP 109 { 110 /** Magic value (VBOXSFVP_MAGIC). */ 111 uint32_t u32Magic; 112 /** The folder. */ 113 PVBOXSFFOLDER pFolder; 114 } VBOXSFVP; 115 AssertCompile(sizeof(VBOXSFVP) <= sizeof(VPFSD)); 116 /** Pointer to a VBOXSFVP struct. */ 117 typedef 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 */ 127 typedef struct VBOXSFCD 128 { 129 uint32_t u32Dummy; 130 } VBOXSFCD; 131 AssertCompile(sizeof(VBOXSFCD) <= sizeof(CDFSD)); 132 /** Pointer to a VBOXSFCD struct. */ 133 typedef VBOXSFCD *PVBOXSFCD; 134 135 136 /** 137 * VBoxSF System File Structure. 138 * 139 * @remark Overlays the 30 byte SFFSD structure (fsd.h). 140 */ 141 typedef 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; 152 AssertCompile(sizeof(VBOXSFSYFI) <= sizeof(SFFSD)); 153 /** Pointer to a VBOXSFSYFI struct. */ 154 typedef VBOXSFSYFI *PVBOXSFSYFI; 155 /** Magic value for VBOXSFSYFI (Jon Ellis Meacham). */ 156 #define VBOXSFSYFI_MAGIC UINT32_C(0x19690520) 157 158 159 /** Request structure for vboxSfOs2HostReqListDir. */ 160 typedef struct VBOXSFLISTDIRREQ 161 { 162 VBGLIOCIDCHGCMFASTCALL Hdr; 163 VMMDevHGCMCall Call; 164 VBoxSFParmList Parms; 165 HGCMPageListInfo StrPgLst; 166 HGCMPageListInfo BufPgLst; 167 } VBOXSFLISTDIRREQ; 168 169 /** 170 * More file search data (on physical heap). 171 */ 172 typedef struct VBOXSFFSBUF /**< @todo rename as is no longer buffer. */ 173 { 174 /** The request (must be first). */ 175 VBOXSFLISTDIRREQ Req; 176 /** A magic number (VBOXSFFSBUF_MAGIC). */ 177 uint32_t u32Magic; 178 /** The filter string (full path), NULL if all files are request. */ 179 PSHFLSTRING pFilter; 180 /** Size of the buffer for directory entries. */ 181 uint32_t cbBuf; 182 /** Buffer for directory entries on the physical heap. */ 183 PSHFLDIRINFO pBuf; 184 /** Must have attributes (shifted down DOS attributes). */ 185 uint8_t fMustHaveAttribs; 186 /** Non-matching attributes (shifted down DOS attributes). */ 187 uint8_t fExcludedAttribs; 188 /** Set if FF_ATTR_LONG_FILENAME. */ 189 bool fLongFilenames : 1; 190 uint8_t bPadding1; 191 /** The local time offset to use for this search. */ 192 int16_t cMinLocalTimeDelta; 193 uint8_t abPadding2[2]; 194 /** Number of valid bytes in the buffer. */ 195 uint32_t cbValid; 196 /** Number of entries left in the buffer. */ 197 uint32_t cEntriesLeft; 198 /** The next entry. */ 199 PSHFLDIRINFO pEntry; 200 //uint32_t uPadding3; 201 /** Staging area for staging a full FILEFINDBUF4L (+ 32 safe bytes). */ 202 uint8_t abStaging[RT_ALIGN_32(sizeof(FILEFINDBUF4L) + 32, 8)]; 203 } VBOXSFFSBUF; 204 /** Pointer to a file search buffer. */ 205 typedef VBOXSFFSBUF *PVBOXSFFSBUF; 206 /** Magic number for VBOXSFFSBUF (Robert Anson Heinlein). */ 207 #define VBOXSFFSBUF_MAGIC UINT32_C(0x19070707) 208 209 210 /** 211 * VBoxSF File Search Structure. 212 * 213 * @remark Overlays the 24 byte FSFSD structure (fsd.h). 214 * @note No self pointer as the kernel may reallocate these. 215 */ 216 typedef struct VBOXSFFS 217 { 218 /** Magic value (VBOXSFFS_MAGIC). */ 219 uint32_t u32Magic; 220 /** The last file position position. */ 221 uint32_t offLastFile; 222 /** The host directory handle. */ 223 SHFLHANDLE hHostDir; 224 /** The shared folder (referenced). */ 225 PVBOXSFFOLDER pFolder; 226 /** Search data buffer. */ 227 PVBOXSFFSBUF pBuf; 228 } VBOXSFFS; 229 AssertCompile(sizeof(VBOXSFFS) <= sizeof(FSFSD)); 230 /** Pointer to a VBOXSFFS struct. */ 231 typedef VBOXSFFS *PVBOXSFFS; 232 /** Magic number for VBOXSFFS (Isaak Azimov). */ 233 #define VBOXSFFS_MAGIC UINT32_C(0x19200102) 234 235 236 extern VBGLSFCLIENT g_SfClient; 237 extern uint32_t g_fHostFeatures; 238 239 void vboxSfOs2InitFileBuffers(void); 240 PSHFLSTRING vboxSfOs2StrAlloc(size_t cwcLength); 241 PSHFLSTRING vboxSfOs2StrDup(PCSHFLSTRING pSrc); 242 void vboxSfOs2StrFree(PSHFLSTRING pStr); 243 244 APIRET vboxSfOs2ResolvePath(const char *pszPath, PVBOXSFCD pCdFsd, LONG offCurDirEnd, 245 PVBOXSFFOLDER *ppFolder, PSHFLSTRING *ppStrFolderPath); 246 APIRET vboxSfOs2ResolvePathEx(const char *pszPath, PVBOXSFCD pCdFsd, LONG offCurDirEnd, uint32_t offStrInBuf, 247 PVBOXSFFOLDER *ppFolder, void **ppvBuf); 248 void vboxSfOs2ReleasePathAndFolder(PSHFLSTRING pStrPath, PVBOXSFFOLDER pFolder); 249 void vboxSfOs2ReleaseFolder(PVBOXSFFOLDER pFolder); 250 APIRET vboxSfOs2ConvertStatusToOs2(int vrc, APIRET rcDefault); 251 int16_t vboxSfOs2GetLocalTimeDelta(void); 252 void vboxSfOs2DateTimeFromTimeSpec(FDATE *pDosDate, FTIME *pDosTime, RTTIMESPEC SrcTimeSpec, int16_t cMinLocalTimeDelta); 253 PRTTIMESPEC vboxSfOs2DateTimeToTimeSpec(FDATE DosDate, FTIME DosTime, int16_t cMinLocalTimeDelta, PRTTIMESPEC pDstTimeSpec); 254 APIRET vboxSfOs2FileStatusFromObjInfo(PBYTE pbDst, ULONG cbDst, ULONG uLevel, SHFLFSOBJINFO const *pSrc); 255 APIRET vboxSfOs2SetInfoCommonWorker(PVBOXSFFOLDER pFolder, SHFLHANDLE hHostFile, ULONG fAttribs, 256 PFILESTATUS pTimestamps, PSHFLFSOBJINFO pObjInfoBuf, uint32_t offObjInfoInAlloc); 257 APIRET vboxSfOs2MakeEmptyEaList(PEAOP pEaOp, ULONG uLevel); 258 APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, uint32_t *pcbWritten, ULONG *poffError); 259 260 DECLASM(PVBOXSFVP) Fsh32GetVolParams(USHORT hVbp, PVPFSI *ppVpFsi /*optional*/); 261 262 263 /** @name Host request helpers 43 #include <VBox/VMMDev.h> 44 #include <iprt/errcore.h> 45 46 47 /** @defgroup grp_vboxguest_lib_r0_sf_inline Shared Folders Host Request Helpers 48 * @ingroup grp_vboxguest_lib_r0 264 49 * 265 50 * @todo generalize these and put back into VbglR0Sf. … … 267 52 * @{ */ 268 53 269 #include <iprt/err.h> 270 271 /** Request structure for vboxSfOs2HostReqMapFolderWithBuf. */ 54 /** VMMDEV_HVF_XXX (set during init). */ 55 extern uint32_t g_fHostFeatures; 56 extern VBGLSFCLIENT g_SfClient; /**< Move this into the parameters. */ 57 58 /** Request structure for VbglR0SfHostReqMapFolderWithBuf. */ 272 59 typedef struct VBOXSFMAPFOLDERWITHBUFREQ 273 60 { … … 281 68 * SHFL_FN_MAP_FOLDER request. 282 69 */ 283 DECLINLINE(int) vboxSfOs2HostReqMapFolderWithBuf(VBOXSFMAPFOLDERWITHBUFREQ *pReq, PSHFLSTRING pStrName,284 70 DECLINLINE(int) VbglR0SfHostReqMapFolderWithBuf(VBOXSFMAPFOLDERWITHBUFREQ *pReq, PSHFLSTRING pStrName, 71 RTUTF16 wcDelimiter, bool fCaseSensitive) 285 72 { 286 73 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 334 121 * SHFL_FN_UNMAP_FOLDER request. 335 122 */ 336 DECLINLINE(int) vboxSfOs2HostReqUnmapFolderSimple(uint32_t idRoot)123 DECLINLINE(int) VbglR0SfHostReqUnmapFolderSimple(uint32_t idRoot) 337 124 { 338 125 VBOXSFUNMAPFOLDERREQ *pReq = (VBOXSFUNMAPFOLDERREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); … … 356 143 357 144 358 /** Request structure for vboxSfOs2HostReqCreate. */145 /** Request structure for VbglR0SfHostReqCreate. */ 359 146 typedef struct VBOXSFCREATEREQ 360 147 { … … 369 156 * SHFL_FN_CREATE request. 370 157 */ 371 DECLINLINE(int) vboxSfOs2HostReqCreate(SHFLROOT idRoot, VBOXSFCREATEREQ *pReq)158 DECLINLINE(int) VbglR0SfHostReqCreate(SHFLROOT idRoot, VBOXSFCREATEREQ *pReq) 372 159 { 373 160 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS … … 410 197 411 198 412 /** Request structure for vboxSfOs2HostReqClose. */199 /** Request structure for VbglR0SfHostReqClose. */ 413 200 typedef struct VBOXSFCLOSEREQ 414 201 { … … 421 208 * SHFL_FN_CLOSE request. 422 209 */ 423 DECLINLINE(int) vboxSfOs2HostReqClose(SHFLROOT idRoot, VBOXSFCLOSEREQ *pReq, uint64_t hHostFile)210 DECLINLINE(int) VbglR0SfHostReqClose(SHFLROOT idRoot, VBOXSFCLOSEREQ *pReq, uint64_t hHostFile) 424 211 { 425 212 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 441 228 * SHFL_FN_CLOSE request, allocate request buffer. 442 229 */ 443 DECLINLINE(int) vboxSfOs2HostReqCloseSimple(SHFLROOT idRoot, uint64_t hHostFile)230 DECLINLINE(int) VbglR0SfHostReqCloseSimple(SHFLROOT idRoot, uint64_t hHostFile) 444 231 { 445 232 VBOXSFCLOSEREQ *pReq = (VBOXSFCLOSEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 446 233 if (pReq) 447 234 { 448 int vrc = vboxSfOs2HostReqClose(idRoot, pReq, hHostFile);235 int vrc = VbglR0SfHostReqClose(idRoot, pReq, hHostFile); 449 236 VbglR0PhysHeapFree(pReq); 450 237 return vrc; … … 454 241 455 242 456 /** Request structure for vboxSfOs2HostReqQueryVolInfo. */243 /** Request structure for VbglR0SfHostReqQueryVolInfo. */ 457 244 typedef struct VBOXSFVOLINFOREQ 458 245 { … … 466 253 * SHFL_FN_INFORMATION[SHFL_INFO_VOLUME | SHFL_INFO_GET] request. 467 254 */ 468 DECLINLINE(int) vboxSfOs2HostReqQueryVolInfo(SHFLROOT idRoot, VBOXSFVOLINFOREQ *pReq, uint64_t hHostFile)255 DECLINLINE(int) VbglR0SfHostReqQueryVolInfo(SHFLROOT idRoot, VBOXSFVOLINFOREQ *pReq, uint64_t hHostFile) 469 256 { 470 257 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS … … 506 293 507 294 508 /** Request structure for vboxSfOs2HostReqSetObjInfo & vboxSfOs2HostReqQueryObjInfo. */295 /** Request structure for VbglR0SfHostReqSetObjInfo & VbglR0SfHostReqQueryObjInfo. */ 509 296 typedef struct VBOXSFOBJINFOREQ 510 297 { … … 518 305 * SHFL_FN_INFORMATION[SHFL_INFO_GET | SHFL_INFO_FILE] request. 519 306 */ 520 DECLINLINE(int) vboxSfOs2HostReqQueryObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile)307 DECLINLINE(int) VbglR0SfHostReqQueryObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile) 521 308 { 522 309 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS … … 561 348 * SHFL_FN_INFORMATION[SHFL_INFO_SET | SHFL_INFO_FILE] request. 562 349 */ 563 DECLINLINE(int) vboxSfOs2HostReqSetObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile)350 DECLINLINE(int) VbglR0SfHostReqSetObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile) 564 351 { 565 352 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS … … 601 388 602 389 603 /** Request structure for vboxSfOs2HostReqSetObjInfo. */390 /** Request structure for VbglR0SfHostReqSetObjInfo. */ 604 391 typedef struct VBOXSFOBJINFOWITHBUFREQ 605 392 { … … 614 401 * buffer (on the physical heap). 615 402 */ 616 DECLINLINE(int) vboxSfOs2HostReqSetObjInfoWithBuf(SHFLROOT idRoot, VBOXSFOBJINFOWITHBUFREQ *pReq, uint64_t hHostFile,617 403 DECLINLINE(int) VbglR0SfHostReqSetObjInfoWithBuf(SHFLROOT idRoot, VBOXSFOBJINFOWITHBUFREQ *pReq, uint64_t hHostFile, 404 PSHFLFSOBJINFO pObjInfo, uint32_t offObjInfoInAlloc) 618 405 { 619 406 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 657 444 658 445 659 /** Request structure for vboxSfOs2HostReqRemove. */446 /** Request structure for VbglR0SfHostReqRemove. */ 660 447 typedef struct VBOXSFREMOVEREQ 661 448 { … … 669 456 * SHFL_FN_REMOVE request. 670 457 */ 671 DECLINLINE(int) vboxSfOs2HostReqRemove(SHFLROOT idRoot, VBOXSFREMOVEREQ *pReq, uint32_t fFlags)458 DECLINLINE(int) VbglR0SfHostReqRemove(SHFLROOT idRoot, VBOXSFREMOVEREQ *pReq, uint32_t fFlags) 672 459 { 673 460 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String) … … 716 503 * SHFL_FN_REMOVE request. 717 504 */ 718 DECLINLINE(int) vboxSfOs2HostReqRenameWithSrcBuf(SHFLROOT idRoot, VBOXSFRENAMEWITHSRCBUFREQ *pReq,719 505 DECLINLINE(int) VbglR0SfHostReqRenameWithSrcBuf(SHFLROOT idRoot, VBOXSFRENAMEWITHSRCBUFREQ *pReq, 506 PSHFLSTRING pSrcStr, uint32_t fFlags) 720 507 { 721 508 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, StrDstPath.String) … … 771 558 772 559 773 /** Request structure for vboxSfOs2HostReqFlush. */560 /** Request structure for VbglR0SfHostReqFlush. */ 774 561 typedef struct VBOXSFFLUSHREQ 775 562 { … … 782 569 * SHFL_FN_FLUSH request. 783 570 */ 784 DECLINLINE(int) vboxSfOs2HostReqFlush(SHFLROOT idRoot, VBOXSFFLUSHREQ *pReq, uint64_t hHostFile)571 DECLINLINE(int) VbglR0SfHostReqFlush(SHFLROOT idRoot, VBOXSFFLUSHREQ *pReq, uint64_t hHostFile) 785 572 { 786 573 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 802 589 * SHFL_FN_FLUSH request, allocate request buffer. 803 590 */ 804 DECLINLINE(int) vboxSfOs2HostReqFlushSimple(SHFLROOT idRoot, uint64_t hHostFile)591 DECLINLINE(int) VbglR0SfHostReqFlushSimple(SHFLROOT idRoot, uint64_t hHostFile) 805 592 { 806 593 VBOXSFFLUSHREQ *pReq = (VBOXSFFLUSHREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 807 594 if (pReq) 808 595 { 809 int vrc = vboxSfOs2HostReqFlush(idRoot, pReq, hHostFile);596 int vrc = VbglR0SfHostReqFlush(idRoot, pReq, hHostFile); 810 597 VbglR0PhysHeapFree(pReq); 811 598 return vrc; … … 815 602 816 603 817 /** Request structure for vboxSfOs2HostReqSetFileSize. */604 /** Request structure for VbglR0SfHostReqSetFileSize. */ 818 605 typedef struct VBOXSFSETFILESIZEREQ 819 606 { … … 826 613 * SHFL_FN_SET_FILE_SIZE request. 827 614 */ 828 DECLINLINE(int) vboxSfOs2HostReqSetFileSize(SHFLROOT idRoot, VBOXSFSETFILESIZEREQ *pReq, 829 uint64_t hHostFile, uint64_t cbNewSize) 615 DECLINLINE(int) VbglR0SfHostReqSetFileSize(SHFLROOT idRoot, VBOXSFSETFILESIZEREQ *pReq, uint64_t hHostFile, uint64_t cbNewSize) 830 616 { 831 617 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 850 636 * SHFL_FN_SET_FILE_SIZE request, allocate request buffer. 851 637 */ 852 DECLINLINE(int) vboxSfOs2HostReqSetFileSizeSimple(SHFLROOT idRoot, uint64_t hHostFile, uint64_t cbNewSize)638 DECLINLINE(int) VbglR0SfHostReqSetFileSizeSimple(SHFLROOT idRoot, uint64_t hHostFile, uint64_t cbNewSize) 853 639 { 854 640 VBOXSFSETFILESIZEREQ *pReq = (VBOXSFSETFILESIZEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 855 641 if (pReq) 856 642 { 857 int vrc = vboxSfOs2HostReqSetFileSize(idRoot, pReq, hHostFile, cbNewSize);643 int vrc = VbglR0SfHostReqSetFileSize(idRoot, pReq, hHostFile, cbNewSize); 858 644 VbglR0PhysHeapFree(pReq); 859 645 return vrc; … … 863 649 864 650 865 /** Request structure for vboxSfOs2HostReqReadEmbedded. */651 /** Request structure for VbglR0SfHostReqReadEmbedded. */ 866 652 typedef struct VBOXSFREADEMBEDDEDREQ 867 653 { … … 875 661 * SHFL_FN_READ request using embedded data buffer. 876 662 */ 877 DECLINLINE(int) vboxSfOs2HostReqReadEmbedded(SHFLROOT idRoot, VBOXSFREADEMBEDDEDREQ *pReq, uint64_t hHostFile,878 663 DECLINLINE(int) VbglR0SfHostReqReadEmbedded(SHFLROOT idRoot, VBOXSFREADEMBEDDEDREQ *pReq, uint64_t hHostFile, 664 uint64_t offRead, uint32_t cbToRead) 879 665 { 880 666 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFREADEMBEDDEDREQ, abData[0]) … … 916 702 917 703 918 /** Request structure for vboxSfOs2HostReqRead & vboxSfOs2HostReqReadContig. */704 /** Request structure for vboxSfOs2HostReqRead & VbglR0SfHostReqReadContig. */ 919 705 typedef struct VBOXSFREADPGLSTREQ 920 706 { … … 928 714 * SHFL_FN_READ request using page list for data buffer (caller populated). 929 715 */ 930 DECLINLINE(int) vboxSfOs2HostReqReadPgLst(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile,931 716 DECLINLINE(int) VbglR0SfHostReqReadPgLst(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile, 717 uint64_t offRead, uint32_t cbToRead, uint32_t cPages) 932 718 { 933 719 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 966 752 * SHFL_FN_READ request using a physically contiguous buffer. 967 753 */ 968 DECLINLINE(int) vboxSfOs2HostReqReadContig(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile,754 DECLINLINE(int) VbglR0SfHostReqReadContig(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile, 969 755 uint64_t offRead, uint32_t cbToRead, void *pvBuffer, RTGCPHYS64 PhysBuffer) 970 756 { … … 1009 795 1010 796 1011 /** Request structure for vboxSfOs2HostReqWriteEmbedded. */797 /** Request structure for VbglR0SfHostReqWriteEmbedded. */ 1012 798 typedef struct VBOXSFWRITEEMBEDDEDREQ 1013 799 { … … 1021 807 * SHFL_FN_WRITE request using embedded data buffer. 1022 808 */ 1023 DECLINLINE(int) vboxSfOs2HostReqWriteEmbedded(SHFLROOT idRoot, VBOXSFWRITEEMBEDDEDREQ *pReq, uint64_t hHostFile,1024 809 DECLINLINE(int) VbglR0SfHostReqWriteEmbedded(SHFLROOT idRoot, VBOXSFWRITEEMBEDDEDREQ *pReq, uint64_t hHostFile, 810 uint64_t offWrite, uint32_t cbToWrite) 1025 811 { 1026 812 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) … … 1062 848 1063 849 1064 /** Request structure for vboxSfOs2HostReqWrite and vboxSfOs2HostReqWriteContig. */850 /** Request structure for vboxSfOs2HostReqWrite and VbglR0SfHostReqWriteContig. */ 1065 851 typedef struct VBOXSFWRITEPGLSTREQ 1066 852 { … … 1074 860 * SHFL_FN_WRITE request using page list for data buffer (caller populated). 1075 861 */ 1076 DECLINLINE(int) vboxSfOs2HostReqWritePgLst(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile,1077 862 DECLINLINE(int) VbglR0SfHostReqWritePgLst(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile, 863 uint64_t offWrite, uint32_t cbToWrite, uint32_t cPages) 1078 864 { 1079 865 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 1112 898 * SHFL_FN_WRITE request using a physically contiguous buffer. 1113 899 */ 1114 DECLINLINE(int) vboxSfOs2HostReqWriteContig(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile,1115 900 DECLINLINE(int) VbglR0SfHostReqWriteContig(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile, 901 uint64_t offWrite, uint32_t cbToWrite, void const *pvBuffer, RTGCPHYS64 PhysBuffer) 1116 902 { 1117 903 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 1153 939 } 1154 940 941 /** Request structure for vboxSfOs2HostReqListDir. */ 942 typedef struct VBOXSFLISTDIRREQ 943 { 944 VBGLIOCIDCHGCMFASTCALL Hdr; 945 VMMDevHGCMCall Call; 946 VBoxSFParmList Parms; 947 HGCMPageListInfo StrPgLst; 948 HGCMPageListInfo BufPgLst; 949 } VBOXSFLISTDIRREQ; 1155 950 1156 951 /** … … 1158 953 * both allocated on the physical heap. 1159 954 */ 1160 DECLINLINE(int) vboxSfOs2HostReqListDir(SHFLROOT idRoot, VBOXSFLISTDIRREQ *pReq, uint64_t hHostDir,1161 955 DECLINLINE(int) VbglR0SfHostReqListDir(SHFLROOT idRoot, VBOXSFLISTDIRREQ *pReq, uint64_t hHostDir, 956 PSHFLSTRING pFilter, uint32_t fFlags, PSHFLDIRINFO pBuffer, uint32_t cbBuffer) 1162 957 { 1163 958 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, … … 1232 1027 /** @} */ 1233 1028 1234 #endif /* ! GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h */1235 1029 #endif /* !VBOX_INCLUDED_VBoxGuestLibSharedFoldersInline_h */ 1030 -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSF.cpp
r76715 r76716 286 286 /* Note! We won't get there while the folder is on the list. */ 287 287 LogRel(("vboxSfOs2ReleaseFolder: Destroying %p [%s]\n", pFolder, pFolder->szName)); 288 vboxSfOs2HostReqUnmapFolderSimple(pFolder->idHostRoot);288 VbglR0SfHostReqUnmapFolderSimple(pFolder->idHostRoot); 289 289 RT_ZERO(pFolder); 290 290 RTMemFree(pFolder); … … 395 395 if (pReq) 396 396 { 397 rc = vboxSfOs2HostReqMapFolderWithBuf(pReq, pName, RTPATH_DELIMITER, false /*fCaseSensitive*/);397 rc = VbglR0SfHostReqMapFolderWithBuf(pReq, pName, RTPATH_DELIMITER, false /*fCaseSensitive*/); 398 398 if (RT_SUCCESS(rc)) 399 399 { … … 408 408 } 409 409 else 410 LogRel(("vboxSfOs2MapFolder: vboxSfOs2HostReqMapFolderWithBuf(,%s,) -> %Rrc\n", pNew->szName, rc));410 LogRel(("vboxSfOs2MapFolder: VbglR0SfHostReqMapFolderWithBuf(,%s,) -> %Rrc\n", pNew->szName, rc)); 411 411 VbglR0PhysHeapFree(pReq); 412 412 } … … 1364 1364 pu->Open.Req.StrPath.String.utf16[2] = '\0'; 1365 1365 1366 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, &pu->Open.Req);1367 LogFlow(("FS32_FSINFO: vboxSfOs2HostReqCreate -> %Rrc Result=%d Handle=%#RX64\n",1366 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, &pu->Open.Req); 1367 LogFlow(("FS32_FSINFO: VbglR0SfHostReqCreate -> %Rrc Result=%d Handle=%#RX64\n", 1368 1368 vrc, pu->Open.Req.CreateParms.Result, pu->Open.Req.CreateParms.Handle)); 1369 1369 if ( RT_SUCCESS(vrc) … … 1373 1373 1374 1374 RT_ZERO(pu->Info.Req); 1375 vrc = vboxSfOs2HostReqQueryVolInfo(pFolder->idHostRoot, &pu->Info.Req, hHandle);1375 vrc = VbglR0SfHostReqQueryVolInfo(pFolder->idHostRoot, &pu->Info.Req, hHandle); 1376 1376 if (RT_SUCCESS(vrc)) 1377 1377 { … … 1400 1400 else 1401 1401 { 1402 LogRel(("FS32_FSINFO: vboxSfOs2HostReqQueryVolInfo failed: %Rrc\n", vrc));1402 LogRel(("FS32_FSINFO: VbglR0SfHostReqQueryVolInfo failed: %Rrc\n", vrc)); 1403 1403 rc = ERROR_GEN_FAILURE; 1404 1404 } 1405 1405 1406 vrc = vboxSfOs2HostReqClose(pFolder->idHostRoot, &pu->Close, hHandle);1406 vrc = VbglR0SfHostReqClose(pFolder->idHostRoot, &pu->Close, hHandle); 1407 1407 AssertRC(vrc); 1408 1408 } … … 1480 1480 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP; 1481 1481 1482 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);1483 LogFlow(("FS32_CHDIR: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n",1482 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 1483 LogFlow(("FS32_CHDIR: VbglR0SfHostReqCreate -> %Rrc Result=%d fMode=%#x\n", 1484 1484 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 1485 1485 if (RT_SUCCESS(vrc)) … … 1554 1554 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_DENYNONE; 1555 1555 1556 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);1557 LogFlow(("FS32_MKDIR: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n",1556 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 1557 LogFlow(("FS32_MKDIR: VbglR0SfHostReqCreate -> %Rrc Result=%d fMode=%#x\n", 1558 1558 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 1559 1559 if (RT_SUCCESS(vrc)) … … 1565 1565 { 1566 1566 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 1567 vrc = vboxSfOs2HostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle);1567 vrc = VbglR0SfHostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle); 1568 1568 AssertRC(vrc); 1569 1569 } … … 1620 1620 if (rc == NO_ERROR) 1621 1621 { 1622 int vrc = vboxSfOs2HostReqRemove(pFolder->idHostRoot, pReq, SHFL_REMOVE_DIR);1623 LogFlow(("FS32_RMDIR: vboxSfOs2HostReqRemove -> %Rrc\n", rc));1622 int vrc = VbglR0SfHostReqRemove(pFolder->idHostRoot, pReq, SHFL_REMOVE_DIR); 1623 LogFlow(("FS32_RMDIR: VbglR0SfHostReqRemove -> %Rrc\n", rc)); 1624 1624 if (RT_SUCCESS(vrc)) 1625 1625 rc = NO_ERROR; … … 1678 1678 * Note! Requires 6.0.0beta2+ or 5.2.24+ host for renaming files. 1679 1679 */ 1680 int vrc = vboxSfOs2HostReqRenameWithSrcBuf(pSrcFolder->idHostRoot, pReq, pSrcFolderPath,1681 1680 int vrc = VbglR0SfHostReqRenameWithSrcBuf(pSrcFolder->idHostRoot, pReq, pSrcFolderPath, 1681 SHFL_RENAME_FILE | SHFL_RENAME_DIR); 1682 1682 if (RT_SUCCESS(vrc)) 1683 1683 rc = NO_ERROR; 1684 1684 else 1685 1685 { 1686 Log(("FS32_MOVE: vboxSfOs2HostReqRenameWithSrcBuf failed: %Rrc\n", rc));1686 Log(("FS32_MOVE: VbglR0SfHostReqRenameWithSrcBuf failed: %Rrc\n", rc)); 1687 1687 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_ACCESS_DENIED); 1688 1688 } … … 1718 1718 if (rc == NO_ERROR) 1719 1719 { 1720 int vrc = vboxSfOs2HostReqRemove(pFolder->idHostRoot, pReq, SHFL_REMOVE_FILE);1721 LogFlow(("FS32_DELETE: vboxSfOs2HostReqRemove -> %Rrc\n", rc));1720 int vrc = VbglR0SfHostReqRemove(pFolder->idHostRoot, pReq, SHFL_REMOVE_FILE); 1721 LogFlow(("FS32_DELETE: VbglR0SfHostReqRemove -> %Rrc\n", rc)); 1722 1722 if (RT_SUCCESS(vrc)) 1723 1723 rc = NO_ERROR; … … 1798 1798 if (pReq) 1799 1799 { 1800 int vrc = vboxSfOs2HostReqSetObjInfoWithBuf(pFolder->idHostRoot, pReq, hHostFile, pObjInfoBuf, offObjInfoInAlloc);1801 LogFlow(("vboxSfOs2SetFileInfo: vboxSfOs2HostReqSetObjInfoWithBuf -> %Rrc\n", vrc));1800 int vrc = VbglR0SfHostReqSetObjInfoWithBuf(pFolder->idHostRoot, pReq, hHostFile, pObjInfoBuf, offObjInfoInAlloc); 1801 LogFlow(("vboxSfOs2SetFileInfo: VbglR0SfHostReqSetObjInfoWithBuf -> %Rrc\n", vrc)); 1802 1802 1803 1803 VbglR0PhysHeapFree(pReq); … … 1829 1829 | SHFL_CF_ACCESS_ATTR_READWRITE | SHFL_CF_ACCESS_DENYNONE | SHFL_CF_ACCESS_NONE; 1830 1830 1831 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);1832 LogFlow(("vboxSfOs2SetPathInfoWorker: vboxSfOs2HostReqCreate -> %Rrc Result=%d Handle=%#RX64 fMode=%#x\n",1831 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 1832 LogFlow(("vboxSfOs2SetPathInfoWorker: VbglR0SfHostReqCreate -> %Rrc Result=%d Handle=%#RX64 fMode=%#x\n", 1833 1833 vrc, pReq->CreateParms.Result, pReq->CreateParms.Handle, pReq->CreateParms.Info.Attr.fMode)); 1834 1834 if ( vrc == VERR_IS_A_DIRECTORY … … 1840 1840 pReq->CreateParms.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_OPEN_IF_EXISTS | SHFL_CF_ACT_FAIL_IF_NEW 1841 1841 | SHFL_CF_ACCESS_ATTR_READWRITE | SHFL_CF_ACCESS_DENYNONE | SHFL_CF_ACCESS_NONE; 1842 vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);1843 LogFlow(("vboxSfOs2SetPathInfoWorker: vboxSfOs2HostReqCreate#2 -> %Rrc Result=%d Handle=%#RX64 fMode=%#x\n",1842 vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 1843 LogFlow(("vboxSfOs2SetPathInfoWorker: VbglR0SfHostReqCreate#2 -> %Rrc Result=%d Handle=%#RX64 fMode=%#x\n", 1844 1844 vrc, pReq->CreateParms.Result, pReq->CreateParms.Handle, pReq->CreateParms.Info.Attr.fMode)); 1845 1845 } … … 1858 1858 1859 1859 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 1860 vrc = vboxSfOs2HostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle);1860 vrc = VbglR0SfHostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle); 1861 1861 AssertRC(vrc); 1862 1862 } … … 1909 1909 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP; 1910 1910 1911 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);1912 LogFlow(("FS32_FILEATTRIBUTE: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n",1911 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 1912 LogFlow(("FS32_FILEATTRIBUTE: VbglR0SfHostReqCreate -> %Rrc Result=%d fMode=%#x\n", 1913 1913 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 1914 1914 if (RT_SUCCESS(vrc)) … … 2214 2214 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP; 2215 2215 2216 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);2217 LogFlow(("FS32_PATHINFO: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n",2216 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 2217 LogFlow(("FS32_PATHINFO: VbglR0SfHostReqCreate -> %Rrc Result=%d fMode=%#x\n", 2218 2218 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 2219 2219 if (RT_SUCCESS(vrc)) -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFile.cpp
r76715 r76716 233 233 * Try open the file. 234 234 */ 235 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);236 LogFlow(("FS32_OPENCREATE: vboxSfOs2HostReqCreate -> %Rrc Result=%d fMode=%#x\n",235 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 236 LogFlow(("FS32_OPENCREATE: VbglR0SfHostReqCreate -> %Rrc Result=%d fMode=%#x\n", 237 237 vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode)); 238 238 if (RT_SUCCESS(vrc)) … … 282 282 LogRel(("FS32_OPENCREATE: cbObject=%#RX64 no OPEN_FLAGS_LARGEFILE (%s)\n", pReq->CreateParms.Info.cbObject, pszName)); 283 283 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 284 vboxSfOs2HostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle);284 VbglR0SfHostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pReq->CreateParms.Handle); 285 285 rc = ERROR_ACCESS_DENIED; 286 286 } … … 335 335 RT_NOREF(fIoFlags); 336 336 337 int vrc = vboxSfOs2HostReqCloseSimple(pFolder->idHostRoot, pSfFsd->hHostFile);337 int vrc = VbglR0SfHostReqCloseSimple(pFolder->idHostRoot, pSfFsd->hHostFile); 338 338 AssertRC(vrc); 339 339 … … 374 374 || (pSfFsi->sfi_mode & SFMODE_OPEN_ACCESS) == SFMODE_OPEN_READWRITE) 375 375 { 376 int vrc = vboxSfOs2HostReqFlushSimple(pFolder->idHostRoot, pSfFsd->hHostFile);376 int vrc = VbglR0SfHostReqFlushSimple(pFolder->idHostRoot, pSfFsd->hHostFile); 377 377 if (RT_FAILURE(vrc)) 378 378 { 379 LogRel(("FS32_COMMIT: vboxSfOs2HostReqFlushSimple failed: %Rrc\n", vrc));379 LogRel(("FS32_COMMIT: VbglR0SfHostReqFlushSimple failed: %Rrc\n", vrc)); 380 380 return ERROR_FLUSHBUF_FAILED; 381 381 } … … 435 435 return ERROR_NOT_ENOUGH_MEMORY; 436 436 437 int vrc = vboxSfOs2HostReqQueryObjInfo(pFolder->idHostRoot, pReq, pSfFsd->hHostFile);437 int vrc = VbglR0SfHostReqQueryObjInfo(pFolder->idHostRoot, pReq, pSfFsd->hHostFile); 438 438 if (RT_SUCCESS(vrc)) 439 439 { … … 858 858 if (pReq) 859 859 { 860 int vrc = vboxSfOs2HostReqQueryObjInfo(pFolder->idHostRoot, pReq, pSfFsd->hHostFile);860 int vrc = VbglR0SfHostReqQueryObjInfo(pFolder->idHostRoot, pReq, pSfFsd->hHostFile); 861 861 if (RT_SUCCESS(vrc)) 862 862 { … … 876 876 else 877 877 { 878 Log(("vboxSfOs2QueryFileInfo: vboxSfOs2HostReqQueryObjInfo failed: %Rrc\n", vrc));878 Log(("vboxSfOs2QueryFileInfo: VbglR0SfHostReqQueryObjInfo failed: %Rrc\n", vrc)); 879 879 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_GEN_FAILURE); 880 880 } … … 1047 1047 * Call the host. 1048 1048 */ 1049 int vrc = vboxSfOs2HostReqSetFileSizeSimple(pFolder->idHostRoot, pSfFsd->hHostFile, cbFile);1049 int vrc = VbglR0SfHostReqSetFileSizeSimple(pFolder->idHostRoot, pSfFsd->hHostFile, cbFile); 1050 1050 if (RT_SUCCESS(vrc)) 1051 1051 { … … 1166 1166 { 1167 1167 APIRET rc; 1168 int vrc = vboxSfOs2HostReqReadEmbedded(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offRead, cbToRead);1168 int vrc = VbglR0SfHostReqReadEmbedded(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offRead, cbToRead); 1169 1169 if (RT_SUCCESS(vrc)) 1170 1170 { … … 1180 1180 else 1181 1181 { 1182 Log(("FS32_READ: vboxSfOs2HostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [embedded]\n", offRead, cbToRead, vrc));1182 Log(("FS32_READ: VbglR0SfHostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [embedded]\n", offRead, cbToRead, vrc)); 1183 1183 rc = ERROR_BAD_NET_RESP; 1184 1184 } … … 1223 1223 { 1224 1224 APIRET rc; 1225 int vrc = vboxSfOs2HostReqReadContig(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, 1226 offRead, cbToRead, pvBuf, GCPhys); 1225 int vrc = VbglR0SfHostReqReadContig(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offRead, cbToRead, pvBuf, GCPhys); 1227 1226 if (RT_SUCCESS(vrc)) 1228 1227 { … … 1238 1237 else 1239 1238 { 1240 Log(("FS32_READ: vboxSfOs2HostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [bounced]\n", offRead, cbToRead, vrc));1239 Log(("FS32_READ: VbglR0SfHostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [bounced]\n", offRead, cbToRead, vrc)); 1241 1240 rc = ERROR_BAD_NET_RESP; 1242 1241 } … … 1266 1265 1267 1266 APIRET rc; 1268 int vrc = vboxSfOs2HostReqReadPgLst(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offRead, cbToRead, cPages);1267 int vrc = VbglR0SfHostReqReadPgLst(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offRead, cbToRead, cPages); 1269 1268 if (RT_SUCCESS(vrc)) 1270 1269 { … … 1276 1275 else 1277 1276 { 1278 Log(("FS32_READ: vboxSfOs2HostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [locked]\n", offRead, cbToRead, vrc));1277 Log(("FS32_READ: VbglR0SfHostReqReadEmbedded(off=%#RU64,cb=%#x) -> %Rrc [locked]\n", offRead, cbToRead, vrc)); 1279 1278 rc = ERROR_BAD_NET_RESP; 1280 1279 } … … 1337 1336 if (rc == NO_ERROR) 1338 1337 { 1339 int vrc = vboxSfOs2HostReqWriteEmbedded(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offWrite, cbToWrite);1338 int vrc = VbglR0SfHostReqWriteEmbedded(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offWrite, cbToWrite); 1340 1339 if (RT_SUCCESS(vrc)) 1341 1340 { … … 1347 1346 else 1348 1347 { 1349 Log(("FS32_WRITE: vboxSfOs2HostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [embedded]\n", offWrite, cbToWrite, vrc));1348 Log(("FS32_WRITE: VbglR0SfHostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [embedded]\n", offWrite, cbToWrite, vrc)); 1350 1349 rc = ERROR_BAD_NET_RESP; 1351 1350 } … … 1394 1393 { 1395 1394 APIRET rc; 1396 int vrc = vboxSfOs2HostReqWriteContig(pFolder->idHostRoot, pReq, pSfFsd->hHostFile,1397 1395 int vrc = VbglR0SfHostReqWriteContig(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, 1396 offWrite, cbToWrite, pvBuf, GCPhys); 1398 1397 if (RT_SUCCESS(vrc)) 1399 1398 { … … 1405 1404 else 1406 1405 { 1407 Log(("FS32_WRITE: vboxSfOs2HostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [bounced]\n", offWrite, cbToWrite, vrc));1406 Log(("FS32_WRITE: VbglR0SfHostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [bounced]\n", offWrite, cbToWrite, vrc)); 1408 1407 rc = ERROR_BAD_NET_RESP; 1409 1408 } … … 1433 1432 1434 1433 APIRET rc; 1435 int vrc = vboxSfOs2HostReqWritePgLst(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offWrite, cbToWrite, cPages);1434 int vrc = VbglR0SfHostReqWritePgLst(pFolder->idHostRoot, pReq, pSfFsd->hHostFile, offWrite, cbToWrite, cPages); 1436 1435 if (RT_SUCCESS(vrc)) 1437 1436 { … … 1443 1442 else 1444 1443 { 1445 Log(("FS32_WRITE: vboxSfOs2HostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [locked]\n", offWrite, cbToWrite, vrc));1444 Log(("FS32_WRITE: VbglR0SfHostReqWriteEmbedded(off=%#RU64,cb=%#x) -> %Rrc [locked]\n", offWrite, cbToWrite, vrc)); 1446 1445 rc = ERROR_BAD_NET_RESP; 1447 1446 } -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp
r76715 r76716 234 234 { 235 235 pDataBuf->pEntry = pEntry = pDataBuf->pBuf; 236 int vrc = vboxSfOs2HostReqListDir(pFolder->idHostRoot, &pDataBuf->Req, pFsFsd->hHostDir, pDataBuf->pFilter,237 236 int vrc = VbglR0SfHostReqListDir(pFolder->idHostRoot, &pDataBuf->Req, pFsFsd->hHostDir, pDataBuf->pFilter, 237 /*cMaxMatches == 1 ? SHFL_LIST_RETURN_ONE :*/ 0, pDataBuf->pBuf, pDataBuf->cbBuf); 238 238 if (RT_SUCCESS(vrc)) 239 239 { … … 243 243 AssertReturn(pDataBuf->cbValid >= RT_UOFFSETOF(SHFLDIRINFO, name.String), ERROR_SYS_INTERNAL); 244 244 AssertReturn(pDataBuf->cbValid >= RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size, ERROR_SYS_INTERNAL); 245 Log4(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir returned %#x matches in %#x bytes\n", pDataBuf->cEntriesLeft, pDataBuf->cbValid));245 Log4(("vboxSfOs2ReadDirEntries: VbglR0SfHostReqListDir returned %#x matches in %#x bytes\n", pDataBuf->cEntriesLeft, pDataBuf->cbValid)); 246 246 } 247 247 else 248 248 { 249 249 if (vrc == VERR_NO_MORE_FILES) 250 Log4(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir returned VERR_NO_MORE_FILES (%d,%d)\n",250 Log4(("vboxSfOs2ReadDirEntries: VbglR0SfHostReqListDir returned VERR_NO_MORE_FILES (%d,%d)\n", 251 251 pDataBuf->Req.Parms.c32Entries.u.value32, pDataBuf->Req.Parms.cb32Buffer.u.value32)); 252 252 else 253 Log(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir failed %Rrc (%d,%d)\n", vrc,253 Log(("vboxSfOs2ReadDirEntries: VbglR0SfHostReqListDir failed %Rrc (%d,%d)\n", vrc, 254 254 pDataBuf->Req.Parms.c32Entries.u.value32, pDataBuf->Req.Parms.cb32Buffer.u.value32)); 255 255 pDataBuf->pEntry = NULL; … … 601 601 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE; 602 602 603 int vrc = vboxSfOs2HostReqCreate(pFolder->idHostRoot, pReq);604 LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate(%ls) -> %Rrc Result=%d fMode=%#x hHandle=%#RX64\n",603 int vrc = VbglR0SfHostReqCreate(pFolder->idHostRoot, pReq); 604 LogFlow(("FS32_FINDFIRST: VbglR0SfHostReqCreate(%ls) -> %Rrc Result=%d fMode=%#x hHandle=%#RX64\n", 605 605 pStrFolderPath->String.utf16, vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode, 606 606 pReq->CreateParms.Handle)); … … 649 649 { 650 650 AssertCompile(sizeof(VBOXSFCLOSEREQ) < sizeof(*pReq)); 651 vrc = vboxSfOs2HostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir);651 vrc = VbglR0SfHostReqClose(pFolder->idHostRoot, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir); 652 652 AssertRC(vrc); 653 653 pFsFsd->u32Magic = ~VBOXSFFS_MAGIC; … … 659 659 else 660 660 { 661 LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate returns NIL handle for '%ls'\n",661 LogFlow(("FS32_FINDFIRST: VbglR0SfHostReqCreate returns NIL handle for '%ls'\n", 662 662 pStrFolderPath->String.utf16)); 663 663 rc = ERROR_PATH_NOT_FOUND; … … 826 826 if (pFsFsd->hHostDir != SHFL_HANDLE_NIL) 827 827 { 828 int vrc = vboxSfOs2HostReqCloseSimple(pFolder->idHostRoot, pFsFsd->hHostDir);828 int vrc = VbglR0SfHostReqCloseSimple(pFolder->idHostRoot, pFsFsd->hHostDir); 829 829 AssertRC(vrc); 830 830 } -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h
r76715 r76716 49 49 #include <iprt/assert.h> 50 50 #include <iprt/list.h> 51 #include <VBox/VBoxGuestLibSharedFolders.h>52 51 #include <VBox/VBoxGuest.h> 52 #include <VBox/VBoxGuestLibSharedFoldersInline.h> 53 53 54 54 … … 156 156 #define VBOXSFSYFI_MAGIC UINT32_C(0x19690520) 157 157 158 159 /** Request structure for vboxSfOs2HostReqListDir. */160 typedef struct VBOXSFLISTDIRREQ161 {162 VBGLIOCIDCHGCMFASTCALL Hdr;163 VMMDevHGCMCall Call;164 VBoxSFParmList Parms;165 HGCMPageListInfo StrPgLst;166 HGCMPageListInfo BufPgLst;167 } VBOXSFLISTDIRREQ;168 158 169 159 /** … … 261 251 262 252 263 /** @name Host request helpers264 *265 * @todo generalize these and put back into VbglR0Sf.266 *267 * @{ */268 269 #include <iprt/err.h>270 271 /** Request structure for vboxSfOs2HostReqMapFolderWithBuf. */272 typedef struct VBOXSFMAPFOLDERWITHBUFREQ273 {274 VBGLIOCIDCHGCMFASTCALL Hdr;275 VMMDevHGCMCall Call;276 VBoxSFParmMapFolder Parms;277 HGCMPageListInfo PgLst;278 } VBOXSFMAPFOLDERWITHBUFREQ;279 280 /**281 * SHFL_FN_MAP_FOLDER request.282 */283 DECLINLINE(int) vboxSfOs2HostReqMapFolderWithBuf(VBOXSFMAPFOLDERWITHBUFREQ *pReq, PSHFLSTRING pStrName,284 RTUTF16 wcDelimiter, bool fCaseSensitive)285 {286 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,287 SHFL_FN_MAP_FOLDER, SHFL_CPARMS_MAP_FOLDER, sizeof(*pReq));288 289 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;290 pReq->Parms.id32Root.u.value32 = SHFL_ROOT_NIL;291 292 pReq->Parms.uc32Delimiter.type = VMMDevHGCMParmType_32bit;293 pReq->Parms.uc32Delimiter.u.value32 = wcDelimiter;294 295 pReq->Parms.fCaseSensitive.type = VMMDevHGCMParmType_32bit;296 pReq->Parms.fCaseSensitive.u.value32 = fCaseSensitive;297 298 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)299 {300 pReq->Parms.pStrName.type = VMMDevHGCMParmType_PageList;301 pReq->Parms.pStrName.u.PageList.size = SHFLSTRING_HEADER_SIZE + pStrName->u16Size;302 pReq->Parms.pStrName.u.PageList.offset = RT_UOFFSETOF(VBOXSFMAPFOLDERWITHBUFREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);303 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_BOTH;304 pReq->PgLst.aPages[0] = VbglR0PhysHeapGetPhysAddr(pStrName);305 pReq->PgLst.offFirstPage = (uint16_t)(pReq->PgLst.aPages[0] & PAGE_OFFSET_MASK);306 pReq->PgLst.aPages[0] &= ~(RTGCPHYS)PAGE_OFFSET_MASK;307 pReq->PgLst.cPages = 1;308 }309 else310 {311 pReq->Parms.pStrName.type = VMMDevHGCMParmType_LinAddr_In;312 pReq->Parms.pStrName.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pStrName->u16Size;313 pReq->Parms.pStrName.u.LinAddr.uAddr = (uintptr_t)pStrName;314 }315 316 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));317 if (RT_SUCCESS(vrc))318 vrc = pReq->Call.header.result;319 return vrc;320 }321 322 323 324 /** Request structure used by vboxSfOs2HostReqUnmapFolder. */325 typedef struct VBOXSFUNMAPFOLDERREQ326 {327 VBGLIOCIDCHGCMFASTCALL Hdr;328 VMMDevHGCMCall Call;329 VBoxSFParmUnmapFolder Parms;330 } VBOXSFUNMAPFOLDERREQ;331 332 333 /**334 * SHFL_FN_UNMAP_FOLDER request.335 */336 DECLINLINE(int) vboxSfOs2HostReqUnmapFolderSimple(uint32_t idRoot)337 {338 VBOXSFUNMAPFOLDERREQ *pReq = (VBOXSFUNMAPFOLDERREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));339 if (pReq)340 {341 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;342 pReq->Parms.id32Root.u.value32 = idRoot;343 344 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,345 SHFL_FN_UNMAP_FOLDER, SHFL_CPARMS_UNMAP_FOLDER, sizeof(*pReq));346 347 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));348 if (RT_SUCCESS(vrc))349 vrc = pReq->Call.header.result;350 351 VbglR0PhysHeapFree(pReq);352 return vrc;353 }354 return VERR_NO_MEMORY;355 }356 357 358 /** Request structure for vboxSfOs2HostReqCreate. */359 typedef struct VBOXSFCREATEREQ360 {361 VBGLIOCIDCHGCMFASTCALL Hdr;362 VMMDevHGCMCall Call;363 VBoxSFParmCreate Parms;364 SHFLCREATEPARMS CreateParms;365 SHFLSTRING StrPath;366 } VBOXSFCREATEREQ;367 368 /**369 * SHFL_FN_CREATE request.370 */371 DECLINLINE(int) vboxSfOs2HostReqCreate(SHFLROOT idRoot, VBOXSFCREATEREQ *pReq)372 {373 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS374 ? RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + pReq->StrPath.u16Size375 : RT_UOFFSETOF(VBOXSFCREATEREQ, CreateParms);376 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,377 SHFL_FN_CREATE, SHFL_CPARMS_CREATE, cbReq);378 379 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;380 pReq->Parms.id32Root.u.value32 = idRoot;381 382 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)383 {384 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_Embedded;385 pReq->Parms.pStrPath.u.Embedded.cbData = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;386 pReq->Parms.pStrPath.u.Embedded.offData = RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath) - sizeof(VBGLIOCIDCHGCMFASTCALL);387 pReq->Parms.pStrPath.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;388 389 pReq->Parms.pCreateParms.type = VMMDevHGCMParmType_Embedded;390 pReq->Parms.pCreateParms.u.Embedded.cbData = sizeof(pReq->CreateParms);391 pReq->Parms.pCreateParms.u.Embedded.offData = RT_UOFFSETOF(VBOXSFCREATEREQ, CreateParms) - sizeof(VBGLIOCIDCHGCMFASTCALL);392 pReq->Parms.pCreateParms.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_BOTH;393 }394 else395 {396 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_LinAddr_In;397 pReq->Parms.pStrPath.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;398 pReq->Parms.pStrPath.u.LinAddr.uAddr = (uintptr_t)&pReq->StrPath;399 400 pReq->Parms.pCreateParms.type = VMMDevHGCMParmType_LinAddr;401 pReq->Parms.pCreateParms.u.LinAddr.cb = sizeof(pReq->CreateParms);402 pReq->Parms.pCreateParms.u.LinAddr.uAddr = (uintptr_t)&pReq->CreateParms;403 }404 405 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);406 if (RT_SUCCESS(vrc))407 vrc = pReq->Call.header.result;408 return vrc;409 }410 411 412 /** Request structure for vboxSfOs2HostReqClose. */413 typedef struct VBOXSFCLOSEREQ414 {415 VBGLIOCIDCHGCMFASTCALL Hdr;416 VMMDevHGCMCall Call;417 VBoxSFParmClose Parms;418 } VBOXSFCLOSEREQ;419 420 /**421 * SHFL_FN_CLOSE request.422 */423 DECLINLINE(int) vboxSfOs2HostReqClose(SHFLROOT idRoot, VBOXSFCLOSEREQ *pReq, uint64_t hHostFile)424 {425 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,426 SHFL_FN_CLOSE, SHFL_CPARMS_CLOSE, sizeof(*pReq));427 428 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;429 pReq->Parms.id32Root.u.value32 = idRoot;430 431 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;432 pReq->Parms.u64Handle.u.value64 = hHostFile;433 434 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));435 if (RT_SUCCESS(vrc))436 vrc = pReq->Call.header.result;437 return vrc;438 }439 440 /**441 * SHFL_FN_CLOSE request, allocate request buffer.442 */443 DECLINLINE(int) vboxSfOs2HostReqCloseSimple(SHFLROOT idRoot, uint64_t hHostFile)444 {445 VBOXSFCLOSEREQ *pReq = (VBOXSFCLOSEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));446 if (pReq)447 {448 int vrc = vboxSfOs2HostReqClose(idRoot, pReq, hHostFile);449 VbglR0PhysHeapFree(pReq);450 return vrc;451 }452 return VERR_NO_MEMORY;453 }454 455 456 /** Request structure for vboxSfOs2HostReqQueryVolInfo. */457 typedef struct VBOXSFVOLINFOREQ458 {459 VBGLIOCIDCHGCMFASTCALL Hdr;460 VMMDevHGCMCall Call;461 VBoxSFParmInformation Parms;462 SHFLVOLINFO VolInfo;463 } VBOXSFVOLINFOREQ;464 465 /**466 * SHFL_FN_INFORMATION[SHFL_INFO_VOLUME | SHFL_INFO_GET] request.467 */468 DECLINLINE(int) vboxSfOs2HostReqQueryVolInfo(SHFLROOT idRoot, VBOXSFVOLINFOREQ *pReq, uint64_t hHostFile)469 {470 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS471 ? sizeof(*pReq) : RT_UOFFSETOF(VBOXSFVOLINFOREQ, VolInfo);472 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,473 SHFL_FN_INFORMATION, SHFL_CPARMS_INFORMATION, cbReq);474 475 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;476 pReq->Parms.id32Root.u.value32 = idRoot;477 478 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;479 pReq->Parms.u64Handle.u.value64 = hHostFile;480 481 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;482 pReq->Parms.f32Flags.u.value32 = SHFL_INFO_VOLUME | SHFL_INFO_GET;483 484 pReq->Parms.cb32.type = VMMDevHGCMParmType_32bit;485 pReq->Parms.cb32.u.value32 = sizeof(pReq->VolInfo);486 487 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)488 {489 pReq->Parms.pInfo.type = VMMDevHGCMParmType_Embedded;490 pReq->Parms.pInfo.u.Embedded.cbData = sizeof(pReq->VolInfo);491 pReq->Parms.pInfo.u.Embedded.offData = RT_UOFFSETOF(VBOXSFVOLINFOREQ, VolInfo) - sizeof(VBGLIOCIDCHGCMFASTCALL);492 pReq->Parms.pInfo.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;493 }494 else495 {496 pReq->Parms.pInfo.type = VMMDevHGCMParmType_LinAddr_Out;497 pReq->Parms.pInfo.u.LinAddr.cb = sizeof(pReq->VolInfo);498 pReq->Parms.pInfo.u.LinAddr.uAddr = (uintptr_t)&pReq->VolInfo;499 }500 501 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);502 if (RT_SUCCESS(vrc))503 vrc = pReq->Call.header.result;504 return vrc;505 }506 507 508 /** Request structure for vboxSfOs2HostReqSetObjInfo & vboxSfOs2HostReqQueryObjInfo. */509 typedef struct VBOXSFOBJINFOREQ510 {511 VBGLIOCIDCHGCMFASTCALL Hdr;512 VMMDevHGCMCall Call;513 VBoxSFParmInformation Parms;514 SHFLFSOBJINFO ObjInfo;515 } VBOXSFOBJINFOREQ;516 517 /**518 * SHFL_FN_INFORMATION[SHFL_INFO_GET | SHFL_INFO_FILE] request.519 */520 DECLINLINE(int) vboxSfOs2HostReqQueryObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile)521 {522 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS523 ? sizeof(*pReq) : RT_UOFFSETOF(VBOXSFOBJINFOREQ, ObjInfo);524 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,525 SHFL_FN_INFORMATION, SHFL_CPARMS_INFORMATION, cbReq);526 527 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;528 pReq->Parms.id32Root.u.value32 = idRoot;529 530 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;531 pReq->Parms.u64Handle.u.value64 = hHostFile;532 533 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;534 pReq->Parms.f32Flags.u.value32 = SHFL_INFO_GET | SHFL_INFO_FILE;535 536 pReq->Parms.cb32.type = VMMDevHGCMParmType_32bit;537 pReq->Parms.cb32.u.value32 = sizeof(pReq->ObjInfo);538 539 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)540 {541 pReq->Parms.pInfo.type = VMMDevHGCMParmType_Embedded;542 pReq->Parms.pInfo.u.Embedded.cbData = sizeof(pReq->ObjInfo);543 pReq->Parms.pInfo.u.Embedded.offData = RT_UOFFSETOF(VBOXSFOBJINFOREQ, ObjInfo) - sizeof(VBGLIOCIDCHGCMFASTCALL);544 pReq->Parms.pInfo.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;545 }546 else547 {548 pReq->Parms.pInfo.type = VMMDevHGCMParmType_LinAddr_Out;549 pReq->Parms.pInfo.u.LinAddr.cb = sizeof(pReq->ObjInfo);550 pReq->Parms.pInfo.u.LinAddr.uAddr = (uintptr_t)&pReq->ObjInfo;551 }552 553 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);554 if (RT_SUCCESS(vrc))555 vrc = pReq->Call.header.result;556 return vrc;557 }558 559 560 /**561 * SHFL_FN_INFORMATION[SHFL_INFO_SET | SHFL_INFO_FILE] request.562 */563 DECLINLINE(int) vboxSfOs2HostReqSetObjInfo(SHFLROOT idRoot, VBOXSFOBJINFOREQ *pReq, uint64_t hHostFile)564 {565 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS566 ? sizeof(*pReq) : RT_UOFFSETOF(VBOXSFOBJINFOREQ, ObjInfo);567 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,568 SHFL_FN_INFORMATION, SHFL_CPARMS_INFORMATION, cbReq);569 570 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;571 pReq->Parms.id32Root.u.value32 = idRoot;572 573 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;574 pReq->Parms.u64Handle.u.value64 = hHostFile;575 576 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;577 pReq->Parms.f32Flags.u.value32 = SHFL_INFO_SET | SHFL_INFO_FILE;578 579 pReq->Parms.cb32.type = VMMDevHGCMParmType_32bit;580 pReq->Parms.cb32.u.value32 = sizeof(pReq->ObjInfo);581 582 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)583 {584 pReq->Parms.pInfo.type = VMMDevHGCMParmType_Embedded;585 pReq->Parms.pInfo.u.Embedded.cbData = sizeof(pReq->ObjInfo);586 pReq->Parms.pInfo.u.Embedded.offData = RT_UOFFSETOF(VBOXSFOBJINFOREQ, ObjInfo) - sizeof(VBGLIOCIDCHGCMFASTCALL);587 pReq->Parms.pInfo.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_BOTH;588 }589 else590 {591 pReq->Parms.pInfo.type = VMMDevHGCMParmType_LinAddr;592 pReq->Parms.pInfo.u.LinAddr.cb = sizeof(pReq->ObjInfo);593 pReq->Parms.pInfo.u.LinAddr.uAddr = (uintptr_t)&pReq->ObjInfo;594 }595 596 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);597 if (RT_SUCCESS(vrc))598 vrc = pReq->Call.header.result;599 return vrc;600 }601 602 603 /** Request structure for vboxSfOs2HostReqSetObjInfo. */604 typedef struct VBOXSFOBJINFOWITHBUFREQ605 {606 VBGLIOCIDCHGCMFASTCALL Hdr;607 VMMDevHGCMCall Call;608 VBoxSFParmInformation Parms;609 HGCMPageListInfo PgLst;610 } VBOXSFOBJINFOWITHBUFREQ;611 612 /**613 * SHFL_FN_INFORMATION[SHFL_INFO_SET | SHFL_INFO_FILE] request, with separate614 * buffer (on the physical heap).615 */616 DECLINLINE(int) vboxSfOs2HostReqSetObjInfoWithBuf(SHFLROOT idRoot, VBOXSFOBJINFOWITHBUFREQ *pReq, uint64_t hHostFile,617 PSHFLFSOBJINFO pObjInfo, uint32_t offObjInfoInAlloc)618 {619 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,620 SHFL_FN_INFORMATION, SHFL_CPARMS_INFORMATION, sizeof(*pReq));621 622 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;623 pReq->Parms.id32Root.u.value32 = idRoot;624 625 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;626 pReq->Parms.u64Handle.u.value64 = hHostFile;627 628 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;629 pReq->Parms.f32Flags.u.value32 = SHFL_INFO_SET | SHFL_INFO_FILE;630 631 pReq->Parms.cb32.type = VMMDevHGCMParmType_32bit;632 pReq->Parms.cb32.u.value32 = sizeof(*pObjInfo);633 634 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)635 {636 pReq->Parms.pInfo.type = VMMDevHGCMParmType_ContiguousPageList;637 pReq->Parms.pInfo.u.PageList.size = sizeof(*pObjInfo);638 pReq->Parms.pInfo.u.PageList.offset = RT_UOFFSETOF(VBOXSFOBJINFOREQ, ObjInfo) - sizeof(VBGLIOCIDCHGCMFASTCALL);639 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_BOTH;640 pReq->PgLst.aPages[0] = VbglR0PhysHeapGetPhysAddr((uint8_t *)pObjInfo - offObjInfoInAlloc) + offObjInfoInAlloc;641 pReq->PgLst.offFirstPage = (uint16_t)(pReq->PgLst.aPages[0] & PAGE_OFFSET_MASK);642 pReq->PgLst.aPages[0] &= ~(RTGCPHYS)PAGE_OFFSET_MASK;643 pReq->PgLst.cPages = 1;644 }645 else646 {647 pReq->Parms.pInfo.type = VMMDevHGCMParmType_LinAddr;648 pReq->Parms.pInfo.u.LinAddr.cb = sizeof(*pObjInfo);649 pReq->Parms.pInfo.u.LinAddr.uAddr = (uintptr_t)pObjInfo;650 }651 652 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));653 if (RT_SUCCESS(vrc))654 vrc = pReq->Call.header.result;655 return vrc;656 }657 658 659 /** Request structure for vboxSfOs2HostReqRemove. */660 typedef struct VBOXSFREMOVEREQ661 {662 VBGLIOCIDCHGCMFASTCALL Hdr;663 VMMDevHGCMCall Call;664 VBoxSFParmRemove Parms;665 SHFLSTRING StrPath;666 } VBOXSFREMOVEREQ;667 668 /**669 * SHFL_FN_REMOVE request.670 */671 DECLINLINE(int) vboxSfOs2HostReqRemove(SHFLROOT idRoot, VBOXSFREMOVEREQ *pReq, uint32_t fFlags)672 {673 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String)674 + (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS ? pReq->StrPath.u16Size : 0);675 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,676 SHFL_FN_REMOVE, SHFL_CPARMS_REMOVE, cbReq);677 678 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;679 pReq->Parms.id32Root.u.value32 = idRoot;680 681 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)682 {683 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_Embedded;684 pReq->Parms.pStrPath.u.Embedded.cbData = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;685 pReq->Parms.pStrPath.u.Embedded.offData = RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath) - sizeof(VBGLIOCIDCHGCMFASTCALL);686 pReq->Parms.pStrPath.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;687 }688 else689 {690 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_LinAddr_In;691 pReq->Parms.pStrPath.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size;692 pReq->Parms.pStrPath.u.LinAddr.uAddr = (uintptr_t)&pReq->StrPath;693 }694 695 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;696 pReq->Parms.f32Flags.u.value32 = fFlags;697 698 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);699 if (RT_SUCCESS(vrc))700 vrc = pReq->Call.header.result;701 return vrc;702 }703 704 705 /** Request structure for vboxSfOs2HostReqRename. */706 typedef struct VBOXSFRENAMEWITHSRCBUFREQ707 {708 VBGLIOCIDCHGCMFASTCALL Hdr;709 VMMDevHGCMCall Call;710 VBoxSFParmRename Parms;711 HGCMPageListInfo PgLst;712 SHFLSTRING StrDstPath;713 } VBOXSFRENAMEWITHSRCBUFREQ;714 715 /**716 * SHFL_FN_REMOVE request.717 */718 DECLINLINE(int) vboxSfOs2HostReqRenameWithSrcBuf(SHFLROOT idRoot, VBOXSFRENAMEWITHSRCBUFREQ *pReq,719 PSHFLSTRING pSrcStr, uint32_t fFlags)720 {721 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, StrDstPath.String)722 + (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS ? pReq->StrDstPath.u16Size : 0);723 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,724 SHFL_FN_RENAME, SHFL_CPARMS_RENAME, cbReq);725 726 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;727 pReq->Parms.id32Root.u.value32 = idRoot;728 729 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)730 {731 pReq->Parms.pStrSrcPath.type = VMMDevHGCMParmType_ContiguousPageList;732 pReq->Parms.pStrSrcPath.u.PageList.size = SHFLSTRING_HEADER_SIZE + pSrcStr->u16Size;733 pReq->Parms.pStrSrcPath.u.PageList.offset = RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, PgLst)734 - sizeof(VBGLIOCIDCHGCMFASTCALL);735 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;736 pReq->PgLst.aPages[0] = VbglR0PhysHeapGetPhysAddr(pSrcStr);737 pReq->PgLst.offFirstPage = (uint16_t)(pReq->PgLst.aPages[0] & PAGE_OFFSET_MASK);738 pReq->PgLst.aPages[0] &= ~(RTGCPHYS)PAGE_OFFSET_MASK;739 pReq->PgLst.cPages = 1;740 }741 else742 {743 pReq->Parms.pStrSrcPath.type = VMMDevHGCMParmType_LinAddr_In;744 pReq->Parms.pStrSrcPath.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pSrcStr->u16Size;745 pReq->Parms.pStrSrcPath.u.LinAddr.uAddr = (uintptr_t)pSrcStr;746 }747 748 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)749 {750 pReq->Parms.pStrDstPath.type = VMMDevHGCMParmType_Embedded;751 pReq->Parms.pStrDstPath.u.Embedded.cbData = SHFLSTRING_HEADER_SIZE + pReq->StrDstPath.u16Size;752 pReq->Parms.pStrDstPath.u.Embedded.offData = RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, StrDstPath)753 - sizeof(VBGLIOCIDCHGCMFASTCALL);754 pReq->Parms.pStrDstPath.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;755 }756 else757 {758 pReq->Parms.pStrDstPath.type = VMMDevHGCMParmType_LinAddr_In;759 pReq->Parms.pStrDstPath.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pReq->StrDstPath.u16Size;760 pReq->Parms.pStrDstPath.u.LinAddr.uAddr = (uintptr_t)&pReq->StrDstPath;761 }762 763 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;764 pReq->Parms.f32Flags.u.value32 = fFlags;765 766 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);767 if (RT_SUCCESS(vrc))768 vrc = pReq->Call.header.result;769 return vrc;770 }771 772 773 /** Request structure for vboxSfOs2HostReqFlush. */774 typedef struct VBOXSFFLUSHREQ775 {776 VBGLIOCIDCHGCMFASTCALL Hdr;777 VMMDevHGCMCall Call;778 VBoxSFParmFlush Parms;779 } VBOXSFFLUSHREQ;780 781 /**782 * SHFL_FN_FLUSH request.783 */784 DECLINLINE(int) vboxSfOs2HostReqFlush(SHFLROOT idRoot, VBOXSFFLUSHREQ *pReq, uint64_t hHostFile)785 {786 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,787 SHFL_FN_FLUSH, SHFL_CPARMS_FLUSH, sizeof(*pReq));788 789 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;790 pReq->Parms.id32Root.u.value32 = idRoot;791 792 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;793 pReq->Parms.u64Handle.u.value64 = hHostFile;794 795 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));796 if (RT_SUCCESS(vrc))797 vrc = pReq->Call.header.result;798 return vrc;799 }800 801 /**802 * SHFL_FN_FLUSH request, allocate request buffer.803 */804 DECLINLINE(int) vboxSfOs2HostReqFlushSimple(SHFLROOT idRoot, uint64_t hHostFile)805 {806 VBOXSFFLUSHREQ *pReq = (VBOXSFFLUSHREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));807 if (pReq)808 {809 int vrc = vboxSfOs2HostReqFlush(idRoot, pReq, hHostFile);810 VbglR0PhysHeapFree(pReq);811 return vrc;812 }813 return VERR_NO_MEMORY;814 }815 816 817 /** Request structure for vboxSfOs2HostReqSetFileSize. */818 typedef struct VBOXSFSETFILESIZEREQ819 {820 VBGLIOCIDCHGCMFASTCALL Hdr;821 VMMDevHGCMCall Call;822 VBoxSFParmSetFileSize Parms;823 } VBOXSFSETFILESIZEREQ;824 825 /**826 * SHFL_FN_SET_FILE_SIZE request.827 */828 DECLINLINE(int) vboxSfOs2HostReqSetFileSize(SHFLROOT idRoot, VBOXSFSETFILESIZEREQ *pReq,829 uint64_t hHostFile, uint64_t cbNewSize)830 {831 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,832 SHFL_FN_SET_FILE_SIZE, SHFL_CPARMS_SET_FILE_SIZE, sizeof(*pReq));833 834 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;835 pReq->Parms.id32Root.u.value32 = idRoot;836 837 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;838 pReq->Parms.u64Handle.u.value64 = hHostFile;839 840 pReq->Parms.cb64NewSize.type = VMMDevHGCMParmType_64bit;841 pReq->Parms.cb64NewSize.u.value64 = cbNewSize;842 843 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));844 if (RT_SUCCESS(vrc))845 vrc = pReq->Call.header.result;846 return vrc;847 }848 849 /**850 * SHFL_FN_SET_FILE_SIZE request, allocate request buffer.851 */852 DECLINLINE(int) vboxSfOs2HostReqSetFileSizeSimple(SHFLROOT idRoot, uint64_t hHostFile, uint64_t cbNewSize)853 {854 VBOXSFSETFILESIZEREQ *pReq = (VBOXSFSETFILESIZEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));855 if (pReq)856 {857 int vrc = vboxSfOs2HostReqSetFileSize(idRoot, pReq, hHostFile, cbNewSize);858 VbglR0PhysHeapFree(pReq);859 return vrc;860 }861 return VERR_NO_MEMORY;862 }863 864 865 /** Request structure for vboxSfOs2HostReqReadEmbedded. */866 typedef struct VBOXSFREADEMBEDDEDREQ867 {868 VBGLIOCIDCHGCMFASTCALL Hdr;869 VMMDevHGCMCall Call;870 VBoxSFParmRead Parms;871 uint8_t abData[RT_FLEXIBLE_ARRAY];872 } VBOXSFREADEMBEDDEDREQ;873 874 /**875 * SHFL_FN_READ request using embedded data buffer.876 */877 DECLINLINE(int) vboxSfOs2HostReqReadEmbedded(SHFLROOT idRoot, VBOXSFREADEMBEDDEDREQ *pReq, uint64_t hHostFile,878 uint64_t offRead, uint32_t cbToRead)879 {880 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFREADEMBEDDEDREQ, abData[0])881 + (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS ? cbToRead : 0);882 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,883 SHFL_FN_READ, SHFL_CPARMS_READ, cbReq);884 885 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;886 pReq->Parms.id32Root.u.value32 = idRoot;887 888 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;889 pReq->Parms.u64Handle.u.value64 = hHostFile;890 891 pReq->Parms.off64Read.type = VMMDevHGCMParmType_64bit;892 pReq->Parms.off64Read.u.value64 = offRead;893 894 pReq->Parms.cb32Read.type = VMMDevHGCMParmType_32bit;895 pReq->Parms.cb32Read.u.value32 = cbToRead;896 897 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)898 {899 pReq->Parms.pBuf.type = VMMDevHGCMParmType_Embedded;900 pReq->Parms.pBuf.u.Embedded.cbData = cbToRead;901 pReq->Parms.pBuf.u.Embedded.offData = RT_UOFFSETOF(VBOXSFREADEMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);902 pReq->Parms.pBuf.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;903 }904 else905 {906 pReq->Parms.pBuf.type = VMMDevHGCMParmType_LinAddr_Out;907 pReq->Parms.pBuf.u.LinAddr.cb = cbToRead;908 pReq->Parms.pBuf.u.LinAddr.uAddr = (uintptr_t)&pReq->abData[0];909 }910 911 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);912 if (RT_SUCCESS(vrc))913 vrc = pReq->Call.header.result;914 return vrc;915 }916 917 918 /** Request structure for vboxSfOs2HostReqRead & vboxSfOs2HostReqReadContig. */919 typedef struct VBOXSFREADPGLSTREQ920 {921 VBGLIOCIDCHGCMFASTCALL Hdr;922 VMMDevHGCMCall Call;923 VBoxSFParmRead Parms;924 HGCMPageListInfo PgLst;925 } VBOXSFREADPGLSTREQ;926 927 /**928 * SHFL_FN_READ request using page list for data buffer (caller populated).929 */930 DECLINLINE(int) vboxSfOs2HostReqReadPgLst(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile,931 uint64_t offRead, uint32_t cbToRead, uint32_t cPages)932 {933 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,934 SHFL_FN_READ, SHFL_CPARMS_READ,935 RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cPages]));936 937 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;938 pReq->Parms.id32Root.u.value32 = idRoot;939 940 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;941 pReq->Parms.u64Handle.u.value64 = hHostFile;942 943 pReq->Parms.off64Read.type = VMMDevHGCMParmType_64bit;944 pReq->Parms.off64Read.u.value64 = offRead;945 946 pReq->Parms.cb32Read.type = VMMDevHGCMParmType_32bit;947 pReq->Parms.cb32Read.u.value32 = cbToRead;948 949 pReq->Parms.pBuf.type = VMMDevHGCMParmType_PageList;950 pReq->Parms.pBuf.u.PageList.size = cbToRead;951 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFREADPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);952 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;953 pReq->PgLst.cPages = (uint16_t)cPages;954 AssertReturn(cPages <= UINT16_MAX, VERR_OUT_OF_RANGE);955 /* caller sets offset */956 957 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr,958 RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cPages]));959 if (RT_SUCCESS(vrc))960 vrc = pReq->Call.header.result;961 return vrc;962 }963 964 965 /**966 * SHFL_FN_READ request using a physically contiguous buffer.967 */968 DECLINLINE(int) vboxSfOs2HostReqReadContig(SHFLROOT idRoot, VBOXSFREADPGLSTREQ *pReq, uint64_t hHostFile,969 uint64_t offRead, uint32_t cbToRead, void *pvBuffer, RTGCPHYS64 PhysBuffer)970 {971 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,972 SHFL_FN_READ, SHFL_CPARMS_READ, RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[1]));973 974 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;975 pReq->Parms.id32Root.u.value32 = idRoot;976 977 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;978 pReq->Parms.u64Handle.u.value64 = hHostFile;979 980 pReq->Parms.off64Read.type = VMMDevHGCMParmType_64bit;981 pReq->Parms.off64Read.u.value64 = offRead;982 983 pReq->Parms.cb32Read.type = VMMDevHGCMParmType_32bit;984 pReq->Parms.cb32Read.u.value32 = cbToRead;985 986 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)987 {988 pReq->Parms.pBuf.type = VMMDevHGCMParmType_ContiguousPageList;989 pReq->Parms.pBuf.u.PageList.size = cbToRead;990 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFREADPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);991 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;992 pReq->PgLst.offFirstPage = (uint16_t)(PhysBuffer & PAGE_OFFSET_MASK);993 pReq->PgLst.cPages = 1;994 pReq->PgLst.aPages[0] = PhysBuffer & ~(RTGCPHYS64)PAGE_OFFSET_MASK;995 }996 else997 {998 pReq->Parms.pBuf.type = VMMDevHGCMParmType_LinAddr_Out;999 pReq->Parms.pBuf.u.LinAddr.cb = cbToRead;1000 pReq->Parms.pBuf.u.LinAddr.uAddr = (uintptr_t)pvBuffer;1001 }1002 1003 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[1]));1004 if (RT_SUCCESS(vrc))1005 vrc = pReq->Call.header.result;1006 return vrc;1007 }1008 1009 1010 1011 /** Request structure for vboxSfOs2HostReqWriteEmbedded. */1012 typedef struct VBOXSFWRITEEMBEDDEDREQ1013 {1014 VBGLIOCIDCHGCMFASTCALL Hdr;1015 VMMDevHGCMCall Call;1016 VBoxSFParmWrite Parms;1017 uint8_t abData[RT_FLEXIBLE_ARRAY];1018 } VBOXSFWRITEEMBEDDEDREQ;1019 1020 /**1021 * SHFL_FN_WRITE request using embedded data buffer.1022 */1023 DECLINLINE(int) vboxSfOs2HostReqWriteEmbedded(SHFLROOT idRoot, VBOXSFWRITEEMBEDDEDREQ *pReq, uint64_t hHostFile,1024 uint64_t offWrite, uint32_t cbToWrite)1025 {1026 uint32_t const cbReq = RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0])1027 + (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS ? cbToWrite : 0);1028 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,1029 SHFL_FN_WRITE, SHFL_CPARMS_WRITE, cbReq);1030 1031 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;1032 pReq->Parms.id32Root.u.value32 = idRoot;1033 1034 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;1035 pReq->Parms.u64Handle.u.value64 = hHostFile;1036 1037 pReq->Parms.off64Write.type = VMMDevHGCMParmType_64bit;1038 pReq->Parms.off64Write.u.value64 = offWrite;1039 1040 pReq->Parms.cb32Write.type = VMMDevHGCMParmType_32bit;1041 pReq->Parms.cb32Write.u.value32 = cbToWrite;1042 1043 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)1044 {1045 pReq->Parms.pBuf.type = VMMDevHGCMParmType_Embedded;1046 pReq->Parms.pBuf.u.Embedded.cbData = cbToWrite;1047 pReq->Parms.pBuf.u.Embedded.offData = RT_UOFFSETOF(VBOXSFWRITEEMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);1048 pReq->Parms.pBuf.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;1049 }1050 else1051 {1052 pReq->Parms.pBuf.type = VMMDevHGCMParmType_LinAddr_In;1053 pReq->Parms.pBuf.u.LinAddr.cb = cbToWrite;1054 pReq->Parms.pBuf.u.LinAddr.uAddr = (uintptr_t)&pReq->abData[0];1055 }1056 1057 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq);1058 if (RT_SUCCESS(vrc))1059 vrc = pReq->Call.header.result;1060 return vrc;1061 }1062 1063 1064 /** Request structure for vboxSfOs2HostReqWrite and vboxSfOs2HostReqWriteContig. */1065 typedef struct VBOXSFWRITEPGLSTREQ1066 {1067 VBGLIOCIDCHGCMFASTCALL Hdr;1068 VMMDevHGCMCall Call;1069 VBoxSFParmWrite Parms;1070 HGCMPageListInfo PgLst;1071 } VBOXSFWRITEPGLSTREQ;1072 1073 /**1074 * SHFL_FN_WRITE request using page list for data buffer (caller populated).1075 */1076 DECLINLINE(int) vboxSfOs2HostReqWritePgLst(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile,1077 uint64_t offWrite, uint32_t cbToWrite, uint32_t cPages)1078 {1079 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,1080 SHFL_FN_WRITE, SHFL_CPARMS_WRITE,1081 RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cPages]));1082 1083 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;1084 pReq->Parms.id32Root.u.value32 = idRoot;1085 1086 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;1087 pReq->Parms.u64Handle.u.value64 = hHostFile;1088 1089 pReq->Parms.off64Write.type = VMMDevHGCMParmType_64bit;1090 pReq->Parms.off64Write.u.value64 = offWrite;1091 1092 pReq->Parms.cb32Write.type = VMMDevHGCMParmType_32bit;1093 pReq->Parms.cb32Write.u.value32 = cbToWrite;1094 1095 pReq->Parms.pBuf.type = VMMDevHGCMParmType_PageList;1096 pReq->Parms.pBuf.u.PageList.size = cbToWrite;1097 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFWRITEPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);1098 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;1099 pReq->PgLst.cPages = (uint16_t)cPages;1100 AssertReturn(cPages <= UINT16_MAX, VERR_OUT_OF_RANGE);1101 /* caller sets offset */1102 1103 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr,1104 RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cPages]));1105 if (RT_SUCCESS(vrc))1106 vrc = pReq->Call.header.result;1107 return vrc;1108 }1109 1110 1111 /**1112 * SHFL_FN_WRITE request using a physically contiguous buffer.1113 */1114 DECLINLINE(int) vboxSfOs2HostReqWriteContig(SHFLROOT idRoot, VBOXSFWRITEPGLSTREQ *pReq, uint64_t hHostFile,1115 uint64_t offWrite, uint32_t cbToWrite, void const *pvBuffer, RTGCPHYS64 PhysBuffer)1116 {1117 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,1118 SHFL_FN_WRITE, SHFL_CPARMS_WRITE, RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[1]));1119 1120 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;1121 pReq->Parms.id32Root.u.value32 = idRoot;1122 1123 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;1124 pReq->Parms.u64Handle.u.value64 = hHostFile;1125 1126 pReq->Parms.off64Write.type = VMMDevHGCMParmType_64bit;1127 pReq->Parms.off64Write.u.value64 = offWrite;1128 1129 pReq->Parms.cb32Write.type = VMMDevHGCMParmType_32bit;1130 pReq->Parms.cb32Write.u.value32 = cbToWrite;1131 1132 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)1133 {1134 pReq->Parms.pBuf.type = VMMDevHGCMParmType_ContiguousPageList;1135 pReq->Parms.pBuf.u.PageList.size = cbToWrite;1136 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFWRITEPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);1137 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;1138 pReq->PgLst.offFirstPage = (uint16_t)(PhysBuffer & PAGE_OFFSET_MASK);1139 pReq->PgLst.cPages = 1;1140 pReq->PgLst.aPages[0] = PhysBuffer & ~(RTGCPHYS64)PAGE_OFFSET_MASK;1141 }1142 else1143 {1144 pReq->Parms.pBuf.type = VMMDevHGCMParmType_LinAddr_In;1145 pReq->Parms.pBuf.u.LinAddr.cb = cbToWrite;1146 pReq->Parms.pBuf.u.LinAddr.uAddr = (uintptr_t)pvBuffer;1147 }1148 1149 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[1]));1150 if (RT_SUCCESS(vrc))1151 vrc = pReq->Call.header.result;1152 return vrc;1153 }1154 1155 1156 /**1157 * SHFL_FN_LIST request with separate string buffer and buffers for entries,1158 * both allocated on the physical heap.1159 */1160 DECLINLINE(int) vboxSfOs2HostReqListDir(SHFLROOT idRoot, VBOXSFLISTDIRREQ *pReq, uint64_t hHostDir,1161 PSHFLSTRING pFilter, uint32_t fFlags, PSHFLDIRINFO pBuffer, uint32_t cbBuffer)1162 {1163 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient,1164 SHFL_FN_LIST, SHFL_CPARMS_LIST, sizeof(*pReq));1165 1166 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit;1167 pReq->Parms.id32Root.u.value32 = idRoot;1168 1169 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit;1170 pReq->Parms.u64Handle.u.value64 = hHostDir;1171 1172 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit;1173 pReq->Parms.f32Flags.u.value32 = fFlags;1174 1175 pReq->Parms.cb32Buffer.type = VMMDevHGCMParmType_32bit;1176 pReq->Parms.cb32Buffer.u.value32 = cbBuffer;1177 1178 if (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)1179 {1180 pReq->Parms.pStrFilter.type = VMMDevHGCMParmType_ContiguousPageList;1181 pReq->Parms.pStrFilter.u.PageList.offset = RT_UOFFSETOF(VBOXSFLISTDIRREQ, StrPgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);1182 pReq->StrPgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;1183 pReq->StrPgLst.cPages = 1;1184 if (pFilter)1185 {1186 pReq->Parms.pStrFilter.u.PageList.size = SHFLSTRING_HEADER_SIZE + pFilter->u16Size;1187 RTGCPHYS32 const GCPhys = VbglR0PhysHeapGetPhysAddr(pFilter);1188 uint32_t const offFirstPage = GCPhys & PAGE_OFFSET_MASK;1189 pReq->StrPgLst.offFirstPage = (uint16_t)offFirstPage;1190 pReq->StrPgLst.aPages[0] = GCPhys - offFirstPage;1191 }1192 else1193 {1194 pReq->Parms.pStrFilter.u.PageList.size = 0;1195 pReq->StrPgLst.offFirstPage = 0;1196 pReq->StrPgLst.aPages[0] = NIL_RTGCPHYS64;1197 }1198 1199 pReq->Parms.pBuffer.type = VMMDevHGCMParmType_ContiguousPageList;1200 pReq->Parms.pBuffer.u.PageList.offset = RT_UOFFSETOF(VBOXSFLISTDIRREQ, BufPgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL);1201 pReq->Parms.pBuffer.u.PageList.size = cbBuffer;1202 pReq->BufPgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;1203 pReq->BufPgLst.cPages = 1;1204 RTGCPHYS32 const GCPhys = VbglR0PhysHeapGetPhysAddr(pBuffer);1205 uint32_t const offFirstPage = GCPhys & PAGE_OFFSET_MASK;1206 pReq->BufPgLst.offFirstPage = (uint16_t)offFirstPage;1207 pReq->BufPgLst.aPages[0] = GCPhys - offFirstPage;1208 }1209 else1210 {1211 pReq->Parms.pStrFilter.type = VMMDevHGCMParmType_LinAddr_In;1212 pReq->Parms.pStrFilter.u.LinAddr.cb = pFilter ? SHFLSTRING_HEADER_SIZE + pFilter->u16Size : 0;1213 pReq->Parms.pStrFilter.u.LinAddr.uAddr = (uintptr_t)pFilter;1214 1215 pReq->Parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_Out;1216 pReq->Parms.pBuffer.u.LinAddr.cb = cbBuffer;1217 pReq->Parms.pBuffer.u.LinAddr.uAddr = (uintptr_t)pBuffer;1218 }1219 1220 pReq->Parms.f32Done.type = VMMDevHGCMParmType_32bit;1221 pReq->Parms.f32Done.u.value32 = 0;1222 1223 pReq->Parms.c32Entries.type = VMMDevHGCMParmType_32bit;1224 pReq->Parms.c32Entries.u.value32 = 0;1225 1226 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq));1227 if (RT_SUCCESS(vrc))1228 vrc = pReq->Call.header.result;1229 return vrc;1230 }1231 1232 /** @} */1233 1234 253 #endif /* !GA_INCLUDED_SRC_os2_VBoxSF_VBoxSFInternal_h */ 1235 254
Note:
See TracChangeset
for help on using the changeset viewer.