Changeset 69955 in vbox
- Timestamp:
- Dec 6, 2017 12:26:37 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119457
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/vfslowlevel.h
r69942 r69955 327 327 * @param fMask The mask indicating which bits we are 328 328 * changing. 329 * @note Optional, failing with VERR_WRITE_PROTECT if NULL. 329 330 * @sa RTFileSetMode 330 331 */ … … 346 347 * @remarks See RTFileSetTimes for restrictions and behavior imposed by the 347 348 * host OS or underlying VFS provider. 349 * @note Optional, failing with VERR_WRITE_PROTECT if NULL. 348 350 * @sa RTFileSetTimes 349 351 */ … … 360 362 * @param gid The group ID of the new owner group. NIL_RTGID if 361 363 * unchanged. 364 * @note Optional, failing with VERR_WRITE_PROTECT if NULL. 362 365 * @sa RTFileSetOwner 363 366 */ … … 859 862 * written. This is set it 0 by the caller. If 860 863 * NULL, try write it all and fail if incomplete. 864 * @note Optional, failing with VERR_WRITE_PROTECT if NULL. 861 865 * @sa RTFileWrite, RTFileWriteAt. 862 866 */ -
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r69942 r69955 7250 7250 7251 7251 /** 7252 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}7253 */7254 static DECLCALLBACK(int) rtFsIsoMakerOutFile_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)7255 {7256 RT_NOREF(pvThis, off, pSgBuf, fBlocking, pcbWritten);7257 return VERR_WRITE_PROTECT;7258 }7259 7260 7261 /**7262 7252 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnFlush} 7263 7253 */ … … 7287 7277 RTFOFF offIgnored; 7288 7278 return rtFsIsoMakerOutFile_Seek(pvThis, cb, RTFILE_SEEK_CURRENT, &offIgnored); 7289 }7290 7291 7292 /**7293 * @interface_method_impl{RTVFSOBJSETOPS,pfnMode}7294 */7295 static DECLCALLBACK(int) rtFsIsoMakerOutFile_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask)7296 {7297 RT_NOREF(pvThis, fMode, fMask);7298 return VERR_WRITE_PROTECT;7299 }7300 7301 7302 /**7303 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetTimes}7304 */7305 static DECLCALLBACK(int) rtFsIsoMakerOutFile_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,7306 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)7307 {7308 RT_NOREF(pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime);7309 return VERR_WRITE_PROTECT;7310 }7311 7312 7313 /**7314 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetOwner}7315 */7316 static DECLCALLBACK(int) rtFsIsoMakerOutFile_SetOwner(void *pvThis, RTUID uid, RTGID gid)7317 {7318 RT_NOREF(pvThis, uid, gid);7319 return VERR_WRITE_PROTECT;7320 7279 } 7321 7280 … … 7402 7361 RTVFSIOSTREAMOPS_FEAT_NO_SG, 7403 7362 rtFsIsoMakerOutFile_Read, 7404 rtFsIsoMakerOutFile_Write,7363 NULL /*Write*/, 7405 7364 rtFsIsoMakerOutFile_Flush, 7406 7365 NULL /*PollOne*/, … … 7415 7374 RTVFSOBJSETOPS_VERSION, 7416 7375 RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet), 7417 rtFsIsoMakerOutFile_SetMode,7418 rtFsIsoMakerOutFile_SetTimes,7419 rtFsIsoMakerOutFile_SetOwner,7376 NULL /*SetMode*/, 7377 NULL /*SetTimes*/, 7378 NULL /*SetOwner*/, 7420 7379 RTVFSOBJSETOPS_VERSION 7421 7380 }, -
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r69924 r69955 2028 2028 2029 2029 /** 2030 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}2031 */2032 static DECLCALLBACK(int) rtFsIsoFile_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)2033 {2034 RT_NOREF(pvThis, off, pSgBuf, fBlocking, pcbWritten);2035 return VERR_WRITE_PROTECT;2036 }2037 2038 2039 /**2040 2030 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnFlush} 2041 2031 */ … … 2085 2075 *poffActual = pThis->offFile; 2086 2076 return VINF_SUCCESS; 2087 }2088 2089 2090 /**2091 * @interface_method_impl{RTVFSOBJSETOPS,pfnMode}2092 */2093 static DECLCALLBACK(int) rtFsIsoFile_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask)2094 {2095 RT_NOREF(pvThis, fMode, fMask);2096 return VERR_WRITE_PROTECT;2097 }2098 2099 2100 /**2101 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetTimes}2102 */2103 static DECLCALLBACK(int) rtFsIsoFile_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,2104 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)2105 {2106 RT_NOREF(pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime);2107 return VERR_WRITE_PROTECT;2108 }2109 2110 2111 /**2112 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetOwner}2113 */2114 static DECLCALLBACK(int) rtFsIsoFile_SetOwner(void *pvThis, RTUID uid, RTGID gid)2115 {2116 RT_NOREF(pvThis, uid, gid);2117 return VERR_WRITE_PROTECT;2118 2077 } 2119 2078 … … 2182 2141 RTVFSIOSTREAMOPS_FEAT_NO_SG, 2183 2142 rtFsIsoFile_Read, 2184 rtFsIsoFile_Write,2143 NULL /*Write*/, 2185 2144 rtFsIsoFile_Flush, 2186 2145 rtFsIsoFile_PollOne, … … 2195 2154 RTVFSOBJSETOPS_VERSION, 2196 2155 RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet), 2197 rtFsIsoFile_SetMode,2198 rtFsIsoFile_SetTimes,2199 rtFsIsoFile_SetOwner,2156 NULL /*SetMode*/, 2157 NULL /*SetTimes*/, 2158 NULL /*SetOwner*/, 2200 2159 RTVFSOBJSETOPS_VERSION 2201 2160 }, … … 2856 2815 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 2857 2816 return rtFsIsoCore_QueryInfo(&pThis->pShared->Core, pObjInfo, enmAddAttr); 2858 }2859 2860 2861 /**2862 * @interface_method_impl{RTVFSOBJSETOPS,pfnMode}2863 */2864 static DECLCALLBACK(int) rtFsIsoDir_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask)2865 {2866 RT_NOREF(pvThis, fMode, fMask);2867 return VERR_WRITE_PROTECT;2868 }2869 2870 2871 /**2872 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetTimes}2873 */2874 static DECLCALLBACK(int) rtFsIsoDir_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,2875 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)2876 {2877 RT_NOREF(pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime);2878 return VERR_WRITE_PROTECT;2879 }2880 2881 2882 /**2883 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetOwner}2884 */2885 static DECLCALLBACK(int) rtFsIsoDir_SetOwner(void *pvThis, RTUID uid, RTGID gid)2886 {2887 RT_NOREF(pvThis, uid, gid);2888 return VERR_WRITE_PROTECT;2889 2817 } 2890 2818 … … 3501 3429 RTVFSOBJSETOPS_VERSION, 3502 3430 RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet), 3503 rtFsIsoDir_SetMode,3504 rtFsIsoDir_SetTimes,3505 rtFsIsoDir_SetOwner,3431 NULL /*SetMode*/, 3432 NULL /*SetTimes*/, 3433 NULL /*SetOwner*/, 3506 3434 RTVFSOBJSETOPS_VERSION 3507 3435 }, -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r69942 r69955 81 81 Assert((a_pSetOps)->uVersion == RTVFSOBJSETOPS_VERSION); \ 82 82 Assert((a_pSetOps)->offObjOps == (a_offObjOps)); \ 83 AssertPtr ((a_pSetOps)->pfnSetMode); \84 AssertPtr ((a_pSetOps)->pfnSetTimes); \85 AssertPtr ((a_pSetOps)->pfnSetOwner); \83 AssertPtrNull((a_pSetOps)->pfnSetMode); \ 84 AssertPtrNull((a_pSetOps)->pfnSetTimes); \ 85 AssertPtrNull((a_pSetOps)->pfnSetOwner); \ 86 86 Assert((a_pSetOps)->uEndMarker == RTVFSOBJSETOPS_VERSION); \ 87 87 } while (0) … … 113 113 Assert(!((pIoStreamOps)->fFeatures & ~RTVFSIOSTREAMOPS_FEAT_VALID_MASK)); \ 114 114 AssertPtr((pIoStreamOps)->pfnRead); \ 115 AssertPtr ((pIoStreamOps)->pfnWrite); \115 AssertPtrNull((pIoStreamOps)->pfnWrite); \ 116 116 AssertPtr((pIoStreamOps)->pfnFlush); \ 117 117 AssertPtrNull((pIoStreamOps)->pfnPollOne); \ … … 126 126 do { \ 127 127 RTVFSOBJ_ASSERT_OPS(&(pSymlinkOps)->Obj, a_enmType); \ 128 RTVFSOBJSET_ASSERT_OPS(&(pSymlinkOps)->ObjSet, \ 129 RT_OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet)); \ 128 RTVFSOBJSET_ASSERT_OPS(&(pSymlinkOps)->ObjSet, RT_OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet)); \ 130 129 Assert((pSymlinkOps)->uVersion == RTVFSSYMLINKOPS_VERSION); \ 131 130 Assert(!(pSymlinkOps)->fReserved); \ … … 1317 1316 AssertReturn(pObjSetOps, VERR_INVALID_FUNCTION); 1318 1317 1319 RTVfsLockAcquireWrite(pThis->hLock); 1320 int rc = pObjSetOps->pfnSetMode(pThis->pvThis, fMode, fMask); 1321 RTVfsLockReleaseWrite(pThis->hLock); 1318 int rc; 1319 if (pObjSetOps->pfnSetMode) 1320 { 1321 RTVfsLockAcquireWrite(pThis->hLock); 1322 rc = pObjSetOps->pfnSetMode(pThis->pvThis, fMode, fMask); 1323 RTVfsLockReleaseWrite(pThis->hLock); 1324 } 1325 else 1326 rc = VERR_WRITE_PROTECT; 1322 1327 return rc; 1323 1328 } … … 1339 1344 AssertReturn(pObjSetOps, VERR_INVALID_FUNCTION); 1340 1345 1341 RTVfsLockAcquireWrite(pThis->hLock); 1342 int rc = pObjSetOps->pfnSetTimes(pThis->pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime); 1343 RTVfsLockReleaseWrite(pThis->hLock); 1346 int rc; 1347 if (pObjSetOps->pfnSetTimes) 1348 { 1349 RTVfsLockAcquireWrite(pThis->hLock); 1350 rc = pObjSetOps->pfnSetTimes(pThis->pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime); 1351 RTVfsLockReleaseWrite(pThis->hLock); 1352 } 1353 else 1354 rc = VERR_WRITE_PROTECT; 1344 1355 return rc; 1345 1356 } … … 1355 1366 AssertReturn(pObjSetOps, VERR_INVALID_FUNCTION); 1356 1367 1357 RTVfsLockAcquireWrite(pThis->hLock); 1358 int rc = pObjSetOps->pfnSetOwner(pThis->pvThis, uid, gid); 1359 RTVfsLockReleaseWrite(pThis->hLock); 1368 int rc; 1369 if (pObjSetOps->pfnSetOwner) 1370 { 1371 RTVfsLockAcquireWrite(pThis->hLock); 1372 rc = pObjSetOps->pfnSetOwner(pThis->pvThis, uid, gid); 1373 RTVfsLockReleaseWrite(pThis->hLock); 1374 } 1375 else 1376 rc = VERR_WRITE_PROTECT; 1360 1377 return rc; 1361 1378 } … … 3499 3516 AssertReturn(pThis->fFlags & RTFILE_O_WRITE, VERR_ACCESS_DENIED); 3500 3517 3501 RTSGSEG Seg = { (void *)pvBuf, cbToWrite }; 3502 RTSGBUF SgBuf; 3503 RTSgBufInit(&SgBuf, &Seg, 1); 3504 3505 RTVfsLockAcquireWrite(pThis->Base.hLock); 3506 int rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbWritten); 3507 RTVfsLockReleaseWrite(pThis->Base.hLock); 3518 int rc; 3519 if (pThis->pOps->pfnWrite) 3520 { 3521 RTSGSEG Seg = { (void *)pvBuf, cbToWrite }; 3522 RTSGBUF SgBuf; 3523 RTSgBufInit(&SgBuf, &Seg, 1); 3524 3525 RTVfsLockAcquireWrite(pThis->Base.hLock); 3526 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbWritten); 3527 RTVfsLockReleaseWrite(pThis->Base.hLock); 3528 } 3529 else 3530 rc = VERR_WRITE_PROTECT; 3508 3531 return rc; 3509 3532 } … … 3522 3545 AssertReturn(pThis->fFlags & RTFILE_O_WRITE, VERR_ACCESS_DENIED); 3523 3546 3524 RTSGSEG Seg = { (void *)pvBuf, cbToWrite }; 3525 RTSGBUF SgBuf; 3526 RTSgBufInit(&SgBuf, &Seg, 1); 3527 3528 RTVfsLockAcquireWrite(pThis->Base.hLock); 3529 int rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbWritten); 3530 RTVfsLockReleaseWrite(pThis->Base.hLock); 3547 int rc; 3548 if (pThis->pOps->pfnWrite) 3549 { 3550 RTSGSEG Seg = { (void *)pvBuf, cbToWrite }; 3551 RTSGBUF SgBuf; 3552 RTSgBufInit(&SgBuf, &Seg, 1); 3553 3554 RTVfsLockAcquireWrite(pThis->Base.hLock); 3555 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbWritten); 3556 RTVfsLockReleaseWrite(pThis->Base.hLock); 3557 } 3558 else 3559 rc = VERR_WRITE_PROTECT; 3531 3560 return rc; 3532 3561 } … … 3590 3619 AssertReturn(pThis->fFlags & RTFILE_O_WRITE, VERR_ACCESS_DENIED); 3591 3620 3592 RTVfsLockAcquireWrite(pThis->Base.hLock);3593 3621 int rc; 3594 if (!(pThis->pOps->fFeatures & RTVFSIOSTREAMOPS_FEAT_NO_SG)) 3595 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, pSgBuf, fBlocking, pcbWritten); 3622 if (pThis->pOps->pfnWrite) 3623 { 3624 RTVfsLockAcquireWrite(pThis->Base.hLock); 3625 if (!(pThis->pOps->fFeatures & RTVFSIOSTREAMOPS_FEAT_NO_SG)) 3626 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, pSgBuf, fBlocking, pcbWritten); 3627 else 3628 { 3629 size_t cbWritten = 0; 3630 rc = VINF_SUCCESS; 3631 3632 for (uint32_t iSeg = 0; iSeg < pSgBuf->cSegs; iSeg++) 3633 { 3634 RTSGBUF SgBuf; 3635 RTSgBufInit(&SgBuf, &pSgBuf->paSegs[iSeg], 1); 3636 3637 size_t cbWrittenSeg = 0; 3638 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbWritten ? &cbWrittenSeg : NULL); 3639 if (RT_FAILURE(rc)) 3640 break; 3641 if (pcbWritten) 3642 { 3643 cbWritten += cbWrittenSeg; 3644 if (cbWrittenSeg != SgBuf.paSegs[0].cbSeg) 3645 break; 3646 if (off != -1) 3647 off += cbWrittenSeg; 3648 } 3649 else if (off != -1) 3650 off += pSgBuf->paSegs[iSeg].cbSeg; 3651 } 3652 3653 if (pcbWritten) 3654 *pcbWritten = cbWritten; 3655 } 3656 RTVfsLockReleaseWrite(pThis->Base.hLock); 3657 } 3596 3658 else 3597 { 3598 size_t cbWritten = 0; 3599 rc = VINF_SUCCESS; 3600 3601 for (uint32_t iSeg = 0; iSeg < pSgBuf->cSegs; iSeg++) 3602 { 3603 RTSGBUF SgBuf; 3604 RTSgBufInit(&SgBuf, &pSgBuf->paSegs[iSeg], 1); 3605 3606 size_t cbWrittenSeg = 0; 3607 rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbWritten ? &cbWrittenSeg : NULL); 3608 if (RT_FAILURE(rc)) 3609 break; 3610 if (pcbWritten) 3611 { 3612 cbWritten += cbWrittenSeg; 3613 if (cbWrittenSeg != SgBuf.paSegs[0].cbSeg) 3614 break; 3615 if (off != -1) 3616 off += cbWrittenSeg; 3617 } 3618 else if (off != -1) 3619 off += pSgBuf->paSegs[iSeg].cbSeg; 3620 } 3621 3622 if (pcbWritten) 3623 *pcbWritten = cbWritten; 3624 } 3625 RTVfsLockReleaseWrite(pThis->Base.hLock); 3659 rc = VERR_WRITE_PROTECT; 3626 3660 return rc; 3627 3661 }
Note:
See TracChangeset
for help on using the changeset viewer.