Changeset 48871 in vbox
- Timestamp:
- Oct 4, 2013 2:50:59 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
include/VBox/vd-ifs.h (modified) (2 diffs)
-
src/VBox/Storage/DMG.cpp (modified) (14 diffs)
-
src/VBox/Storage/VDIfVfs.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vd-ifs.h
r48854 r48871 630 630 * 631 631 * @return VBox status code. 632 * @param pVDIfs List of VD I/O interface we can use. 632 * @param pVDIfs Pointer to the VD I/O interface. If NULL, then @a 633 * pVDIfsInt must be specified. 634 * @param pVDIfsInt Pointer to the internal VD I/O interface. If NULL, 635 * then @ pVDIfs must be specified. 633 636 * @param pvStorage The storage argument to pass to the interface 634 637 * methods. … … 636 639 * @param phVfsFile Where to return the VFS file handle on success. 637 640 */ 638 VBOXDDU_DECL(int) VDIfCreateVfsFile(PVDINTERFACE pVDIfs, void *pvStorage, uint32_t fFlags, PRTVFSFILE phVfsFile);641 VBOXDDU_DECL(int) VDIfCreateVfsFile(PVDINTERFACEIO pVDIfs, struct VDINTERFACEIOINT *pVDIfsInt, void *pvStorage, uint32_t fFlags, PRTVFSFILE phVfsFile); 639 642 640 643 -
trunk/src/VBox/Storage/DMG.cpp
r48854 r48871 39 39 * Structures and Typedefs * 40 40 *******************************************************************************/ 41 #if 0 42 /** @def VBOX_WITH_DIRECT_XAR_ACCESS 43 * When defined, we will use RTVfs to access the XAR file instead of going 44 * the slightly longer way thru the VFS -> VD wrapper. */ 45 # define VBOX_WITH_DIRECT_XAR_ACCESS 46 #endif 41 47 42 48 /** Sector size, multiply with all sector counts to get number of bytes. */ … … 787 793 int rc = VINF_SUCCESS; 788 794 789 if ( pThis->pStorage 795 if ( pThis 796 && (pThis->pStorage || pThis->hDmgFileInXar != NIL_RTVFSFILE) 790 797 && !(pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY)) 791 798 { 792 /* @todo handle writable files, update checksums etc. */799 /** @todo handle writable files, update checksums etc. */ 793 800 } 794 801 … … 809 816 if (pThis) 810 817 { 818 RTVfsFileRelease(pThis->hDmgFileInXar); 819 pThis->hDmgFileInXar = NIL_RTVFSFILE; 820 821 RTVfsFsStrmRelease(pThis->hXarFss); 822 pThis->hXarFss = NIL_RTVFSFSSTREAM; 823 811 824 if (pThis->pStorage) 812 825 { 813 RTVfsFileRelease(pThis->hDmgFileInXar);814 pThis->hDmgFileInXar = NIL_RTVFSFILE;815 RTVfsFsStrmRelease(pThis->hXarFss);816 pThis->hXarFss = NIL_RTVFSFSSTREAM;817 818 826 /* No point updating the file that is deleted anyway. */ 819 827 if (!fDelete) … … 1444 1452 * @returns VBox status code. 1445 1453 * @param fOpen Flags for defining the open type. 1446 * @param pVDIf s List of VD I/O interfaces that we canuse.1454 * @param pVDIfIoInt The internal VD I/O interface to use. 1447 1455 * @param pvStorage The storage pointer that goes with @a pVDIfsIo. 1448 1456 * @param pszFilename The input filename, optional. … … 1455 1463 * is being in serveral places. 1456 1464 */ 1457 static int dmgOpenImageWithinXar(uint32_t fOpen, PVDINTERFACE pVDIfs, void *pvStorage, const char *pszFilename,1465 static int dmgOpenImageWithinXar(uint32_t fOpen, PVDINTERFACEIOINT pVDIfIoInt, void *pvStorage, const char *pszFilename, 1458 1466 PRTVFSFSSTREAM phXarFss, PRTVFSFILE phDmgFileInXar) 1459 1467 { … … 1462 1470 */ 1463 1471 RTVFSFILE hVfsFile; 1464 int rc = VDIfCreateVfsFile(pVDIfs, pvStorage, fOpen, &hVfsFile); 1472 #ifdef VBOX_WITH_DIRECT_XAR_ACCESS 1473 int rc = RTVfsFileOpenNormal(pszFilename, fOpen, &hVfsFile); 1474 #else 1475 int rc = VDIfCreateVfsFile(NULL, pVDIfIoInt, pvStorage, fOpen, &hVfsFile); 1476 #endif 1465 1477 if (RT_FAILURE(rc)) 1466 1478 return rc; … … 1566 1578 { 1567 1579 rc = dmgOpenImageWithinXar(VDOpenFlagsToFileOpenFlags(uOpenFlags, false /* fCreate */), 1568 pThis->p VDIfsImage,1580 pThis->pIfIoXxx, 1569 1581 pThis->pStorage, 1570 1582 pThis->pszFilename, … … 1572 1584 if (RT_FAILURE(rc)) 1573 1585 return rc; 1574 } 1586 #ifdef VBOX_WITH_DIRECT_XAR_ACCESS 1587 vdIfIoIntFileClose(pThis->pIfIoXxx, pThis->pStorage); 1588 pThis->pStorage = NULL; 1589 #endif 1590 } 1591 #if 0 /* This is for testing whether the VFS wrappers actually works. */ 1592 else 1593 { 1594 rc = RTVfsFileOpenNormal(pThis->pszFilename, VDOpenFlagsToFileOpenFlags(uOpenFlags, false /* fCreate */), 1595 &pThis->hDmgFileInXar); 1596 if (RT_FAILURE(rc)) 1597 return rc; 1598 vdIfIoIntFileClose(pThis->pIfIoXxx, pThis->pStorage); 1599 pThis->pStorage = NULL; 1600 } 1601 #endif 1575 1602 1576 1603 /* … … 1710 1737 { 1711 1738 rc = dmgOpenImageWithinXar(RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 1712 p VDIfsImage, pStorage, NULL /* pszFilename */,1739 pIfIo, pStorage, pszFilename, 1713 1740 &hXarFss, &hDmgFileInXar); 1714 1741 if (RT_FAILURE(rc)) … … 1737 1764 * Do we recognize this stuff? Does it look valid? 1738 1765 */ 1739 if ( Ftr.u32Magic == RT_H2BE_U32 (DMGUDIF_MAGIC)1740 && Ftr.u32Version == RT_H2BE_U32 (DMGUDIF_VER_CURRENT)1741 && Ftr.cbFooter == RT_H2BE_U32 (sizeof(Ftr)))1766 if ( Ftr.u32Magic == RT_H2BE_U32_C(DMGUDIF_MAGIC) 1767 && Ftr.u32Version == RT_H2BE_U32_C(DMGUDIF_VER_CURRENT) 1768 && Ftr.cbFooter == RT_H2BE_U32_C(sizeof(Ftr))) 1742 1769 { 1743 1770 dmgUdifFtrFile2HostEndian(&Ftr); … … 2009 2036 AssertPtr(pThis); 2010 2037 2011 if (pThis && pThis->pStorage)2038 if (pThis && (pThis->pStorage || pThis->hDmgFileInXar != NIL_RTVFSFILE)) 2012 2039 cb = 2048; 2013 2040 … … 2025 2052 AssertPtr(pThis); 2026 2053 2027 if (pThis && pThis->pStorage)2054 if (pThis && (pThis->pStorage || pThis->hDmgFileInXar != NIL_RTVFSFILE)) 2028 2055 cb = pThis->cbSize; 2029 2056 … … 2041 2068 AssertPtr(pThis); 2042 2069 2043 if (pThis && pThis->pStorage)2070 if (pThis && (pThis->pStorage || pThis->hDmgFileInXar != NIL_RTVFSFILE)) 2044 2071 { 2045 2072 uint64_t cbFile; … … 2436 2463 if (pThis) 2437 2464 { 2438 vdIfErrorMessage(pThis->pIfError, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u c bSector=%llu\n",2465 vdIfErrorMessage(pThis->pIfError, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cSectors=%llu\n", 2439 2466 pThis->PCHSGeometry.cCylinders, pThis->PCHSGeometry.cHeads, pThis->PCHSGeometry.cSectors, 2440 2467 pThis->LCHSGeometry.cCylinders, pThis->LCHSGeometry.cHeads, pThis->LCHSGeometry.cSectors, 2441 pThis->cbSize / 512);2468 pThis->cbSize / DMG_SECTOR_SIZE); 2442 2469 } 2443 2470 } -
trunk/src/VBox/Storage/VDIfVfs.cpp
r48854 r48871 386 386 387 387 388 VBOXDDU_DECL(int) VDIfCreateVfsFile(PVDINTERFACE pVDIfs, void *pvStorage, uint32_t fFlags, PRTVFSFILE phVfsFile)389 { 390 Assert PtrReturn(pVDIfs, VERR_INVALID_HANDLE);388 VBOXDDU_DECL(int) VDIfCreateVfsFile(PVDINTERFACEIO pVDIfs, struct VDINTERFACEIOINT *pVDIfsInt, void *pvStorage, uint32_t fFlags, PRTVFSFILE phVfsFile) 389 { 390 AssertReturn((pVDIfs != NULL) != (pVDIfsInt != NULL), VERR_INVALID_PARAMETER); /* Exactly one needs to be specified. */ 391 391 AssertPtrReturn(phVfsFile, VERR_INVALID_POINTER); 392 393 PVDINTERFACEIO pPreferred = VDIfIoGet(pVDIfs);394 PVDINTERFACEIOINT pAlternative = VDIfIoIntGet(pVDIfs);395 AssertReturn(pPreferred || pAlternative, VERR_INVALID_HANDLE);396 392 397 393 /* … … 404 400 if (RT_SUCCESS(rc)) 405 401 { 406 pThis->pVDIfsIo = p Preferred;407 pThis->pVDIfsIoInt = p Alternative;402 pThis->pVDIfsIo = pVDIfs; 403 pThis->pVDIfsIoInt = pVDIfsInt; 408 404 pThis->pStorage = (PVDIOSTORAGE)pvStorage; 409 405 pThis->offCurPos = 0;
Note:
See TracChangeset
for help on using the changeset viewer.

