Changeset 77858 in vbox for trunk/include/VBox
- Timestamp:
- Mar 24, 2019 12:10:24 AM (6 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLibSharedFoldersInline.h
r77854 r77858 42 42 #include <VBox/VMMDev.h> 43 43 #include <VBox/shflsvc.h> 44 #include <iprt/err core.h>44 #include <iprt/err.h> 45 45 46 46 … … 734 734 - sizeof(VBGLIOCIDCHGCMFASTCALL); 735 735 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST; 736 pReq->PgLst.offFirstPage = ( (uint16_t)PhysSrcStr)& (uint16_t)(PAGE_OFFSET_MASK);736 pReq->PgLst.offFirstPage = (uint16_t)PhysSrcStr & (uint16_t)(PAGE_OFFSET_MASK); 737 737 pReq->PgLst.aPages[0] = PhysSrcStr & ~(RTGCPHYS64)PAGE_OFFSET_MASK; 738 738 pReq->PgLst.cPages = 1; … … 1318 1318 } 1319 1319 1320 1321 /** Request structure for VbglR0SfHostReqReadLink. */ 1322 typedef struct VBOXSFREADLINKREQ 1323 { 1324 VBGLIOCIDCHGCMFASTCALL Hdr; 1325 VMMDevHGCMCall Call; 1326 VBoxSFParmReadLink Parms; 1327 HGCMPageListInfo PgLst; 1328 SHFLSTRING StrPath; 1329 } VBOXSFREADLINKREQ; 1330 1331 /** 1332 * SHFL_FN_READLINK request. 1333 * 1334 * @note Buffer contains UTF-8 characters on success, regardless of the 1335 * UTF-8/UTF-16 setting of the connection. 1336 */ 1337 DECLINLINE(int) VbglR0SfHostReqReadLinkContig(SHFLROOT idRoot, void *pvBuffer, RTGCPHYS64 PhysBuffer, uint32_t cbBuffer, 1338 VBOXSFREADLINKREQ *pReq) 1339 { 1340 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS 1341 ? RT_UOFFSETOF(VBOXSFREADLINKREQ, StrPath.String) + pReq->StrPath.u16Size 1342 : cbBuffer <= PAGE_SIZE - (PhysBuffer & PAGE_OFFSET_MASK) 1343 || (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST) 1344 ? RT_UOFFSETOF(VBOXSFREADLINKREQ, StrPath.String) 1345 : RT_UOFFSETOF(VBOXSFREADLINKREQ, PgLst); 1346 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, 1347 SHFL_FN_READLINK, SHFL_CPARMS_READLINK, cbReq); 1348 1349 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit; 1350 pReq->Parms.id32Root.u.value32 = idRoot; 1351 1352 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS) 1353 { 1354 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_Embedded; 1355 pReq->Parms.pStrPath.u.Embedded.cbData = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size; 1356 pReq->Parms.pStrPath.u.Embedded.offData = RT_UOFFSETOF(VBOXSFREADLINKREQ, StrPath) 1357 - sizeof(VBGLIOCIDCHGCMFASTCALL); 1358 pReq->Parms.pStrPath.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST; 1359 } 1360 else 1361 { 1362 pReq->Parms.pStrPath.type = VMMDevHGCMParmType_LinAddr_In; 1363 pReq->Parms.pStrPath.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pReq->StrPath.u16Size; 1364 pReq->Parms.pStrPath.u.LinAddr.uAddr = (uintptr_t)&pReq->StrPath; 1365 } 1366 1367 if ( cbBuffer <= PAGE_SIZE - (PhysBuffer & PAGE_OFFSET_MASK) 1368 || (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)) 1369 { 1370 pReq->Parms.pBuffer.type = cbBuffer <= PAGE_SIZE - (PhysBuffer & PAGE_OFFSET_MASK) 1371 ? VMMDevHGCMParmType_PageList 1372 : VMMDevHGCMParmType_ContiguousPageList; 1373 pReq->Parms.pBuffer.u.PageList.size = cbBuffer; 1374 pReq->Parms.pBuffer.u.PageList.offset = RT_UOFFSETOF(VBOXSFREADLINKREQ, PgLst) 1375 - sizeof(VBGLIOCIDCHGCMFASTCALL); 1376 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 1377 pReq->PgLst.offFirstPage = (uint16_t)PhysBuffer & (uint16_t)(PAGE_OFFSET_MASK); 1378 pReq->PgLst.aPages[0] = PhysBuffer & ~(RTGCPHYS64)PAGE_OFFSET_MASK; 1379 pReq->PgLst.cPages = 1; 1380 } 1381 else 1382 { 1383 pReq->Parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_Out; 1384 pReq->Parms.pBuffer.u.LinAddr.cb = cbBuffer; 1385 pReq->Parms.pBuffer.u.LinAddr.uAddr = (uintptr_t)pvBuffer; 1386 } 1387 1388 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq); 1389 if (RT_SUCCESS(vrc)) 1390 vrc = pReq->Call.header.result; 1391 return vrc; 1392 } 1393 1394 /** 1395 * SHFL_FN_READLINK request, simplified version. 1396 * 1397 * 1398 * @note Buffer contains UTF-8 characters on success, regardless of the 1399 * UTF-8/UTF-16 setting of the connection. 1400 */ 1401 DECLINLINE(int) VbglR0SfHostReqReadLinkContigSimple(SHFLROOT idRoot, const char *pszPath, size_t cchPath, void *pvBuf, 1402 RTGCPHYS64 PhysBuffer, uint32_t cbBuffer) 1403 { 1404 if (cchPath < _64K - 1) 1405 { 1406 VBOXSFREADLINKREQ *pReq = (VBOXSFREADLINKREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREADLINKREQ, StrPath.String) 1407 + SHFLSTRING_HEADER_SIZE + cchPath); 1408 if (pReq) 1409 { 1410 pReq->StrPath.u16Length = (uint16_t)cchPath; 1411 pReq->StrPath.u16Size = (uint16_t)cchPath + 1; 1412 memcpy(pReq->StrPath.String.ach, pszPath, cchPath); 1413 pReq->StrPath.String.ach[cchPath] = '\0'; 1414 1415 { 1416 int vrc = VbglR0SfHostReqReadLinkContig(idRoot, pvBuf, PhysBuffer, cbBuffer, pReq); 1417 VbglR0PhysHeapFree(pReq); 1418 return vrc; 1419 } 1420 } 1421 return VERR_NO_MEMORY; 1422 } 1423 return VERR_FILENAME_TOO_LONG; 1424 } 1425 1426 1427 /** Request structure for VbglR0SfHostReqCreateSymlink. */ 1428 typedef struct VBOXSFCREATESYMLINKREQ 1429 { 1430 VBGLIOCIDCHGCMFASTCALL Hdr; 1431 VMMDevHGCMCall Call; 1432 VBoxSFParmCreateSymlink Parms; 1433 HGCMPageListInfo PgLstTarget; 1434 SHFLFSOBJINFO ObjInfo; 1435 SHFLSTRING StrSymlinkPath; 1436 } VBOXSFCREATESYMLINKREQ; 1437 1438 /** 1439 * SHFL_FN_SYMLINK request. 1440 * 1441 * Caller fills in the symlink string and supplies a physical contiguous 1442 * target string 1443 */ 1444 DECLINLINE(int) VbglR0SfHostReqCreateSymlinkContig(SHFLROOT idRoot, PCSHFLSTRING pStrTarget, RTGCPHYS64 PhysTarget, 1445 VBOXSFCREATESYMLINKREQ *pReq) 1446 { 1447 uint32_t const cbTarget = SHFLSTRING_HEADER_SIZE + pStrTarget->u16Size; 1448 uint32_t const cbReq = g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS 1449 ? RT_UOFFSETOF(VBOXSFCREATESYMLINKREQ, StrSymlinkPath.String) + pReq->StrSymlinkPath.u16Size 1450 : RT_UOFFSETOF(VBOXSFCREATESYMLINKREQ, ObjInfo) /*simplified*/; 1451 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, 1452 SHFL_FN_SYMLINK, SHFL_CPARMS_SYMLINK, cbReq); 1453 1454 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit; 1455 pReq->Parms.id32Root.u.value32 = idRoot; 1456 1457 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS) 1458 { 1459 pReq->Parms.pStrSymlink.type = VMMDevHGCMParmType_Embedded; 1460 pReq->Parms.pStrSymlink.u.Embedded.cbData = SHFLSTRING_HEADER_SIZE + pReq->StrSymlinkPath.u16Size; 1461 pReq->Parms.pStrSymlink.u.Embedded.offData = RT_UOFFSETOF(VBOXSFCREATESYMLINKREQ, StrSymlinkPath) 1462 - sizeof(VBGLIOCIDCHGCMFASTCALL); 1463 pReq->Parms.pStrSymlink.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST; 1464 } 1465 else 1466 { 1467 pReq->Parms.pStrSymlink.type = VMMDevHGCMParmType_LinAddr_In; 1468 pReq->Parms.pStrSymlink.u.LinAddr.cb = SHFLSTRING_HEADER_SIZE + pReq->StrSymlinkPath.u16Size; 1469 pReq->Parms.pStrSymlink.u.LinAddr.uAddr = (uintptr_t)&pReq->StrSymlinkPath; 1470 } 1471 1472 if ( cbTarget <= PAGE_SIZE - (PhysTarget & PAGE_OFFSET_MASK) 1473 || (g_fHostFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)) 1474 { 1475 pReq->Parms.pStrTarget.type = cbTarget <= PAGE_SIZE - (PhysTarget & PAGE_OFFSET_MASK) 1476 ? VMMDevHGCMParmType_PageList 1477 : VMMDevHGCMParmType_ContiguousPageList; 1478 pReq->Parms.pStrTarget.u.PageList.size = cbTarget; 1479 pReq->Parms.pStrTarget.u.PageList.offset = RT_UOFFSETOF(VBOXSFCREATESYMLINKREQ, PgLstTarget) 1480 - sizeof(VBGLIOCIDCHGCMFASTCALL); 1481 pReq->PgLstTarget.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST; 1482 pReq->PgLstTarget.offFirstPage = (uint16_t)PhysTarget & (uint16_t)(PAGE_OFFSET_MASK); 1483 pReq->PgLstTarget.aPages[0] = PhysTarget & ~(RTGCPHYS64)PAGE_OFFSET_MASK; 1484 pReq->PgLstTarget.cPages = 1; 1485 } 1486 else 1487 { 1488 pReq->Parms.pStrTarget.type = VMMDevHGCMParmType_LinAddr_In; 1489 pReq->Parms.pStrTarget.u.LinAddr.cb = cbTarget; 1490 pReq->Parms.pStrTarget.u.LinAddr.uAddr = (uintptr_t)pStrTarget; 1491 } 1492 1493 if (g_fHostFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS) 1494 { 1495 pReq->Parms.pInfo.type = VMMDevHGCMParmType_Embedded; 1496 pReq->Parms.pInfo.u.Embedded.cbData = sizeof(pReq->ObjInfo); 1497 pReq->Parms.pInfo.u.Embedded.offData = RT_UOFFSETOF(VBOXSFCREATESYMLINKREQ, ObjInfo) 1498 - sizeof(VBGLIOCIDCHGCMFASTCALL); 1499 pReq->Parms.pInfo.u.Embedded.fFlags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 1500 } 1501 else 1502 { 1503 pReq->Parms.pInfo.type = VMMDevHGCMParmType_LinAddr_Out; 1504 pReq->Parms.pInfo.u.LinAddr.cb = sizeof(pReq->ObjInfo); 1505 pReq->Parms.pInfo.u.LinAddr.uAddr = (uintptr_t)&pReq->ObjInfo; 1506 } 1507 1508 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, cbReq); 1509 if (RT_SUCCESS(vrc)) 1510 vrc = pReq->Call.header.result; 1511 return vrc; 1512 } 1513 1320 1514 /** @} */ 1321 1515 -
trunk/include/VBox/shflsvc.h
r77854 r77858 119 119 /** Read symlink destination. 120 120 * @since VBox 4.0 */ 121 #define SHFL_FN_READLINK (18) 121 #define SHFL_FN_READLINK (18) /**< @todo rename to SHFL_FN_READ_LINK (see struct capitalization) */ 122 122 /** Create symlink. 123 123 * @since VBox 4.0 */ … … 1613 1613 */ 1614 1614 1615 /** SHFL_FN_READLINK parameters. */ 1616 typedef struct VBoxSFParmReadLink 1617 { 1618 /** value32, in: SHFLROOT of the mapping which the symlink is read. */ 1619 HGCMFunctionParameter id32Root; 1620 /** pointer, in: SHFLSTRING full path to the symlink. */ 1621 HGCMFunctionParameter pStrPath; 1622 /** pointer, out: Buffer to place the symlink target into. 1623 * @note Buffer contains UTF-8 characters on success, regardless of the 1624 * UTF-8/UTF-16 setting of the connection. Will be zero terminated. 1625 * 1626 * @todo r=bird: This should've been a string! 1627 * @todo r=bird: There should've been a byte count returned! */ 1628 HGCMFunctionParameter pBuffer; 1629 } VBoxSFParmReadLink; 1630 1615 1631 /** Parameters structure. */ 1616 1632 typedef struct _VBoxSFReadLink … … 1630 1646 /** pointer, out: 1631 1647 * Buffer to place data to. 1648 * @note Buffer contains UTF-8 characters on success, regardless of the 1649 * UTF-8/UTF-16 setting of the connection. Will be zero terminated. 1632 1650 */ 1633 1651 HGCMFunctionParameter buffer; … … 1817 1835 * @{ 1818 1836 */ 1837 1838 /** Parameters structure. */ 1839 typedef struct VBoxSFParmCreateSymlink 1840 { 1841 /** value32, in: SHFLROOT of the mapping the symlink should be created on. */ 1842 HGCMFunctionParameter id32Root; 1843 /** pointer, in: SHFLSTRING giving the path to the symlink. */ 1844 HGCMFunctionParameter pStrSymlink; 1845 /** pointer, in: SHFLSTRING giving the target. */ 1846 HGCMFunctionParameter pStrTarget; 1847 /** pointer, out: SHFLFSOBJINFO buffer to be filled with info about the created symlink. */ 1848 HGCMFunctionParameter pInfo; 1849 } VBoxSFParmCreateSymlink; 1819 1850 1820 1851 /** Parameters structure. */
Note:
See TracChangeset
for help on using the changeset viewer.