Changeset 77837 in vbox for trunk/src/VBox
- Timestamp:
- Mar 21, 2019 9:32:32 PM (6 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedFolders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/VBoxSharedFoldersSvc.cpp
r77276 r77837 97 97 static STAMPROFILE g_StatSetSymlinks; 98 98 static STAMPROFILE g_StatQueryMapInfo; 99 static STAMPROFILE g_StatQueryFeatures; 100 static STAMPROFILE g_StatCopyFilePart; 101 static STAMPROFILE g_StatCopyFilePartFail; 99 102 static STAMPROFILE g_StatWaitForMappingsChanges; 100 103 static STAMPROFILE g_StatWaitForMappingsChangesFail; … … 1484 1487 break; 1485 1488 } 1489 1490 case SHFL_FN_QUERY_FEATURES: 1491 { 1492 pStat = pStatFail = &g_StatQueryFeatures; 1493 1494 /* Validate input: */ 1495 ASSERT_GUEST_STMT_BREAK(cParms == SHFL_CPARMS_QUERY_FEATURES, rc = VERR_WRONG_PARAMETER_COUNT); 1496 ASSERT_GUEST_STMT_BREAK(paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* f64Features */ 1497 ASSERT_GUEST_STMT_BREAK(paParms[1].type == VBOX_HGCM_SVC_PARM_32BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* u32LastFunction */ 1498 1499 /* Execute the function: */ 1500 paParms[0].u.uint64 = SHFL_FEATURE_WRITE_UPDATES_OFFSET; 1501 paParms[1].u.uint32 = SHFL_FN_LAST; 1502 rc = VINF_SUCCESS; 1503 break; 1504 } 1505 1506 case SHFL_FN_COPY_FILE_PART: 1507 { 1508 pStat = &g_StatCopyFilePart; 1509 pStatFail = &g_StatCopyFilePartFail; 1510 1511 /* Validate input: */ 1512 ASSERT_GUEST_STMT_BREAK(cParms == SHFL_CPARMS_COPY_FILE_PART, rc = VERR_WRONG_PARAMETER_COUNT); 1513 ASSERT_GUEST_STMT_BREAK(paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* i32RootSrc */ 1514 ASSERT_GUEST_STMT_BREAK(paParms[1].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* u64HandleSrc */ 1515 ASSERT_GUEST_STMT_BREAK(paParms[2].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* off64Src */ 1516 ASSERT_GUEST_STMT_BREAK((int64_t)paParms[2].u.uint64 < 0, rc = VERR_NEGATIVE_SEEK); 1517 ASSERT_GUEST_STMT_BREAK(paParms[3].type == VBOX_HGCM_SVC_PARM_32BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* i32RootDst */ 1518 ASSERT_GUEST_STMT_BREAK(paParms[4].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* u64HandleDst */ 1519 ASSERT_GUEST_STMT_BREAK(paParms[5].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* off64Dst */ 1520 ASSERT_GUEST_STMT_BREAK((int64_t)paParms[5].u.uint64 < 0, rc = VERR_NEGATIVE_SEEK); 1521 ASSERT_GUEST_STMT_BREAK(paParms[6].type == VBOX_HGCM_SVC_PARM_64BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* cb64ToCopy */ 1522 ASSERT_GUEST_STMT_BREAK(paParms[6].u.uint64 < _1E, rc = VERR_OUT_OF_RANGE); 1523 ASSERT_GUEST_STMT_BREAK(paParms[7].type == VBOX_HGCM_SVC_PARM_32BIT, rc = VERR_WRONG_PARAMETER_TYPE); /* f32Flags */ 1524 ASSERT_GUEST_STMT_BREAK(paParms[7].u.uint32 == 0, rc = VERR_INVALID_FLAGS); 1525 1526 /* Execute the function: */ 1527 rc = vbsfCopyFilePart(pClient, 1528 paParms[0].u.uint32, paParms[1].u.uint64, paParms[2].u.uint64, 1529 paParms[3].u.uint32, paParms[4].u.uint64, paParms[5].u.uint64, 1530 &paParms[6].u.uint64, paParms[7].u.uint64); 1531 break; 1532 } 1533 1486 1534 1487 1535 default: … … 1792 1840 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatSetSymlinks, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_SET_SYMLINKS", "/HGCM/VBoxSharedFolders/FnSetSymlink"); 1793 1841 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatQueryMapInfo, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_QUERY_MAP_INFO", "/HGCM/VBoxSharedFolders/FnQueryMapInfo"); 1842 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatQueryFeatures, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_QUERY_FEATURES", "/HGCM/VBoxSharedFolders/FnQueryFeatures"); 1843 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatCopyFilePart, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_COPY_FILE_PART successes", "/HGCM/VBoxSharedFolders/FnCopyFilePart"); 1844 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatCopyFilePartFail, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_COPY_FILE_PART failures", "/HGCM/VBoxSharedFolders/FnCopyFilePartFail"); 1794 1845 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatWaitForMappingsChanges, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES successes", "/HGCM/VBoxSharedFolders/FnWaitForMappingsChanges"); 1795 1846 HGCMSvcHlpStamRegister(g_pHelpers, &g_StatWaitForMappingsChangesFail,STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS, "SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES failures","/HGCM/VBoxSharedFolders/FnWaitForMappingsChangesFail"); -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r77685 r77837 1368 1368 } 1369 1369 1370 /** Implements SHFL_FN_COPY_FILE_PART (wrapping RTFileCopyPart). */ 1371 int vbsfCopyFilePart(SHFLCLIENTDATA *pClient, SHFLROOT idRootSrc, SHFLHANDLE hFileSrc, uint64_t offSrc, 1372 SHFLROOT idRootDst, SHFLHANDLE hFileDst, uint64_t offDst, uint64_t *pcbToCopy, uint32_t fFlags) 1373 { 1374 /* 1375 * Validate and translates handles. 1376 */ 1377 uint64_t const cbToCopy = *pcbToCopy; 1378 *pcbToCopy = 0; 1379 LogFunc(("pClient %p, idRootSrc %#RX32, hFileSrc %#RX64, offSrc %#RX64, idRootSrc %#RX32, hFileSrc %#RX64, offSrc %#RX64, cbToCopy %#RX64, fFlags %#x\n", 1380 pClient, idRootSrc, hFileSrc, offSrc, idRootDst, hFileDst, offDst, cbToCopy, fFlags)); 1381 1382 AssertPtrReturn(pClient, VERR_INVALID_PARAMETER); 1383 1384 size_t cbTotal = 0; 1385 1386 SHFLFILEHANDLE *pHandleSrc = vbsfQueryFileHandle(pClient, hFileSrc); 1387 int rc = vbsfCheckHandleAccess(pClient, idRootSrc, pHandleSrc, VBSF_CHECK_ACCESS_READ); 1388 if (RT_SUCCESS(rc)) 1389 { 1390 SHFLFILEHANDLE *pHandleDst = vbsfQueryFileHandle(pClient, hFileDst); 1391 rc = vbsfCheckHandleAccess(pClient, idRootDst, pHandleDst, VBSF_CHECK_ACCESS_WRITE); 1392 if (RT_SUCCESS(rc)) 1393 { 1394 rc = RTFileCopyPart(pHandleSrc->file.Handle, offSrc, pHandleDst->file.Handle, offDst, cbToCopy, 0, &cbTotal); 1395 *pcbToCopy = cbTotal; 1396 } 1397 } 1398 1399 RT_NOREF(fFlags); 1400 LogFunc(("%Rrc bytes written %#zx\n", rc, cbTotal)); 1401 return rc; 1402 } 1370 1403 1371 1404 #ifdef UNITTEST -
trunk/src/VBox/HostServices/SharedFolders/vbsf.h
r77243 r77837 35 35 int vbsfWritePages(SHFLCLIENTDATA *pClient, SHFLROOT idRoot, SHFLHANDLE hFile, uint64_t *poffFile, 36 36 uint32_t *pcbBuffer, PVBOXHGCMSVCPARMPAGES pPages); 37 int vbsfCopyFilePart(SHFLCLIENTDATA *pClient, SHFLROOT idRootSrc, SHFLHANDLE hFileSrc, uint64_t offSrc, 38 SHFLROOT idRootDst, SHFLHANDLE hFileDst, uint64_t offDst, uint64_t *pcbToCopy, uint32_t fFlags); 37 39 38 40 int vbsfLock(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, uint64_t offset, uint64_t length, uint32_t flags);
Note:
See TracChangeset
for help on using the changeset viewer.