Changeset 76118 in vbox for trunk/src/VBox
- Timestamp:
- Dec 10, 2018 1:07:58 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/os2/VBoxSF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSF.cpp
r76108 r76118 1315 1315 struct 1316 1316 { 1317 SHFLCREATEPARMS Params; 1318 union 1319 { 1320 SHFLSTRING Path; 1321 uint8_t abPadding[SHFLSTRING_HEADER_SIZE + 4 * sizeof(RTUTF16)]; 1322 }; 1317 VBOXSFCREATEREQ Req; 1318 uint8_t PathStringSpace[4 * sizeof(RTUTF16)]; 1323 1319 } Open; 1324 1320 struct 1325 1321 { 1326 SHFLVOLINFO VolInfo;1322 VBOXSFVOLINFOREQ Req; 1327 1323 union 1328 1324 { … … 1331 1327 }; 1332 1328 } Info; 1329 VBOXSFCLOSEREQ Close; 1333 1330 } *pu = (union FsInfoBufs *)VbglR0PhysHeapAlloc(sizeof(*pu)); 1334 1331 if (!pu) … … 1338 1335 * To get the info we need to open the root of the folder. 1339 1336 */ 1340 RT_ZERO(pu->Open.Params); 1341 pu->Open.Params.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACT_OPEN_IF_EXISTS 1342 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE; 1343 pu->Open.Path.u16Size = 3 * sizeof(RTUTF16); 1344 pu->Open.Path.u16Length = 2 * sizeof(RTUTF16); 1345 pu->Open.Path.String.utf16[0] = '\\'; 1346 pu->Open.Path.String.utf16[1] = '.'; 1347 pu->Open.Path.String.utf16[2] = '\0'; 1348 1349 int vrc = VbglR0SfCreate(&g_SfClient, &pFolder->hHostFolder, &pu->Open.Path, &pu->Open.Params); 1350 LogFlow(("FS32_FSINFO: VbglR0SfCreate -> %Rrc Result=%d Handle=%#RX64\n", vrc, pu->Open.Params.Result, pu->Open.Params.Handle)); 1337 RT_ZERO(pu->Open.Req); 1338 pu->Open.Req.CreateParms.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACT_OPEN_IF_EXISTS 1339 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE; 1340 pu->Open.Req.StrPath.u16Size = 3 * sizeof(RTUTF16); 1341 pu->Open.Req.StrPath.u16Length = 2 * sizeof(RTUTF16); 1342 pu->Open.Req.StrPath.String.utf16[0] = '\\'; 1343 pu->Open.Req.StrPath.String.utf16[1] = '.'; 1344 pu->Open.Req.StrPath.String.utf16[2] = '\0'; 1345 1346 int vrc = vboxSfOs2HostReqCreate(pFolder, &pu->Open.Req); 1347 LogFlow(("FS32_FSINFO: vboxSfOs2HostReqCreate -> %Rrc Result=%d Handle=%#RX64\n", 1348 vrc, pu->Open.Req.CreateParms.Result, pu->Open.Req.CreateParms.Handle)); 1351 1349 if ( RT_SUCCESS(vrc) 1352 && pu->Open.Params.Handle != SHFL_HANDLE_NIL) 1353 { 1354 SHFLHANDLE hHandle = pu->Open.Params.Handle; 1355 1356 RT_ZERO(pu->Info.VolInfo); 1357 uint32_t cbBuf = sizeof(pu->Info.VolInfo); 1358 vrc = VbglR0SfFsInfo(&g_SfClient, &pFolder->hHostFolder, hHandle, SHFL_INFO_VOLUME | SHFL_INFO_GET, 1359 &cbBuf, (PSHFLDIRINFO)&pu->Info.VolInfo); 1350 && pu->Open.Req.CreateParms.Handle != SHFL_HANDLE_NIL) 1351 { 1352 SHFLHANDLE hHandle = pu->Open.Req.CreateParms.Handle; 1353 1354 RT_ZERO(pu->Info.Req); 1355 vrc = vboxSfOs2HostReqQueryVolInfo(pFolder, &pu->Info.Req, hHandle); 1360 1356 if (RT_SUCCESS(vrc)) 1361 1357 { … … 1366 1362 { 1367 1363 pu->Info.Alloc.idFileSystem = 0; /* unknown */ 1368 pu->Info.Alloc.cSectorUnit = pu->Info.VolInfo.ulBytesPerAllocationUnit / RT_MAX(pu->Info.VolInfo.ulBytesPerSector, 1); 1369 pu->Info.Alloc.cUnit = (uint32_t)(pu->Info.VolInfo.ullTotalAllocationBytes / RT_MAX(pu->Info.VolInfo.ulBytesPerAllocationUnit, 1)); 1370 pu->Info.Alloc.cUnitAvail = (uint32_t)(pu->Info.VolInfo.ullAvailableAllocationBytes / RT_MAX(pu->Info.VolInfo.ulBytesPerAllocationUnit, 1)); 1371 pu->Info.Alloc.cbSector = (uint16_t)(pu->Info.VolInfo.ulBytesPerSector); 1364 uint32_t const cbSector = RT_MAX(pu->Info.Req.VolInfo.ulBytesPerSector, 1); 1365 pu->Info.Alloc.cSectorUnit = pu->Info.Req.VolInfo.ulBytesPerAllocationUnit / cbSector; 1366 pu->Info.Alloc.cUnit = (uint32_t)(pu->Info.Req.VolInfo.ullTotalAllocationBytes / cbSector); 1367 pu->Info.Alloc.cUnitAvail = (uint32_t)(pu->Info.Req.VolInfo.ullAvailableAllocationBytes / cbSector); 1368 pu->Info.Alloc.cbSector = (uint16_t)pu->Info.Req.VolInfo.ulBytesPerSector; 1372 1369 rc = KernCopyOut(pbData, &pu->Info.Alloc, sizeof(pu->Info.Alloc)); 1373 1370 } … … 1377 1374 pu->Info.FsInfo.vol.cch = (uint8_t)RT_MIN(pFolder->cchName, sizeof(pu->Info.FsInfo.vol.szVolLabel) - 1); 1378 1375 memcpy(pu->Info.FsInfo.vol.szVolLabel, pFolder->szName, pu->Info.FsInfo.vol.cch); 1379 *(uint32_t *)&pu->Info.FsInfo.fdateCreation = pu->Info. VolInfo.ulSerial;1376 *(uint32_t *)&pu->Info.FsInfo.fdateCreation = pu->Info.Req.VolInfo.ulSerial; 1380 1377 rc = KernCopyOut(pbData, &pu->Info.FsInfo, sizeof(pu->Info.FsInfo)); 1381 1378 } … … 1387 1384 } 1388 1385 1389 vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, hHandle);1386 vrc = vboxSfOs2HostReqClose(pFolder, &pu->Close, hHandle); 1390 1387 AssertRC(vrc); 1391 1388 } -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h
r76108 r76118 286 286 287 287 288 /** Request structure for vboxSfOs2HostReqCreate. */ 289 typedef struct VBOXSFCLOSEREQ 290 { 291 VBGLIOCIDCHGCMFASTCALL Hdr; 292 VMMDevHGCMCall Call; 293 VBoxSFParmClose Parms; 294 } VBOXSFCLOSEREQ; 295 296 /** 297 * SHFL_FN_CLOSE request. 298 */ 299 DECLINLINE(int) vboxSfOs2HostReqClose(PVBOXSFFOLDER pFolder, VBOXSFCLOSEREQ *pReq, uint64_t uHandle) 300 { 301 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, 302 SHFL_FN_CLOSE, SHFL_CPARMS_CLOSE, sizeof(*pReq)); 303 304 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit; 305 pReq->Parms.id32Root.u.value32 = pFolder->hHostFolder.root; 306 307 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit; 308 pReq->Parms.u64Handle.u.value64 = uHandle; 309 310 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq)); 311 if (RT_SUCCESS(vrc)) 312 vrc = pReq->Call.header.result; 313 return vrc; 314 } 315 316 317 /** Request structure for vboxSfOs2HostReqQueryVolInfo. */ 318 typedef struct VBOXSFVOLINFOREQ 319 { 320 VBGLIOCIDCHGCMFASTCALL Hdr; 321 VMMDevHGCMCall Call; 322 VBoxSFParmInformation Parms; 323 SHFLVOLINFO VolInfo; 324 } VBOXSFVOLINFOREQ; 325 326 /** 327 * SHFL_FN_INFORMATION[SHFL_INFO_VOLUME | SHFL_INFO_GET] request. 328 */ 329 DECLINLINE(int) vboxSfOs2HostReqQueryVolInfo(PVBOXSFFOLDER pFolder, VBOXSFVOLINFOREQ *pReq, uint64_t uHandle) 330 { 331 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, 332 SHFL_FN_INFORMATION, SHFL_CPARMS_INFORMATION, sizeof(*pReq)); 333 334 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit; 335 pReq->Parms.id32Root.u.value32 = pFolder->hHostFolder.root; 336 337 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit; 338 pReq->Parms.u64Handle.u.value64 = uHandle; 339 340 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit; 341 pReq->Parms.f32Flags.u.value32 = SHFL_INFO_VOLUME | SHFL_INFO_GET; 342 343 pReq->Parms.cb32.type = VMMDevHGCMParmType_32bit; 344 pReq->Parms.cb32.u.value32 = sizeof(pReq->VolInfo); 345 346 pReq->Parms.pInfo.type = VMMDevHGCMParmType_Embedded; 347 pReq->Parms.pInfo.u.Embedded.cbData = sizeof(pReq->VolInfo); 348 pReq->Parms.pInfo.u.Embedded.offData = RT_UOFFSETOF(VBOXSFVOLINFOREQ, VolInfo) - sizeof(VBGLIOCIDCHGCMFASTCALL); 349 pReq->Parms.pInfo.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 350 351 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq)); 352 if (RT_SUCCESS(vrc)) 353 vrc = pReq->Call.header.result; 354 return vrc; 355 } 356 357 288 358 #endif 289 359
Note:
See TracChangeset
for help on using the changeset viewer.