Changeset 33973 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Nov 11, 2010 11:10:10 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67635
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r33948 r33973 1084 1084 1085 1085 1086 RTDECL(int) RTVfsNew IoStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTSEMRW hSemRW,1086 RTDECL(int) RTVfsNewFsStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTSEMRW hSemRW, 1087 1087 PRTVFSFSSTREAM phVfsFss, void **ppvInstance) 1088 1088 { … … 1231 1231 1232 1232 RTVFSINTERNAL *pVfs = NULL; 1233 if (hVfs == NIL_RTVFS)1233 if (hVfs != NIL_RTVFS) 1234 1234 { 1235 1235 pVfs = hVfs; … … 1252 1252 pThis->Base.uMagic = RTVFSOBJ_MAGIC; 1253 1253 pThis->Base.pvThis = (char *)pThis + RT_ALIGN_Z(sizeof(*pThis), RTVFS_INST_ALIGNMENT); 1254 pThis->Base.pOps = &pIoStreamOps->Obj; 1254 1255 pThis->Base.hSemRW = hSemRW != NIL_RTSEMRW ? hSemRW : pVfs ? pVfs->Base.hSemRW : NIL_RTSEMRW; 1255 1256 pThis->Base.hVfs = hVfs; … … 1299 1300 1300 1301 1301 RTDECL(int) 1302 RTDECL(int) RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 1302 1303 { 1303 1304 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1308 1309 1309 1310 1310 RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, size_t *pcbRead)1311 RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead) 1311 1312 { 1312 1313 AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER); … … 1316 1317 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1317 1318 AssertReturn(pThis->uMagic == RTVFSIOSTREAM_MAGIC, VERR_INVALID_HANDLE); 1319 AssertReturn(fBlocking || pcbRead, VERR_INVALID_PARAMETER); 1318 1320 1319 1321 RTSGSEG Seg = { pvBuf, cbToRead }; … … 1322 1324 1323 1325 rtVfsObjWriteLock(&pThis->Base); 1324 int rc = pThis->pOps->pfnRead(pThis->Base.pvThis, -1 /*off*/, &SgBuf, pcbRead == NULL /*fBlocking*/, pcbRead);1326 int rc = pThis->pOps->pfnRead(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbRead); 1325 1327 rtVfsObjWriteUnlock(&pThis->Base); 1326 1328 return rc; … … 1328 1330 1329 1331 1330 RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)1332 RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, bool fBlocking, size_t *pcbWritten) 1331 1333 { 1332 1334 AssertPtrNullReturn(pcbWritten, VERR_INVALID_POINTER); … … 1336 1338 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1337 1339 AssertReturn(pThis->uMagic == RTVFSIOSTREAM_MAGIC, VERR_INVALID_HANDLE); 1340 AssertReturn(fBlocking || pcbWritten, VERR_INVALID_PARAMETER); 1338 1341 1339 1342 RTSGSEG Seg = { (void *)pvBuf, cbToWrite }; … … 1342 1345 1343 1346 rtVfsObjWriteLock(&pThis->Base); 1344 int rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, &SgBuf, pcbWritten == NULL /*fBlocking*/, pcbWritten);1347 int rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbWritten); 1345 1348 rtVfsObjWriteUnlock(&pThis->Base); 1346 1349 return rc; … … 1348 1351 1349 1352 1350 RTDECL(int) 1353 RTDECL(int) RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 1351 1354 { 1352 1355 AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER); … … 1366 1369 1367 1370 1368 RTDECL(int) 1371 RTDECL(int) RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 1369 1372 { 1370 1373 AssertPtrNullReturn(pcbWritten, VERR_INVALID_POINTER); … … 1384 1387 1385 1388 1386 RTDECL(int) 1389 RTDECL(int) RTVfsIoStrmFlush(RTVFSIOSTREAM hVfsIos) 1387 1390 { 1388 1391 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1397 1400 1398 1401 1399 RTDECL(RTFOFF) 1400 1402 RTDECL(RTFOFF) RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, 1403 uint32_t *pfRetEvents) 1401 1404 { 1402 1405 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1411 1414 1412 1415 1413 RTDECL(RTFOFF) 1416 RTDECL(RTFOFF) RTVfsIoStrmTell(RTVFSIOSTREAM hVfsIos) 1414 1417 { 1415 1418 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1427 1430 1428 1431 1429 RTDECL(int) 1432 RTDECL(int) RTVfsIoStrmSkip(RTVFSIOSTREAM hVfsIos, RTFOFF cb) 1430 1433 { 1431 1434 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1451 1454 size_t cbToRead = RT_MIN(cb, _64K); 1452 1455 rtVfsObjWriteLock(&pThis->Base); 1453 rc = RTVfsIoStrmRead(hVfsIos, pvBuf, cbToRead, NULL);1456 rc = RTVfsIoStrmRead(hVfsIos, pvBuf, cbToRead, true /*fBlocking*/, NULL); 1454 1457 rtVfsObjWriteUnlock(&pThis->Base); 1455 1458 if (RT_FAILURE(rc)) … … 1467 1470 1468 1471 1469 RTDECL(int) 1472 RTDECL(int) RTVfsIoStrmZeroFill(RTVFSIOSTREAM hVfsIos, RTFOFF cb) 1470 1473 { 1471 1474 RTVFSIOSTREAMINTERNAL *pThis = hVfsIos; … … 1490 1493 size_t cbToWrite = RT_MIN(cb, _64K); 1491 1494 rtVfsObjWriteLock(&pThis->Base); 1492 rc = RTVfsIoStrmWrite(hVfsIos, pvBuf, cbToWrite, NULL);1495 rc = RTVfsIoStrmWrite(hVfsIos, pvBuf, cbToWrite, true /*fBlocking*/, NULL); 1493 1496 rtVfsObjWriteUnlock(&pThis->Base); 1494 1497 if (RT_FAILURE(rc)) … … 1534 1537 1535 1538 RTVFSINTERNAL *pVfs = NULL; 1536 if (hVfs == NIL_RTVFS)1539 if (hVfs != NIL_RTVFS) 1537 1540 { 1538 1541 pVfs = hVfs; … … 1557 1560 pThis->Stream.pOps = &pFileOps->Stream; 1558 1561 pThis->Stream.Base.pvThis = (char *)pThis + RT_ALIGN_Z(sizeof(*pThis), RTVFS_INST_ALIGNMENT); 1562 pThis->Stream.Base.pOps = &pFileOps->Stream.Obj; 1559 1563 pThis->Stream.Base.hSemRW = pVfs ? pVfs->Base.hSemRW : NIL_RTSEMRW; 1560 1564 pThis->Stream.Base.hVfs = hVfs; -
trunk/src/VBox/Runtime/common/vfs/vfschain.cpp
r33950 r33973 431 431 } 432 432 433 434 433 /* 435 434 * Ok, there should be an element here so add one to the return struct. … … 440 439 pElement->enmAction = enmAction; 441 440 442 /* First comes a type which is followed by a '('. */ 441 /* 442 * First up is the VFS object type followed by a parentheses. 443 */ 443 444 if (strncmp(pszSrc, "base", cch = 4) == 0) 444 445 pElement->enmTypeOut = RTVFSOBJTYPE_BASE; … … 495 496 } 496 497 497 /* Must end with a right par antheses. */498 /* Must end with a right parentheses. */ 498 499 if (*pszSrc != ')') 499 500 { … … 657 658 658 659 660 RTDECL(bool) RTVfsChainIsSpec(const char *pszSpec) 661 { 662 return pszSpec 663 && strcmp(pszSpec, RTVFSCHAIN_SPEC_PREFIX) == 0; 664 } 665 -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r33903 r33973 446 446 } 447 447 448 449 RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos) 450 { 451 RTVFSFILE hVfsFile; 452 int rc = RTVfsFileFromRTFile(hFile, fOpen, fLeaveOpen, &hVfsFile); 453 if (RT_SUCCESS(rc)) 454 *phVfsIos = RTVfsFileToIoStream(hVfsFile); 455 return rc; 456 } 457 458 459 -
trunk/src/VBox/Runtime/common/zip/zipgzip.cpp
r33945 r33973 30 30 *******************************************************************************/ 31 31 #include "internal/iprt.h" 32 #include <iprt/ vfslowlevel.h>32 #include <iprt/zip.h> 33 33 34 34 #include <iprt/assert.h> … … 37 37 #include <iprt/poll.h> 38 38 #include <iprt/string.h> 39 #include <iprt/vfslowlevel.h> 40 39 41 #include <zlib.h> 40 42 … … 477 479 AssertPtrReturn(phVfsIosOut, VERR_INVALID_POINTER); 478 480 481 uint32_t cRefs = RTVfsIoStrmRetain(hVfsIosIn); 482 AssertReturn(cRefs != UINT32_MAX, VERR_INVALID_HANDLE); 483 479 484 /* 480 485 * Create the decompression I/O stream. … … 507 512 */ 508 513 size_t cbRead = 0; 509 rc = RTVfsIoStrmRead(pThis->hVfsIos, pThis->abBuffer, sizeof(RTZIPGZIPHDR), NULL /*pcbRead*/);514 rc = RTVfsIoStrmRead(pThis->hVfsIos, pThis->abBuffer, sizeof(RTZIPGZIPHDR), true /*fBlocking*/, NULL /*pcbRead*/); 510 515 if (RT_SUCCESS(rc)) 511 516 { … … 539 544 } 540 545 else 541 rc = rtZipGzipConvertErrFromZlib(pThis, rc); 546 rc = rtZipGzipConvertErrFromZlib(pThis, rc); /** @todo cleaning up in this situation is going to go wrong. */ 547 RTVfsIoStrmRelease(hVfsIos); 542 548 } 549 else 550 RTVfsIoStrmRelease(hVfsIosIn); 543 551 return rc; 544 552 }
Note:
See TracChangeset
for help on using the changeset viewer.