Changeset 68694 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Sep 7, 2017 2:51:09 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r68510 r68694 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - ISO 9660 Virtual Filesystem.3 * IPRT - ISO 9660 and UDF Virtual Filesystem (read only). 4 4 */ 5 5 … … 53 53 * Structures and Typedefs * 54 54 *********************************************************************************************************************************/ 55 /** Pointer to an ISO 9660volume (VFS instance data). */56 typedef struct RTFSISO 9660VOL *PRTFSISO9660VOL;57 /** Pointer to a const ISO 9660volume (VFS instance data). */58 typedef struct RTFSISO 9660VOL const *PCRTFSISO9660VOL;59 60 /** Pointer to a ISO 9660directory instance. */61 typedef struct RTFSISO 9660DIRSHRD *PRTFSISO9660DIRSHRD;62 63 64 65 /** 66 * ISO 9660extent (internal to the VFS not a disk structure).67 */ 68 typedef struct RTFSISO 9660EXTENT55 /** Pointer to an ISO volume (VFS instance data). */ 56 typedef struct RTFSISOVOL *PRTFSISOVOL; 57 /** Pointer to a const ISO volume (VFS instance data). */ 58 typedef struct RTFSISOVOL const *PCRTFSISOVOL; 59 60 /** Pointer to a ISO directory instance. */ 61 typedef struct RTFSISODIRSHRD *PRTFSISODIRSHRD; 62 63 64 65 /** 66 * ISO extent (internal to the VFS not a disk structure). 67 */ 68 typedef struct RTFSISOEXTENT 69 69 { 70 70 /** The disk offset. */ … … 72 72 /** The size of the extent in bytes. */ 73 73 uint64_t cbExtent; 74 } RTFSISO 9660EXTENT;74 } RTFSISOEXTENT; 75 75 /** Pointer to an ISO 9660 extent. */ 76 typedef RTFSISO 9660EXTENT *PRTFSISO9660EXTENT;76 typedef RTFSISOEXTENT *PRTFSISOEXTENT; 77 77 /** Pointer to a const ISO 9660 extent. */ 78 typedef RTFSISO 9660EXTENT const *PCRTFSISO9660EXTENT;79 80 81 /** 82 * ISO 9660file system object, shared part.83 */ 84 typedef struct RTFSISO 9660CORE85 { 86 /** The parent directory keeps a list of open objects (RTFSISO 9660CORE). */78 typedef RTFSISOEXTENT const *PCRTFSISOEXTENT; 79 80 81 /** 82 * ISO file system object, shared part. 83 */ 84 typedef struct RTFSISOCORE 85 { 86 /** The parent directory keeps a list of open objects (RTFSISOCORE). */ 87 87 RTLISTNODE Entry; 88 88 /** Reference counter. */ 89 89 uint32_t volatile cRefs; 90 90 /** The parent directory (not released till all children are close). */ 91 PRTFSISO 9660DIRSHRDpParentDir;91 PRTFSISODIRSHRD pParentDir; 92 92 /** The byte offset of the first directory record. */ 93 93 uint64_t offDirRec; … … 105 105 RTTIMESPEC BirthTime; 106 106 /** Pointer to the volume. */ 107 PRTFSISO 9660VOLpVol;107 PRTFSISOVOL pVol; 108 108 /** The version number. */ 109 109 uint32_t uVersion; … … 111 111 uint32_t cExtents; 112 112 /** The first extent. */ 113 RTFSISO 9660EXTENTFirstExtent;113 RTFSISOEXTENT FirstExtent; 114 114 /** Array of additional extents. */ 115 PRTFSISO 9660EXTENTpaExtents;116 } RTFSISO 9660CORE;117 typedef RTFSISO 9660CORE *PRTFSISO9660CORE;118 119 /** 120 * ISO 9660file, shared data.121 */ 122 typedef struct RTFSISO 9660FILESHRD115 PRTFSISOEXTENT paExtents; 116 } RTFSISOCORE; 117 typedef RTFSISOCORE *PRTFSISOCORE; 118 119 /** 120 * ISO file, shared data. 121 */ 122 typedef struct RTFSISOFILESHRD 123 123 { 124 124 /** Core ISO9660 object info. */ 125 RTFSISO 9660CORECore;126 } RTFSISO 9660FILESHRD;125 RTFSISOCORE Core; 126 } RTFSISOFILESHRD; 127 127 /** Pointer to a ISO 9660 file object. */ 128 typedef RTFSISO 9660FILESHRD *PRTFSISO9660FILESHRD;129 130 131 /** 132 * ISO 9660directory, shared data.128 typedef RTFSISOFILESHRD *PRTFSISOFILESHRD; 129 130 131 /** 132 * ISO directory, shared data. 133 133 * 134 134 * We will always read in the whole directory just to keep things really simple. 135 135 */ 136 typedef struct RTFSISO 9660DIRSHRD136 typedef struct RTFSISODIRSHRD 137 137 { 138 138 /** Core ISO 9660 object info. */ 139 RTFSISO 9660CORECore;140 /** Open child objects (RTFSISO 9660CORE). */139 RTFSISOCORE Core; 140 /** Open child objects (RTFSISOCORE). */ 141 141 RTLISTNODE OpenChildren; 142 142 … … 145 145 /** The size of the directory content (duplicate of Core.cbObject). */ 146 146 uint32_t cbDir; 147 } RTFSISO 9660DIRSHRD;148 /** Pointer to a ISO 9660directory instance. */149 typedef RTFSISO 9660DIRSHRD *PRTFSISO9660DIRSHRD;147 } RTFSISODIRSHRD; 148 /** Pointer to a ISO directory instance. */ 149 typedef RTFSISODIRSHRD *PRTFSISODIRSHRD; 150 150 151 151 … … 153 153 * Private data for a VFS file object. 154 154 */ 155 typedef struct RTFSISO 9660FILEOBJ155 typedef struct RTFSISOFILEOBJ 156 156 { 157 157 /** Pointer to the shared data. */ 158 PRTFSISO 9660FILESHRD pShared;158 PRTFSISOFILESHRD pShared; 159 159 /** The current file offset. */ 160 uint64_t 161 } RTFSISO 9660FILEOBJ;162 typedef RTFSISO 9660FILEOBJ *PRTFSISO9660FILEOBJ;160 uint64_t offFile; 161 } RTFSISOFILEOBJ; 162 typedef RTFSISOFILEOBJ *PRTFSISOFILEOBJ; 163 163 164 164 /** 165 165 * Private data for a VFS directory object. 166 166 */ 167 typedef struct RTFSISO 9660DIROBJ167 typedef struct RTFSISODIROBJ 168 168 { 169 169 /** Pointer to the shared data. */ 170 PRTFSISO 9660DIRSHRD pShared;170 PRTFSISODIRSHRD pShared; 171 171 /** The current directory offset. */ 172 uint32_t 173 } RTFSISO 9660DIROBJ;174 typedef RTFSISO 9660DIROBJ *PRTFSISO9660DIROBJ;175 176 177 /** 178 * A ISO 9660volume.179 */ 180 typedef struct RTFSISO 9660VOL172 uint32_t offDir; 173 } RTFSISODIROBJ; 174 typedef RTFSISODIROBJ *PRTFSISODIROBJ; 175 176 177 /** 178 * A ISO volume. 179 */ 180 typedef struct RTFSISOVOL 181 181 { 182 182 /** Handle to itself. */ 183 RTVFS 183 RTVFS hVfsSelf; 184 184 /** The file, partition, or whatever backing the ISO 9660 volume. */ 185 RTVFSFILE 185 RTVFSFILE hVfsBacking; 186 186 /** The size of the backing thingy. */ 187 uint64_t cbBacking; 187 uint64_t cbBacking; 188 /** The size of the backing thingy in sectors (cbSector). */ 189 uint64_t cBackingSectors; 188 190 /** Flags. */ 189 uint32_t 191 uint32_t fFlags; 190 192 /** The sector size (in bytes). */ 191 uint32_t 193 uint32_t cbSector; 192 194 193 195 /** @name ISO 9660 specific data 194 196 * @{ */ 195 197 /** The size of a logical block in bytes. */ 196 uint32_t 198 uint32_t cbBlock; 197 199 /** The primary volume space size in blocks. */ 198 uint32_t 200 uint32_t cBlocksInPrimaryVolumeSpace; 199 201 /** The primary volume space size in bytes. */ 200 uint64_t 202 uint64_t cbPrimaryVolumeSpace; 201 203 /** The number of volumes in the set. */ 202 uint32_t 204 uint32_t cVolumesInSet; 203 205 /** The primary volume sequence ID. */ 204 uint32_t 206 uint32_t idPrimaryVol; 205 207 /** Set if using UTF16-2 (joliet). */ 206 bool 208 bool fIsUtf16; 207 209 /** @} */ 208 210 211 /** @name UDF specific data. 212 * @{ */ 213 /** Offset of the Anchor volume descriptor sequence. */ 214 uint64_t offAvdp; 215 /** Length of the anchor volume descriptor sequence. */ 216 uint32_t cbAvdp; 217 /** @} */ 218 209 219 /** The root directory shared data. */ 210 PRTFSISO 9660DIRSHRD pRootDir;211 } RTFSISO 9660VOL;220 PRTFSISODIRSHRD pRootDir; 221 } RTFSISOVOL; 212 222 213 223 … … 221 231 * Internal Functions * 222 232 *********************************************************************************************************************************/ 223 static void rtFsIso 9660DirShrd_AddOpenChild(PRTFSISO9660DIRSHRD pDir, PRTFSISO9660CORE pChild);224 static void rtFsIso 9660DirShrd_RemoveOpenChild(PRTFSISO9660DIRSHRD pDir, PRTFSISO9660CORE pChild);225 static int rtFsIso 9660Dir_New(PRTFSISO9660VOL pThis, PRTFSISO9660DIRSHRD pParentDir, PCISO9660DIRREC pDirRec,226 227 static PRTFSISO 9660CORE rtFsIso9660Dir_LookupShared(PRTFSISO9660DIRSHRD pThis, uint64_t offDirRec);233 static void rtFsIsoDirShrd_AddOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild); 234 static void rtFsIsoDirShrd_RemoveOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild); 235 static int rtFsIsoDir_New9660(PRTFSISOVOL pThis, PRTFSISODIRSHRD pParentDir, PCISO9660DIRREC pDirRec, 236 uint32_t cDirRecs, uint64_t offDirRec, PRTVFSDIR phVfsDir); 237 static PRTFSISOCORE rtFsIsoDir_LookupShared(PRTFSISODIRSHRD pThis, uint64_t offDirRec); 228 238 229 239 … … 417 427 418 428 /** 419 * Initialization of a RTFSISO 9660CORE structure from a directory record.420 * 421 * @note The RTFSISO 9660CORE::pParentDir and RTFSISO9660CORE::Clusters members are429 * Initialization of a RTFSISOCORE structure from a directory record. 430 * 431 * @note The RTFSISOCORE::pParentDir and RTFSISOCORE::Clusters members are 422 432 * properly initialized elsewhere. 423 433 * … … 431 441 * @param pVol The volume. 432 442 */ 433 static int rtFsIso 9660Core_InitFromDirRec(PRTFSISO9660CORE pCore, PCISO9660DIRREC pDirRec, uint32_t cDirRecs,434 uint64_t offDirRec, uint32_t uVersion, PRTFSISO 9660VOL pVol)443 static int rtFsIsoCore_InitFrom9660DirRec(PRTFSISOCORE pCore, PCISO9660DIRREC pDirRec, uint32_t cDirRecs, 444 uint64_t offDirRec, uint32_t uVersion, PRTFSISOVOL pVol) 435 445 { 436 446 RTListInit(&pCore->Entry); … … 462 472 else 463 473 { 464 PRTFSISO 9660EXTENT pCurExtent = &pCore->FirstExtent;474 PRTFSISOEXTENT pCurExtent = &pCore->FirstExtent; 465 475 while (cDirRecs > 1) 466 476 { … … 479 489 void *pvNew = RTMemRealloc(pCore->paExtents, pCore->cExtents * sizeof(pCore->paExtents[0])); 480 490 if (pvNew) 481 pCore->paExtents = (PRTFSISO 9660EXTENT)pvNew;491 pCore->paExtents = (PRTFSISOEXTENT)pvNew; 482 492 else 483 493 { … … 505 515 506 516 /** 507 * Worker for rtFsIso 9660File_QueryInfo and rtFsIso9660Dir_QueryInfo.508 */ 509 static int rtFsIso 9660Core_QueryInfo(PRTFSISO9660CORE pCore, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr)517 * Worker for rtFsIsoFile_QueryInfo and rtFsIsoDir_QueryInfo. 518 */ 519 static int rtFsIsoCore_QueryInfo(PRTFSISOCORE pCore, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 510 520 { 511 521 pObjInfo->cbObject = pCore->cbObject; … … 550 560 551 561 /** 552 * Worker for rtFsIso 9660File_Close and rtFsIso9660Dir_Close that does common work.562 * Worker for rtFsIsoFile_Close and rtFsIsoDir_Close that does common work. 553 563 * 554 564 * @param pCore The common shared structure. 555 565 */ 556 static void rtFsIso 9660Core_Destroy(PRTFSISO9660CORE pCore)566 static void rtFsIsoCore_Destroy(PRTFSISOCORE pCore) 557 567 { 558 568 if (pCore->pParentDir) 559 rtFsIso 9660DirShrd_RemoveOpenChild(pCore->pParentDir, pCore);569 rtFsIsoDirShrd_RemoveOpenChild(pCore->pParentDir, pCore); 560 570 if (pCore->paExtents) 561 571 { … … 569 579 * @interface_method_impl{RTVFSOBJOPS,pfnClose} 570 580 */ 571 static DECLCALLBACK(int) rtFsIso 9660File_Close(void *pvThis)572 { 573 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;574 LogFlow(("rtFsIso 9660File_Close(%p/%p)\n", pThis, pThis->pShared));575 576 PRTFSISO 9660FILESHRD pShared = pThis->pShared;581 static DECLCALLBACK(int) rtFsIsoFile_Close(void *pvThis) 582 { 583 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 584 LogFlow(("rtFsIsoFile_Close(%p/%p)\n", pThis, pThis->pShared)); 585 586 PRTFSISOFILESHRD pShared = pThis->pShared; 577 587 pThis->pShared = NULL; 578 588 if (pShared) … … 580 590 if (ASMAtomicDecU32(&pShared->Core.cRefs) == 0) 581 591 { 582 LogFlow(("rtFsIso 9660File_Close: Destroying shared structure %p\n", pShared));583 rtFsIso 9660Core_Destroy(&pShared->Core);592 LogFlow(("rtFsIsoFile_Close: Destroying shared structure %p\n", pShared)); 593 rtFsIsoCore_Destroy(&pShared->Core); 584 594 RTMemFree(pShared); 585 595 } … … 592 602 * @interface_method_impl{RTVFSOBJOPS,pfnQueryInfo} 593 603 */ 594 static DECLCALLBACK(int) rtFsIso 9660File_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr)595 { 596 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;597 return rtFsIso 9660Core_QueryInfo(&pThis->pShared->Core, pObjInfo, enmAddAttr);604 static DECLCALLBACK(int) rtFsIsoFile_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 605 { 606 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 607 return rtFsIsoCore_QueryInfo(&pThis->pShared->Core, pObjInfo, enmAddAttr); 598 608 } 599 609 … … 602 612 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 603 613 */ 604 static DECLCALLBACK(int) rtFsIso 9660File_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)605 { 606 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;607 PRTFSISO 9660FILESHRD pShared = pThis->pShared;614 static DECLCALLBACK(int) rtFsIsoFile_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 615 { 616 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 617 PRTFSISOFILESHRD pShared = pThis->pShared; 608 618 AssertReturn(pSgBuf->cSegs != 0, VERR_INTERNAL_ERROR_3); 609 619 RT_NOREF(fBlocking); … … 670 680 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 671 681 */ 672 static DECLCALLBACK(int) rtFsIso 9660File_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)682 static DECLCALLBACK(int) rtFsIsoFile_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 673 683 { 674 684 RT_NOREF(pvThis, off, pSgBuf, fBlocking, pcbWritten); … … 680 690 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnFlush} 681 691 */ 682 static DECLCALLBACK(int) rtFsIso 9660File_Flush(void *pvThis)692 static DECLCALLBACK(int) rtFsIsoFile_Flush(void *pvThis) 683 693 { 684 694 RT_NOREF(pvThis); … … 690 700 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnPollOne} 691 701 */ 692 static DECLCALLBACK(int) rtFsIso 9660File_PollOne(void *pvThis, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,702 static DECLCALLBACK(int) rtFsIsoFile_PollOne(void *pvThis, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, 693 703 uint32_t *pfRetEvents) 694 704 { … … 720 730 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnTell} 721 731 */ 722 static DECLCALLBACK(int) rtFsIso 9660File_Tell(void *pvThis, PRTFOFF poffActual)723 { 724 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;732 static DECLCALLBACK(int) rtFsIsoFile_Tell(void *pvThis, PRTFOFF poffActual) 733 { 734 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 725 735 *poffActual = pThis->offFile; 726 736 return VINF_SUCCESS; … … 731 741 * @interface_method_impl{RTVFSOBJSETOPS,pfnMode} 732 742 */ 733 static DECLCALLBACK(int) rtFsIso 9660File_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask)743 static DECLCALLBACK(int) rtFsIsoFile_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask) 734 744 { 735 745 RT_NOREF(pvThis, fMode, fMask); … … 741 751 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetTimes} 742 752 */ 743 static DECLCALLBACK(int) rtFsIso 9660File_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,753 static DECLCALLBACK(int) rtFsIsoFile_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, 744 754 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime) 745 755 { … … 752 762 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetOwner} 753 763 */ 754 static DECLCALLBACK(int) rtFsIso 9660File_SetOwner(void *pvThis, RTUID uid, RTGID gid)764 static DECLCALLBACK(int) rtFsIsoFile_SetOwner(void *pvThis, RTUID uid, RTGID gid) 755 765 { 756 766 RT_NOREF(pvThis, uid, gid); … … 762 772 * @interface_method_impl{RTVFSFILEOPS,pfnSeek} 763 773 */ 764 static DECLCALLBACK(int) rtFsIso 9660File_Seek(void *pvThis, RTFOFF offSeek, unsigned uMethod, PRTFOFF poffActual)765 { 766 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;774 static DECLCALLBACK(int) rtFsIsoFile_Seek(void *pvThis, RTFOFF offSeek, unsigned uMethod, PRTFOFF poffActual) 775 { 776 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 767 777 RTFOFF offNew; 768 778 switch (uMethod) … … 797 807 * @interface_method_impl{RTVFSFILEOPS,pfnQuerySize} 798 808 */ 799 static DECLCALLBACK(int) rtFsIso 9660File_QuerySize(void *pvThis, uint64_t *pcbFile)800 { 801 PRTFSISO 9660FILEOBJ pThis = (PRTFSISO9660FILEOBJ)pvThis;809 static DECLCALLBACK(int) rtFsIsoFile_QuerySize(void *pvThis, uint64_t *pcbFile) 810 { 811 PRTFSISOFILEOBJ pThis = (PRTFSISOFILEOBJ)pvThis; 802 812 *pcbFile = pThis->pShared->Core.cbObject; 803 813 return VINF_SUCCESS; … … 815 825 RTVFSOBJTYPE_FILE, 816 826 "FatFile", 817 rtFsIso 9660File_Close,818 rtFsIso 9660File_QueryInfo,827 rtFsIsoFile_Close, 828 rtFsIsoFile_QueryInfo, 819 829 RTVFSOBJOPS_VERSION 820 830 }, 821 831 RTVFSIOSTREAMOPS_VERSION, 822 832 RTVFSIOSTREAMOPS_FEAT_NO_SG, 823 rtFsIso 9660File_Read,824 rtFsIso 9660File_Write,825 rtFsIso 9660File_Flush,826 rtFsIso 9660File_PollOne,827 rtFsIso 9660File_Tell,833 rtFsIsoFile_Read, 834 rtFsIsoFile_Write, 835 rtFsIsoFile_Flush, 836 rtFsIsoFile_PollOne, 837 rtFsIsoFile_Tell, 828 838 NULL /*pfnSkip*/, 829 839 NULL /*pfnZeroFill*/, … … 835 845 RTVFSOBJSETOPS_VERSION, 836 846 RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet), 837 rtFsIso 9660File_SetMode,838 rtFsIso 9660File_SetTimes,839 rtFsIso 9660File_SetOwner,847 rtFsIsoFile_SetMode, 848 rtFsIsoFile_SetTimes, 849 rtFsIsoFile_SetOwner, 840 850 RTVFSOBJSETOPS_VERSION 841 851 }, 842 rtFsIso 9660File_Seek,843 rtFsIso 9660File_QuerySize,852 rtFsIsoFile_Seek, 853 rtFsIsoFile_QuerySize, 844 854 RTVFSFILEOPS_VERSION 845 855 }; … … 847 857 848 858 /** 849 * Instantiates a new directory .859 * Instantiates a new directory, from 9660. 850 860 * 851 861 * @returns IPRT status code. … … 863 873 * @param phVfsFile Where to return the file handle. 864 874 */ 865 static int rtFsIso 9660File_New(PRTFSISO9660VOL pThis, PRTFSISO9660DIRSHRD pParentDir, PCISO9660DIRREC pDirRec, uint32_t cDirRecs,875 static int rtFsIsoFile_New9660(PRTFSISOVOL pThis, PRTFSISODIRSHRD pParentDir, PCISO9660DIRREC pDirRec, uint32_t cDirRecs, 866 876 uint64_t offDirRec, uint64_t fOpen, uint32_t uVersion, PRTVFSFILE phVfsFile) 867 877 { … … 871 881 * Create a VFS object. 872 882 */ 873 PRTFSISO 9660FILEOBJ pNewFile;883 PRTFSISOFILEOBJ pNewFile; 874 884 int rc = RTVfsNewFile(&g_rtFsIos9660FileOps, sizeof(*pNewFile), fOpen, pThis->hVfsSelf, NIL_RTVFSLOCK /*use volume lock*/, 875 885 phVfsFile, (void **)&pNewFile); … … 879 889 * Look for existing shared object, create a new one if necessary. 880 890 */ 881 PRTFSISO 9660FILESHRD pShared = (PRTFSISO9660FILESHRD)rtFsIso9660Dir_LookupShared(pParentDir, offDirRec);891 PRTFSISOFILESHRD pShared = (PRTFSISOFILESHRD)rtFsIsoDir_LookupShared(pParentDir, offDirRec); 882 892 if (!pShared) 883 893 { 884 pShared = (PRTFSISO 9660FILESHRD)RTMemAllocZ(sizeof(*pShared));894 pShared = (PRTFSISOFILESHRD)RTMemAllocZ(sizeof(*pShared)); 885 895 if (pShared) 886 896 { 887 897 /* 888 * Initialize it all so rtFsIso 9660File_Close doesn't trip up in anyway.898 * Initialize it all so rtFsIsoFile_Close doesn't trip up in anyway. 889 899 */ 890 rc = rtFsIso 9660Core_InitFromDirRec(&pShared->Core, pDirRec, cDirRecs, offDirRec, uVersion, pThis);900 rc = rtFsIsoCore_InitFrom9660DirRec(&pShared->Core, pDirRec, cDirRecs, offDirRec, uVersion, pThis); 891 901 if (RT_SUCCESS(rc)) 892 rtFsIso 9660DirShrd_AddOpenChild(pParentDir, &pShared->Core);902 rtFsIsoDirShrd_AddOpenChild(pParentDir, &pShared->Core); 893 903 else 894 904 { … … 900 910 if (pShared) 901 911 { 902 LogFlow(("rtFsIso 9660File_New: cbObject=%#RX64 First Extent: off=%#RX64 cb=%#RX64\n",912 LogFlow(("rtFsIsoFile_New9660: cbObject=%#RX64 First Extent: off=%#RX64 cb=%#RX64\n", 903 913 pShared->Core.cbObject, pShared->Core.FirstExtent.offDisk, pShared->Core.FirstExtent.cbExtent)); 904 914 pNewFile->offFile = 0; … … 921 931 * @param offDirRec The directory record offset of the child. 922 932 */ 923 static PRTFSISO 9660CORE rtFsIso9660Dir_LookupShared(PRTFSISO9660DIRSHRD pThis, uint64_t offDirRec)924 { 925 PRTFSISO 9660CORE pCur;926 RTListForEach(&pThis->OpenChildren, pCur, RTFSISO 9660CORE, Entry)933 static PRTFSISOCORE rtFsIsoDir_LookupShared(PRTFSISODIRSHRD pThis, uint64_t offDirRec) 934 { 935 PRTFSISOCORE pCur; 936 RTListForEach(&pThis->OpenChildren, pCur, RTFSISOCORE, Entry) 927 937 { 928 938 if (pCur->offDirRec == offDirRec) … … 946 956 * @param pNext The directory record alleged to be the next extent. 947 957 */ 948 DECLINLINE(bool) rtFsIso 9660Dir_IsDirRecNextExtent(PCISO9660DIRREC pFirst, PCISO9660DIRREC pNext)958 DECLINLINE(bool) rtFsIsoDir_Is9660DirRecNextExtent(PCISO9660DIRREC pFirst, PCISO9660DIRREC pNext) 949 959 { 950 960 if (RT_LIKELY(pNext->bFileIdLength == pFirst->bFileIdLength)) … … 962 972 963 973 /** 964 * Worker for rtFsIso 9660Dir_FindEntry that compares a UTF-16BE name with a974 * Worker for rtFsIsoDir_FindEntry that compares a UTF-16BE name with a 965 975 * directory record. 966 976 * … … 973 983 * @param puVersion Where to return any file version number. 974 984 */ 975 DECL_FORCE_INLINE(bool) rtFsIso 9660Dir_IsEntryEqualUtf16Big(PCISO9660DIRREC pDirRec, PCRTUTF16 pwszEntry, size_t cbEntry,976 985 DECL_FORCE_INLINE(bool) rtFsIsoDir_IsEntryEqualUtf16Big(PCISO9660DIRREC pDirRec, PCRTUTF16 pwszEntry, size_t cbEntry, 986 size_t cwcEntry, uint32_t *puVersion) 977 987 { 978 988 /* ASSUME directories cannot have any version tags. */ … … 1019 1029 1020 1030 /** 1021 * Worker for rtFsIso 9660Dir_FindEntry that compares an ASCII name with a1031 * Worker for rtFsIsoDir_FindEntry that compares an ASCII name with a 1022 1032 * directory record. 1023 1033 * … … 1028 1038 * @param puVersion Where to return any file version number. 1029 1039 */ 1030 DECL_FORCE_INLINE(bool) rtFsIso 9660Dir_IsEntryEqualAscii(PCISO9660DIRREC pDirRec, const char *pszEntry, size_t cchEntry,1040 DECL_FORCE_INLINE(bool) rtFsIsoDir_IsEntryEqualAscii(PCISO9660DIRREC pDirRec, const char *pszEntry, size_t cchEntry, 1031 1041 uint32_t *puVersion) 1032 1042 { … … 1089 1099 * @param puVersion Where to return the file version number. 1090 1100 */ 1091 static int rtFsIso 9660Dir_FindEntry(PRTFSISO9660DIRSHRD pThis, const char *pszEntry, uint64_t *poffDirRec,1092 1101 static int rtFsIsoDir_FindEntry(PRTFSISODIRSHRD pThis, const char *pszEntry, uint64_t *poffDirRec, 1102 PCISO9660DIRREC *ppDirRec, uint32_t *pcDirRecs, PRTFMODE pfMode, uint32_t *puVersion) 1093 1103 { 1094 1104 /* Set return values. */ … … 1152 1162 if (fIsUtf16) 1153 1163 { 1154 if (RT_LIKELY(!rtFsIso 9660Dir_IsEntryEqualUtf16Big(pDirRec, uBuf.wszEntry, cbEntry, cwcEntry, puVersion)))1164 if (RT_LIKELY(!rtFsIsoDir_IsEntryEqualUtf16Big(pDirRec, uBuf.wszEntry, cbEntry, cwcEntry, puVersion))) 1155 1165 { 1156 1166 /* Advance */ … … 1161 1171 else 1162 1172 { 1163 if (RT_LIKELY(!rtFsIso 9660Dir_IsEntryEqualAscii(pDirRec, uBuf.s.szUpper, cchUpper, puVersion)))1173 if (RT_LIKELY(!rtFsIsoDir_IsEntryEqualAscii(pDirRec, uBuf.s.szUpper, cchUpper, puVersion))) 1164 1174 { 1165 1175 /** @todo check rock. */ … … 1194 1204 if (pDirRec2->cbDirRec != 0) 1195 1205 { 1196 Assert(rtFsIso 9660Dir_IsDirRecNextExtent(pDirRec, pDirRec2));1206 Assert(rtFsIsoDir_Is9660DirRecNextExtent(pDirRec, pDirRec2)); 1197 1207 cDirRecs++; 1198 1208 if (!(pDirRec2->fFileFlags & ISO9660_FILE_FLAGS_MULTI_EXTENT)) … … 1219 1229 * @param pShared The shared directory structure. 1220 1230 */ 1221 static void rtFsIso 9660DirShrd_Release(PRTFSISO9660DIRSHRD pShared)1231 static void rtFsIsoDirShrd_Release(PRTFSISODIRSHRD pShared) 1222 1232 { 1223 1233 uint32_t cRefs = ASMAtomicDecU32(&pShared->Core.cRefs); … … 1225 1235 if (cRefs == 0) 1226 1236 { 1227 LogFlow(("rtFsIso 9660DirShrd_Release: Destroying shared structure %p\n", pShared));1237 LogFlow(("rtFsIsoDirShrd_Release: Destroying shared structure %p\n", pShared)); 1228 1238 Assert(pShared->Core.cRefs == 0); 1229 1239 if (pShared->pbDir) … … 1232 1242 pShared->pbDir = NULL; 1233 1243 } 1234 rtFsIso 9660Core_Destroy(&pShared->Core);1244 rtFsIsoCore_Destroy(&pShared->Core); 1235 1245 RTMemFree(pShared); 1236 1246 } … … 1243 1253 * @param pShared The shared directory structure. 1244 1254 */ 1245 static void rtFsIso 9660DirShrd_Retain(PRTFSISO9660DIRSHRD pShared)1255 static void rtFsIsoDirShrd_Retain(PRTFSISODIRSHRD pShared) 1246 1256 { 1247 1257 uint32_t cRefs = ASMAtomicIncU32(&pShared->Core.cRefs); … … 1254 1264 * @interface_method_impl{RTVFSOBJOPS,pfnClose} 1255 1265 */ 1256 static DECLCALLBACK(int) rtFsIso 9660Dir_Close(void *pvThis)1257 { 1258 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1259 LogFlow(("rtFsIso 9660Dir_Close(%p/%p)\n", pThis, pThis->pShared));1260 1261 PRTFSISO 9660DIRSHRD pShared = pThis->pShared;1266 static DECLCALLBACK(int) rtFsIsoDir_Close(void *pvThis) 1267 { 1268 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1269 LogFlow(("rtFsIsoDir_Close(%p/%p)\n", pThis, pThis->pShared)); 1270 1271 PRTFSISODIRSHRD pShared = pThis->pShared; 1262 1272 pThis->pShared = NULL; 1263 1273 if (pShared) 1264 rtFsIso 9660DirShrd_Release(pShared);1274 rtFsIsoDirShrd_Release(pShared); 1265 1275 return VINF_SUCCESS; 1266 1276 } … … 1270 1280 * @interface_method_impl{RTVFSOBJOPS,pfnQueryInfo} 1271 1281 */ 1272 static DECLCALLBACK(int) rtFsIso 9660Dir_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr)1273 { 1274 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1275 return rtFsIso 9660Core_QueryInfo(&pThis->pShared->Core, pObjInfo, enmAddAttr);1282 static DECLCALLBACK(int) rtFsIsoDir_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 1283 { 1284 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1285 return rtFsIsoCore_QueryInfo(&pThis->pShared->Core, pObjInfo, enmAddAttr); 1276 1286 } 1277 1287 … … 1280 1290 * @interface_method_impl{RTVFSOBJSETOPS,pfnMode} 1281 1291 */ 1282 static DECLCALLBACK(int) rtFsIso 9660Dir_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask)1292 static DECLCALLBACK(int) rtFsIsoDir_SetMode(void *pvThis, RTFMODE fMode, RTFMODE fMask) 1283 1293 { 1284 1294 RT_NOREF(pvThis, fMode, fMask); … … 1290 1300 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetTimes} 1291 1301 */ 1292 static DECLCALLBACK(int) rtFsIso 9660Dir_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,1302 static DECLCALLBACK(int) rtFsIsoDir_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, 1293 1303 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime) 1294 1304 { … … 1301 1311 * @interface_method_impl{RTVFSOBJSETOPS,pfnSetOwner} 1302 1312 */ 1303 static DECLCALLBACK(int) rtFsIso 9660Dir_SetOwner(void *pvThis, RTUID uid, RTGID gid)1313 static DECLCALLBACK(int) rtFsIsoDir_SetOwner(void *pvThis, RTUID uid, RTGID gid) 1304 1314 { 1305 1315 RT_NOREF(pvThis, uid, gid); … … 1311 1321 * @interface_method_impl{RTVFSOBJOPS,pfnTraversalOpen} 1312 1322 */ 1313 static DECLCALLBACK(int) rtFsIso 9660Dir_TraversalOpen(void *pvThis, const char *pszEntry, PRTVFSDIR phVfsDir,1314 1323 static DECLCALLBACK(int) rtFsIsoDir_TraversalOpen(void *pvThis, const char *pszEntry, PRTVFSDIR phVfsDir, 1324 PRTVFSSYMLINK phVfsSymlink, PRTVFS phVfsMounted) 1315 1325 { 1316 1326 /* … … 1328 1338 *phVfsDir = NIL_RTVFSDIR; 1329 1339 1330 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1331 PRTFSISO 9660DIRSHRDpShared = pThis->pShared;1340 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1341 PRTFSISODIRSHRD pShared = pThis->pShared; 1332 1342 PCISO9660DIRREC pDirRec; 1333 1343 uint64_t offDirRec; … … 1335 1345 RTFMODE fMode; 1336 1346 uint32_t uVersion; 1337 rc = rtFsIso 9660Dir_FindEntry(pShared, pszEntry, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion);1338 Log2(("rtFsIso 9660Dir_TraversalOpen: FindEntry(,%s,) -> %Rrc\n", pszEntry, rc));1347 rc = rtFsIsoDir_FindEntry(pShared, pszEntry, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion); 1348 Log2(("rtFsIsoDir_TraversalOpen: FindEntry(,%s,) -> %Rrc\n", pszEntry, rc)); 1339 1349 if (RT_SUCCESS(rc)) 1340 1350 { … … 1343 1353 case RTFS_TYPE_DIRECTORY: 1344 1354 if (phVfsDir) 1345 rc = rtFsIso 9660Dir_New(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, phVfsDir);1355 rc = rtFsIsoDir_New9660(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, phVfsDir); 1346 1356 else 1347 1357 rc = VERR_NOT_SYMLINK; … … 1376 1386 * @interface_method_impl{RTVFSDIROPS,pfnOpenFile} 1377 1387 */ 1378 static DECLCALLBACK(int) rtFsIso 9660Dir_OpenFile(void *pvThis, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile)1379 { 1380 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1381 PRTFSISO 9660DIRSHRD pShared = pThis->pShared;1388 static DECLCALLBACK(int) rtFsIsoDir_OpenFile(void *pvThis, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile) 1389 { 1390 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1391 PRTFSISODIRSHRD pShared = pThis->pShared; 1382 1392 1383 1393 /* … … 1396 1406 RTFMODE fMode; 1397 1407 uint32_t uVersion; 1398 int rc = rtFsIso 9660Dir_FindEntry(pShared, pszFilename, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion);1399 Log2(("rtFsIso 9660Dir_OpenFile: FindEntry(,%s,) -> %Rrc\n", pszFilename, rc));1408 int rc = rtFsIsoDir_FindEntry(pShared, pszFilename, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion); 1409 Log2(("rtFsIsoDir_OpenFile: FindEntry(,%s,) -> %Rrc\n", pszFilename, rc)); 1400 1410 if (RT_SUCCESS(rc)) 1401 1411 { … … 1403 1413 { 1404 1414 case RTFS_TYPE_FILE: 1405 rc = rtFsIso 9660File_New(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, fOpen, uVersion, phVfsFile);1415 rc = rtFsIsoFile_New9660(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, fOpen, uVersion, phVfsFile); 1406 1416 break; 1407 1417 … … 1431 1441 * @interface_method_impl{RTVFSDIROPS,pfnOpenDir} 1432 1442 */ 1433 static DECLCALLBACK(int) rtFsIso 9660Dir_OpenDir(void *pvThis, const char *pszSubDir, uint32_t fFlags, PRTVFSDIR phVfsDir)1434 { 1435 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1436 PRTFSISO 9660DIRSHRD pShared = pThis->pShared;1443 static DECLCALLBACK(int) rtFsIsoDir_OpenDir(void *pvThis, const char *pszSubDir, uint32_t fFlags, PRTVFSDIR phVfsDir) 1444 { 1445 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1446 PRTFSISODIRSHRD pShared = pThis->pShared; 1437 1447 AssertReturn(!fFlags, VERR_INVALID_FLAGS); 1438 1448 … … 1445 1455 RTFMODE fMode; 1446 1456 uint32_t uVersion; 1447 int rc = rtFsIso 9660Dir_FindEntry(pShared, pszSubDir, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion);1448 Log2(("rtFsIso 9660Dir_OpenDir: FindEntry(,%s,) -> %Rrc\n", pszSubDir, rc));1457 int rc = rtFsIsoDir_FindEntry(pShared, pszSubDir, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion); 1458 Log2(("rtFsIsoDir_OpenDir: FindEntry(,%s,) -> %Rrc\n", pszSubDir, rc)); 1449 1459 if (RT_SUCCESS(rc)) 1450 1460 { … … 1452 1462 { 1453 1463 case RTFS_TYPE_DIRECTORY: 1454 rc = rtFsIso 9660Dir_New(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, phVfsDir);1464 rc = rtFsIsoDir_New9660(pShared->Core.pVol, pShared, pDirRec, cDirRecs, offDirRec, phVfsDir); 1455 1465 break; 1456 1466 … … 1477 1487 * @interface_method_impl{RTVFSDIROPS,pfnCreateDir} 1478 1488 */ 1479 static DECLCALLBACK(int) rtFsIso 9660Dir_CreateDir(void *pvThis, const char *pszSubDir, RTFMODE fMode, PRTVFSDIR phVfsDir)1489 static DECLCALLBACK(int) rtFsIsoDir_CreateDir(void *pvThis, const char *pszSubDir, RTFMODE fMode, PRTVFSDIR phVfsDir) 1480 1490 { 1481 1491 RT_NOREF(pvThis, pszSubDir, fMode, phVfsDir); … … 1487 1497 * @interface_method_impl{RTVFSDIROPS,pfnOpenSymlink} 1488 1498 */ 1489 static DECLCALLBACK(int) rtFsIso 9660Dir_OpenSymlink(void *pvThis, const char *pszSymlink, PRTVFSSYMLINK phVfsSymlink)1499 static DECLCALLBACK(int) rtFsIsoDir_OpenSymlink(void *pvThis, const char *pszSymlink, PRTVFSSYMLINK phVfsSymlink) 1490 1500 { 1491 1501 RT_NOREF(pvThis, pszSymlink, phVfsSymlink); … … 1498 1508 * @interface_method_impl{RTVFSDIROPS,pfnCreateSymlink} 1499 1509 */ 1500 static DECLCALLBACK(int) rtFsIso 9660Dir_CreateSymlink(void *pvThis, const char *pszSymlink, const char *pszTarget,1501 1510 static DECLCALLBACK(int) rtFsIsoDir_CreateSymlink(void *pvThis, const char *pszSymlink, const char *pszTarget, 1511 RTSYMLINKTYPE enmType, PRTVFSSYMLINK phVfsSymlink) 1502 1512 { 1503 1513 RT_NOREF(pvThis, pszSymlink, pszTarget, enmType, phVfsSymlink); … … 1509 1519 * @interface_method_impl{RTVFSDIROPS,pfnQueryEntryInfo} 1510 1520 */ 1511 static DECLCALLBACK(int) rtFsIso 9660Dir_QueryEntryInfo(void *pvThis, const char *pszEntry,1512 1521 static DECLCALLBACK(int) rtFsIsoDir_QueryEntryInfo(void *pvThis, const char *pszEntry, 1522 PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 1513 1523 { 1514 1524 /* 1515 1525 * Try locate the entry. 1516 1526 */ 1517 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1518 PRTFSISO 9660DIRSHRDpShared = pThis->pShared;1527 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1528 PRTFSISODIRSHRD pShared = pThis->pShared; 1519 1529 PCISO9660DIRREC pDirRec; 1520 1530 uint64_t offDirRec; … … 1522 1532 RTFMODE fMode; 1523 1533 uint32_t uVersion; 1524 int rc = rtFsIso 9660Dir_FindEntry(pShared, pszEntry, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion);1525 Log2(("rtFsIso 9660Dir_QueryEntryInfo: FindEntry(,%s,) -> %Rrc\n", pszEntry, rc));1534 int rc = rtFsIsoDir_FindEntry(pShared, pszEntry, &offDirRec, &pDirRec, &cDirRecs, &fMode, &uVersion); 1535 Log2(("rtFsIsoDir_QueryEntryInfo: FindEntry(,%s,) -> %Rrc\n", pszEntry, rc)); 1526 1536 if (RT_SUCCESS(rc)) 1527 1537 { 1528 1538 /* 1529 * To avoid duplicating code in rtFsIso 9660Core_InitFromDirRec and1530 * rtFsIso 9660Core_QueryInfo, we create a dummy RTFSISO9660CORE on the stack.1539 * To avoid duplicating code in rtFsIsoCore_InitFrom9660DirRec and 1540 * rtFsIsoCore_QueryInfo, we create a dummy RTFSISOCORE on the stack. 1531 1541 */ 1532 RTFSISO 9660CORE TmpObj;1542 RTFSISOCORE TmpObj; 1533 1543 RT_ZERO(TmpObj); 1534 rc = rtFsIso 9660Core_InitFromDirRec(&TmpObj, pDirRec, cDirRecs, offDirRec, uVersion, pShared->Core.pVol);1544 rc = rtFsIsoCore_InitFrom9660DirRec(&TmpObj, pDirRec, cDirRecs, offDirRec, uVersion, pShared->Core.pVol); 1535 1545 if (RT_SUCCESS(rc)) 1536 1546 { 1537 rc = rtFsIso 9660Core_QueryInfo(&TmpObj, pObjInfo, enmAddAttr);1547 rc = rtFsIsoCore_QueryInfo(&TmpObj, pObjInfo, enmAddAttr); 1538 1548 RTMemFree(TmpObj.paExtents); 1539 1549 } … … 1546 1556 * @interface_method_impl{RTVFSDIROPS,pfnUnlinkEntry} 1547 1557 */ 1548 static DECLCALLBACK(int) rtFsIso 9660Dir_UnlinkEntry(void *pvThis, const char *pszEntry, RTFMODE fType)1558 static DECLCALLBACK(int) rtFsIsoDir_UnlinkEntry(void *pvThis, const char *pszEntry, RTFMODE fType) 1549 1559 { 1550 1560 RT_NOREF(pvThis, pszEntry, fType); … … 1556 1566 * @interface_method_impl{RTVFSDIROPS,pfnRenameEntry} 1557 1567 */ 1558 static DECLCALLBACK(int) rtFsIso 9660Dir_RenameEntry(void *pvThis, const char *pszEntry, RTFMODE fType, const char *pszNewName)1568 static DECLCALLBACK(int) rtFsIsoDir_RenameEntry(void *pvThis, const char *pszEntry, RTFMODE fType, const char *pszNewName) 1559 1569 { 1560 1570 RT_NOREF(pvThis, pszEntry, fType, pszNewName); … … 1566 1576 * @interface_method_impl{RTVFSDIROPS,pfnRewindDir} 1567 1577 */ 1568 static DECLCALLBACK(int) rtFsIso 9660Dir_RewindDir(void *pvThis)1569 { 1570 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1578 static DECLCALLBACK(int) rtFsIsoDir_RewindDir(void *pvThis) 1579 { 1580 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1571 1581 pThis->offDir = 0; 1572 1582 return VINF_SUCCESS; … … 1577 1587 * @interface_method_impl{RTVFSDIROPS,pfnReadDir} 1578 1588 */ 1579 static DECLCALLBACK(int) rtFsIso 9660Dir_ReadDir(void *pvThis, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry,1580 1581 { 1582 PRTFSISO 9660DIROBJ pThis = (PRTFSISO9660DIROBJ)pvThis;1583 PRTFSISO 9660DIRSHRD pShared = pThis->pShared;1589 static DECLCALLBACK(int) rtFsIsoDir_ReadDir(void *pvThis, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, 1590 RTFSOBJATTRADD enmAddAttr) 1591 { 1592 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 1593 PRTFSISODIRSHRD pShared = pThis->pShared; 1584 1594 1585 1595 while (pThis->offDir + RT_UOFFSETOF(ISO9660DIRREC, achFileId) <= pShared->cbDir) … … 1602 1612 { 1603 1613 *pcbDirEntry = RT_UOFFSETOF(RTDIRENTRYEX, szName) + 2; 1604 Log3(("rtFsIso 9660Dir_ReadDir: VERR_BUFFER_OVERFLOW (dot)\n"));1614 Log3(("rtFsIsoDir_ReadDir: VERR_BUFFER_OVERFLOW (dot)\n")); 1605 1615 return VERR_BUFFER_OVERFLOW; 1606 1616 } … … 1615 1625 { 1616 1626 *pcbDirEntry = RT_UOFFSETOF(RTDIRENTRYEX, szName) + 3; 1617 Log3(("rtFsIso 9660Dir_ReadDir: VERR_BUFFER_OVERFLOW (dot-dot)\n"));1627 Log3(("rtFsIsoDir_ReadDir: VERR_BUFFER_OVERFLOW (dot-dot)\n")); 1618 1628 return VERR_BUFFER_OVERFLOW; 1619 1629 } … … 1639 1649 { 1640 1650 *pcbDirEntry = RT_UOFFSETOF(RTDIRENTRYEX, szName) + cchNeeded + 1; 1641 Log3(("rtFsIso 9660Dir_ReadDir: VERR_BUFFER_OVERFLOW - cbDst=%zu cchNeeded=%zu (UTF-16BE)\n", cbDst, cchNeeded));1651 Log3(("rtFsIsoDir_ReadDir: VERR_BUFFER_OVERFLOW - cbDst=%zu cchNeeded=%zu (UTF-16BE)\n", cbDst, cchNeeded)); 1642 1652 return VERR_BUFFER_OVERFLOW; 1643 1653 } … … 1663 1673 if (*pcbDirEntry < cbNeeded) 1664 1674 { 1665 Log3(("rtFsIso 9660Dir_ReadDir: VERR_BUFFER_OVERFLOW - cbDst=%zu cbNeeded=%zu (ASCII)\n", *pcbDirEntry, cbNeeded));1675 Log3(("rtFsIsoDir_ReadDir: VERR_BUFFER_OVERFLOW - cbDst=%zu cbNeeded=%zu (ASCII)\n", *pcbDirEntry, cbNeeded)); 1666 1676 *pcbDirEntry = cbNeeded; 1667 1677 return VERR_BUFFER_OVERFLOW; … … 1678 1688 1679 1689 /* 1680 * To avoid duplicating code in rtFsIso 9660Core_InitFromDirRec and1681 * rtFsIso 9660Core_QueryInfo, we create a dummy RTFSISO9660CORE on the stack.1690 * To avoid duplicating code in rtFsIsoCore_InitFrom9660DirRec and 1691 * rtFsIsoCore_QueryInfo, we create a dummy RTFSISOCORE on the stack. 1682 1692 */ 1683 RTFSISO 9660CORE TmpObj;1693 RTFSISOCORE TmpObj; 1684 1694 RT_ZERO(TmpObj); 1685 rtFsIso 9660Core_InitFromDirRec(&TmpObj, pDirRec, 1 /* cDirRecs - see below why 1 */,1695 rtFsIsoCore_InitFrom9660DirRec(&TmpObj, pDirRec, 1 /* cDirRecs - see below why 1 */, 1686 1696 pThis->offDir + pShared->Core.FirstExtent.offDisk, uVersion, pShared->Core.pVol); 1687 int rc = rtFsIso 9660Core_QueryInfo(&TmpObj, &pDirEntry->Info, enmAddAttr);1697 int rc = rtFsIsoCore_QueryInfo(&TmpObj, &pDirEntry->Info, enmAddAttr); 1688 1698 1689 1699 /* … … 1691 1701 * 1692 1702 * Multi extent records only affect the file size and the directory location, 1693 * so we deal with it here instead of involving * rtFsIso 9660Core_InitFromDirRec1703 * so we deal with it here instead of involving * rtFsIsoCore_InitFrom9660DirRec 1694 1704 * which would potentially require freeing memory and such. 1695 1705 */ 1696 1706 if (!(pDirRec->fFileFlags & ISO9660_FILE_FLAGS_MULTI_EXTENT)) 1697 1707 { 1698 Log3(("rtFsIso 9660Dir_ReadDir: offDir=%#07x: %s (rc=%Rrc)\n", pThis->offDir, pDirEntry->szName, rc));1708 Log3(("rtFsIsoDir_ReadDir: offDir=%#07x: %s (rc=%Rrc)\n", pThis->offDir, pDirEntry->szName, rc)); 1699 1709 pThis->offDir += pDirRec->cbDirRec; 1700 1710 } … … 1717 1727 offDir = (offDir + pShared->Core.pVol->cbSector) & ~(pShared->Core.pVol->cbSector - 1U); 1718 1728 } 1719 Log3(("rtFsIso 9660Dir_ReadDir: offDir=%#07x, %u extents ending at %#07x: %s (rc=%Rrc)\n",1729 Log3(("rtFsIsoDir_ReadDir: offDir=%#07x, %u extents ending at %#07x: %s (rc=%Rrc)\n", 1720 1730 pThis->offDir, cExtents, offDir, pDirEntry->szName, rc)); 1721 1731 pThis->offDir = offDir; … … 1726 1736 } 1727 1737 1728 Log3(("rtFsIso 9660Dir_ReadDir: offDir=%#07x: VERR_NO_MORE_FILES\n", pThis->offDir));1738 Log3(("rtFsIsoDir_ReadDir: offDir=%#07x: VERR_NO_MORE_FILES\n", pThis->offDir)); 1729 1739 return VERR_NO_MORE_FILES; 1730 1740 } … … 1734 1744 * FAT file operations. 1735 1745 */ 1736 static const RTVFSDIROPS g_rtFsIso 9660DirOps =1746 static const RTVFSDIROPS g_rtFsIsoDirOps = 1737 1747 { 1738 1748 { /* Obj */ … … 1740 1750 RTVFSOBJTYPE_DIR, 1741 1751 "ISO 9660 Dir", 1742 rtFsIso 9660Dir_Close,1743 rtFsIso 9660Dir_QueryInfo,1752 rtFsIsoDir_Close, 1753 rtFsIsoDir_QueryInfo, 1744 1754 RTVFSOBJOPS_VERSION 1745 1755 }, … … 1749 1759 RTVFSOBJSETOPS_VERSION, 1750 1760 RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet), 1751 rtFsIso 9660Dir_SetMode,1752 rtFsIso 9660Dir_SetTimes,1753 rtFsIso 9660Dir_SetOwner,1761 rtFsIsoDir_SetMode, 1762 rtFsIsoDir_SetTimes, 1763 rtFsIsoDir_SetOwner, 1754 1764 RTVFSOBJSETOPS_VERSION 1755 1765 }, 1756 rtFsIso 9660Dir_TraversalOpen,1757 rtFsIso 9660Dir_OpenFile,1758 rtFsIso 9660Dir_OpenDir,1759 rtFsIso 9660Dir_CreateDir,1760 rtFsIso 9660Dir_OpenSymlink,1761 rtFsIso 9660Dir_CreateSymlink,1762 rtFsIso 9660Dir_QueryEntryInfo,1763 rtFsIso 9660Dir_UnlinkEntry,1764 rtFsIso 9660Dir_RenameEntry,1765 rtFsIso 9660Dir_RewindDir,1766 rtFsIso 9660Dir_ReadDir,1766 rtFsIsoDir_TraversalOpen, 1767 rtFsIsoDir_OpenFile, 1768 rtFsIsoDir_OpenDir, 1769 rtFsIsoDir_CreateDir, 1770 rtFsIsoDir_OpenSymlink, 1771 rtFsIsoDir_CreateSymlink, 1772 rtFsIsoDir_QueryEntryInfo, 1773 rtFsIsoDir_UnlinkEntry, 1774 rtFsIsoDir_RenameEntry, 1775 rtFsIsoDir_RewindDir, 1776 rtFsIsoDir_ReadDir, 1767 1777 RTVFSDIROPS_VERSION, 1768 1778 }; … … 1778 1788 * @param pDir The directory. 1779 1789 * @param pChild The child being opened. 1780 * @sa rtFsIso 9660DirShrd_RemoveOpenChild1781 */ 1782 static void rtFsIso 9660DirShrd_AddOpenChild(PRTFSISO9660DIRSHRD pDir, PRTFSISO9660CORE pChild)1783 { 1784 rtFsIso 9660DirShrd_Retain(pDir);1790 * @sa rtFsIsoDirShrd_RemoveOpenChild 1791 */ 1792 static void rtFsIsoDirShrd_AddOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild) 1793 { 1794 rtFsIsoDirShrd_Retain(pDir); 1785 1795 1786 1796 RTListAppend(&pDir->OpenChildren, &pChild->Entry); … … 1798 1808 * objects to be released recursively (parent dir and the volume). 1799 1809 * 1800 * @sa rtFsIso 9660DirShrd_AddOpenChild1801 */ 1802 static void rtFsIso 9660DirShrd_RemoveOpenChild(PRTFSISO9660DIRSHRD pDir, PRTFSISO9660CORE pChild)1810 * @sa rtFsIsoDirShrd_AddOpenChild 1811 */ 1812 static void rtFsIsoDirShrd_RemoveOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild) 1803 1813 { 1804 1814 AssertReturnVoid(pChild->pParentDir == pDir); … … 1806 1816 pChild->pParentDir = NULL; 1807 1817 1808 rtFsIso 9660DirShrd_Release(pDir);1818 rtFsIsoDirShrd_Release(pDir); 1809 1819 } 1810 1820 … … 1814 1824 * Logs the content of a directory. 1815 1825 */ 1816 static void rtFsIso 9660DirShrd_LogContent(PRTFSISO9660DIRSHRD pThis)1826 static void rtFsIsoDirShrd_Log9660Content(PRTFSISODIRSHRD pThis) 1817 1827 { 1818 1828 if (LogIs2Enabled()) … … 1882 1892 1883 1893 /** 1884 * Instantiates a new shared directory structure .1894 * Instantiates a new shared directory structure, given 9660 records. 1885 1895 * 1886 1896 * @returns IPRT status code. … … 1894 1904 * @param ppShared Where to return the shared directory structure. 1895 1905 */ 1896 static int rtFsIso 9660DirShrd_New(PRTFSISO9660VOL pThis, PRTFSISO9660DIRSHRD pParentDir, PCISO9660DIRREC pDirRec,1897 uint32_t cDirRecs, uint64_t offDirRec, PRTFSISO 9660DIRSHRD *ppShared)1906 static int rtFsIsoDirShrd_New9660(PRTFSISOVOL pThis, PRTFSISODIRSHRD pParentDir, PCISO9660DIRREC pDirRec, 1907 uint32_t cDirRecs, uint64_t offDirRec, PRTFSISODIRSHRD *ppShared) 1898 1908 { 1899 1909 /* … … 1901 1911 */ 1902 1912 int rc = VERR_NO_MEMORY; 1903 PRTFSISO 9660DIRSHRD pShared = (PRTFSISO9660DIRSHRD)RTMemAllocZ(sizeof(*pShared));1913 PRTFSISODIRSHRD pShared = (PRTFSISODIRSHRD)RTMemAllocZ(sizeof(*pShared)); 1904 1914 if (pShared) 1905 1915 { 1906 rc = rtFsIso 9660Core_InitFromDirRec(&pShared->Core, pDirRec, cDirRecs, offDirRec, 0 /*uVersion*/, pThis);1916 rc = rtFsIsoCore_InitFrom9660DirRec(&pShared->Core, pDirRec, cDirRecs, offDirRec, 0 /*uVersion*/, pThis); 1907 1917 if (RT_SUCCESS(rc)) 1908 1918 { … … 1916 1926 { 1917 1927 #ifdef LOG_ENABLED 1918 rtFsIso 9660DirShrd_LogContent(pShared);1928 rtFsIsoDirShrd_Log9660Content(pShared); 1919 1929 #endif 1920 1930 … … 1924 1934 */ 1925 1935 if (pParentDir) 1926 rtFsIso 9660DirShrd_AddOpenChild(pParentDir, &pShared->Core);1936 rtFsIsoDirShrd_AddOpenChild(pParentDir, &pShared->Core); 1927 1937 *ppShared = pShared; 1928 1938 return VINF_SUCCESS; … … 1946 1956 * @param phVfsDir Where to return the directory handle. 1947 1957 */ 1948 static int rtFsIso 9660Dir_NewWithShared(PRTFSISO9660VOL pThis, PRTFSISO9660DIRSHRD pShared, PRTVFSDIR phVfsDir)1958 static int rtFsIsoDir_NewWithShared(PRTFSISOVOL pThis, PRTFSISODIRSHRD pShared, PRTVFSDIR phVfsDir) 1949 1959 { 1950 1960 /* 1951 1961 * Create VFS object around the shared structure. 1952 1962 */ 1953 PRTFSISO 9660DIROBJ pNewDir;1954 int rc = RTVfsNewDir(&g_rtFsIso 9660DirOps, sizeof(*pNewDir), 0 /*fFlags*/, pThis->hVfsSelf,1963 PRTFSISODIROBJ pNewDir; 1964 int rc = RTVfsNewDir(&g_rtFsIsoDirOps, sizeof(*pNewDir), 0 /*fFlags*/, pThis->hVfsSelf, 1955 1965 NIL_RTVFSLOCK /*use volume lock*/, phVfsDir, (void **)&pNewDir); 1956 1966 if (RT_SUCCESS(rc)) … … 1965 1975 } 1966 1976 1967 rtFsIso 9660DirShrd_Release(pShared);1977 rtFsIsoDirShrd_Release(pShared); 1968 1978 *phVfsDir = NIL_RTVFSDIR; 1969 1979 return rc; … … 1973 1983 1974 1984 /** 1975 * Instantiates a new directory VFS instance , creating the shared structure as1976 * necessary.1985 * Instantiates a new directory VFS instance for ISO 9660, creating the shared 1986 * structure as necessary. 1977 1987 * 1978 1988 * @returns IPRT status code. … … 1985 1995 * @param phVfsDir Where to return the directory handle. 1986 1996 */ 1987 static int rtFsIso 9660Dir_New(PRTFSISO9660VOL pThis, PRTFSISO9660DIRSHRD pParentDir, PCISO9660DIRREC pDirRec,1997 static int rtFsIsoDir_New9660(PRTFSISOVOL pThis, PRTFSISODIRSHRD pParentDir, PCISO9660DIRREC pDirRec, 1988 1998 uint32_t cDirRecs, uint64_t offDirRec, PRTVFSDIR phVfsDir) 1989 1999 { … … 1991 2001 * Look for existing shared object, create a new one if necessary. 1992 2002 */ 1993 int rc = VINF_SUCCESS; 1994 PRTFSISO9660DIRSHRD pShared = (PRTFSISO9660DIRSHRD)rtFsIso9660Dir_LookupShared(pParentDir, offDirRec); 2003 PRTFSISODIRSHRD pShared = (PRTFSISODIRSHRD)rtFsIsoDir_LookupShared(pParentDir, offDirRec); 1995 2004 if (!pShared) 1996 2005 { 1997 rc = rtFsIso9660DirShrd_New(pThis, pParentDir, pDirRec, cDirRecs, offDirRec, &pShared);2006 int rc = rtFsIsoDirShrd_New9660(pThis, pParentDir, pDirRec, cDirRecs, offDirRec, &pShared); 1998 2007 if (RT_FAILURE(rc)) 1999 2008 { … … 2002 2011 } 2003 2012 } 2004 return rtFsIso 9660Dir_NewWithShared(pThis, pShared, phVfsDir);2013 return rtFsIsoDir_NewWithShared(pThis, pShared, phVfsDir); 2005 2014 } 2006 2015 … … 2010 2019 * @interface_method_impl{RTVFSOBJOPS::Obj,pfnClose} 2011 2020 */ 2012 static DECLCALLBACK(int) rtFsIso 9660Vol_Close(void *pvThis)2013 { 2014 PRTFSISO 9660VOL pThis = (PRTFSISO9660VOL)pvThis;2015 Log(("rtFsIso 9660Vol_Close(%p)\n", pThis));2021 static DECLCALLBACK(int) rtFsIsoVol_Close(void *pvThis) 2022 { 2023 PRTFSISOVOL pThis = (PRTFSISOVOL)pvThis; 2024 Log(("rtFsIsoVol_Close(%p)\n", pThis)); 2016 2025 2017 2026 if (pThis->pRootDir) … … 2019 2028 Assert(RTListIsEmpty(&pThis->pRootDir->OpenChildren)); 2020 2029 Assert(pThis->pRootDir->Core.cRefs == 1); 2021 rtFsIso 9660DirShrd_Release(pThis->pRootDir);2030 rtFsIsoDirShrd_Release(pThis->pRootDir); 2022 2031 pThis->pRootDir = NULL; 2023 2032 } … … 2033 2042 * @interface_method_impl{RTVFSOBJOPS::Obj,pfnQueryInfo} 2034 2043 */ 2035 static DECLCALLBACK(int) rtFsIso 9660Vol_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr)2044 static DECLCALLBACK(int) rtFsIsoVol_QueryInfo(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 2036 2045 { 2037 2046 RT_NOREF(pvThis, pObjInfo, enmAddAttr); … … 2043 2052 * @interface_method_impl{RTVFSOPS,pfnOpenRoo} 2044 2053 */ 2045 static DECLCALLBACK(int) rtFsIso 9660Vol_OpenRoot(void *pvThis, PRTVFSDIR phVfsDir)2046 { 2047 PRTFSISO 9660VOL pThis = (PRTFSISO9660VOL)pvThis;2048 2049 rtFsIso 9660DirShrd_Retain(pThis->pRootDir); /* consumed by the next call */2050 return rtFsIso 9660Dir_NewWithShared(pThis, pThis->pRootDir, phVfsDir);2054 static DECLCALLBACK(int) rtFsIsoVol_OpenRoot(void *pvThis, PRTVFSDIR phVfsDir) 2055 { 2056 PRTFSISOVOL pThis = (PRTFSISOVOL)pvThis; 2057 2058 rtFsIsoDirShrd_Retain(pThis->pRootDir); /* consumed by the next call */ 2059 return rtFsIsoDir_NewWithShared(pThis, pThis->pRootDir, phVfsDir); 2051 2060 } 2052 2061 … … 2055 2064 * @interface_method_impl{RTVFSOPS,pfnIsRangeInUse} 2056 2065 */ 2057 static DECLCALLBACK(int) rtFsIso 9660Vol_IsRangeInUse(void *pvThis, RTFOFF off, size_t cb, bool *pfUsed)2066 static DECLCALLBACK(int) rtFsIsoVol_IsRangeInUse(void *pvThis, RTFOFF off, size_t cb, bool *pfUsed) 2058 2067 { 2059 2068 RT_NOREF(pvThis, off, cb, pfUsed); … … 2062 2071 2063 2072 2064 DECL_HIDDEN_CONST(const RTVFSOPS) g_rtFsIso 9660VolOps =2073 DECL_HIDDEN_CONST(const RTVFSOPS) g_rtFsIsoVolOps = 2065 2074 { 2066 2075 { /* Obj */ 2067 2076 RTVFSOBJOPS_VERSION, 2068 2077 RTVFSOBJTYPE_VFS, 2069 "ISO 9660 ",2070 rtFsIso 9660Vol_Close,2071 rtFsIso 9660Vol_QueryInfo,2078 "ISO 9660/UDF", 2079 rtFsIsoVol_Close, 2080 rtFsIsoVol_QueryInfo, 2072 2081 RTVFSOBJOPS_VERSION 2073 2082 }, 2074 2083 RTVFSOPS_VERSION, 2075 2084 0 /* fFeatures */, 2076 rtFsIso 9660Vol_OpenRoot,2077 rtFsIso 9660Vol_IsRangeInUse,2085 rtFsIsoVol_OpenRoot, 2086 rtFsIsoVol_IsRangeInUse, 2078 2087 RTVFSOPS_VERSION 2079 2088 }; 2080 2089 2081 2090 2091 static int rtFsIsoVolValidateUdfDescTag(PCUDFTAG pTag, uint16_t idTag, uint32_t offTag, PRTERRINFO pErrInfo) 2092 { 2093 /* 2094 * Checksum the tag first. 2095 */ 2096 const uint8_t *pbTag = (const uint8_t *)pTag; 2097 uint8_t const bChecksum = pbTag[0] 2098 + pbTag[1] 2099 + pbTag[2] 2100 + pbTag[3] 2101 + pbTag[5] /* skipping byte 4 as that's the checksum. */ 2102 + pbTag[6] 2103 + pbTag[7] 2104 + pbTag[8] 2105 + pbTag[9] 2106 + pbTag[10] 2107 + pbTag[11] 2108 + pbTag[12] 2109 + pbTag[13] 2110 + pbTag[14] 2111 + pbTag[15]; 2112 if (pTag->uChecksum == bChecksum) 2113 { 2114 /* 2115 * Do the matching. 2116 */ 2117 if ( pTag->uVersion == 3 2118 || pTag->uVersion == 2) 2119 { 2120 if ( pTag->idTag == idTag 2121 || idTag == UINT16_MAX) 2122 { 2123 if (pTag->offTag == offTag) 2124 return VINF_SUCCESS; 2125 2126 Log(("rtFsIsoVolValidateUdfDescTag(,%#x,%#010RX32,): Sector mismatch: %#RX32 (%.*Rhxs)\n", 2127 idTag, offTag, pTag->offTag, sizeof(*pTag), pTag)); 2128 return RTErrInfoSetF(pErrInfo, VERR_MISMATCH, "Descriptor tag sector number mismatch: %#x, expected %#x (%.*Rhxs)", 2129 pTag->offTag, offTag, sizeof(*pTag), pTag); 2130 } 2131 Log(("rtFsIsoVolValidateUdfDescTag(,%#x,%#010RX32,): Tag ID mismatch: %#x (%.*Rhxs)\n", 2132 idTag, offTag, pTag->idTag, sizeof(*pTag), pTag)); 2133 return RTErrInfoSetF(pErrInfo, VERR_MISMATCH, "Descriptor tag ID mismatch: %#x, expected %#x (%.*Rhxs)", 2134 pTag->idTag, idTag, sizeof(*pTag), pTag); 2135 } 2136 Log(("rtFsIsoVolValidateUdfDescTag(,%#x,%#010RX32,): Unsupported version: %#x (%.*Rhxs)\n", 2137 idTag, offTag, pTag->uVersion, sizeof(*pTag), pTag)); 2138 return RTErrInfoSetF(pErrInfo, VERR_MISMATCH, "Unsupported descriptor tag version: %#x, expected 2 or 3 (%.*Rhxs)", 2139 pTag->uVersion, sizeof(*pTag), pTag); 2140 } 2141 Log(("rtFsIsoVolValidateUdfDescTag(,%#x,%#010RX32,): checksum error: %#x, calc %#x (%.*Rhxs)\n", 2142 idTag, offTag, pTag->uChecksum, bChecksum, sizeof(*pTag), pTag)); 2143 return RTErrInfoSetF(pErrInfo, VERR_MISMATCH, 2144 "Descriptor tag checksum error: %#x, calculated %#x (%.*Rhxs)", 2145 pTag->uChecksum, bChecksum, sizeof(*pTag), pTag); 2146 } 2147 2148 typedef struct RTFSISOSEENSEQENCES 2149 { 2150 /** Number of sequences we've seen thus far. */ 2151 uint32_t cSequences; 2152 /** The per sequence data. */ 2153 struct 2154 { 2155 uint64_t off; /**< Byte offset of the sequence. */ 2156 uint32_t cb; /**< Size of the sequence. */ 2157 } aSequences[8]; 2158 } RTFSISOSEENSEQENCES; 2159 typedef RTFSISOSEENSEQENCES *PRTFSISOSEENSEQENCES; 2160 2161 2162 /** 2163 * Process a VDS sequence, recursively dealing with volume descriptor pointers. 2164 * 2165 * @returns 2166 * @param pThis . 2167 * @param offSeq . 2168 * @param cbSeq . 2169 * @param pbBuf . 2170 * @param cbBuf . 2171 * @param cNestings The VDS nesting depth. 2172 * @param pErrInfo . 2173 */ 2174 static int rtFsIsoVolReadAndProcessUdfVdsSeq(PRTFSISOVOL pThis, uint64_t offSeq, uint32_t cbSeq, uint8_t *pbBuf, size_t cbBuf, 2175 uint32_t cNestings, PRTERRINFO pErrInfo) 2176 { 2177 Assert(cbBuf >= _2K); 2178 2179 /* 2180 * Check nesting depth. 2181 */ 2182 if (cNestings > 5) 2183 return RTErrInfoSet(pErrInfo, VERR_TOO_MUCH_DATA, "The volume descriptor sequence (VDS) is nested too deeply."); 2184 2185 2186 /* 2187 * Do the processing sector by sector to keep things simple. 2188 */ 2189 uint32_t offInSeq = 0; 2190 while (offInSeq < cbSeq) 2191 { 2192 int rc; 2193 2194 /* 2195 * Read the next sector. Zero pad if less that a sector. 2196 */ 2197 Assert((offInSeq & (pThis->cbSector - 1)) == 0); 2198 rc = RTVfsFileReadAt(pThis->hVfsBacking, offSeq + offInSeq, pbBuf, pThis->cbSector, NULL); 2199 if (RT_FAILURE(rc)) 2200 return RTErrInfoSetF(pErrInfo, rc, "Error reading VDS content at %RX64 (LB %#x): %Rrc", 2201 offSeq + offInSeq, pThis->cbSector, rc); 2202 if (cbSeq - offInSeq < pThis->cbSector) 2203 memset(&pbBuf[cbSeq - offInSeq], 0, pThis->cbSector - (cbSeq - offInSeq)); 2204 2205 /* 2206 * Check tag. 2207 */ 2208 PCUDFTAG pTag = (PCUDFTAG)pbBuf; 2209 rc = rtFsIsoVolValidateUdfDescTag(pTag, UINT16_MAX, (offSeq + offInSeq) / pThis->cbSector, pErrInfo); 2210 if (RT_FAILURE(rc)) 2211 return rc; 2212 2213 switch (pTag->idTag) 2214 { 2215 case UDF_TAG_ID_PRIMARY_VOL_DESC: /* UDFPRIMARYVOLUMEDESC */ 2216 break; 2217 case UDF_TAG_ID_ANCHOR_VOLUME_DESC_PTR: /* UDFANCHORVOLUMEDESCPTR */ 2218 break; 2219 case UDF_TAG_ID_VOLUME_DESC_PTR: /* UDFVOLUMEDESCPTR */ 2220 break; 2221 case UDF_TAG_ID_IMPLEMENATION_USE_VOLUME_DESC: /* UDFIMPLEMENTATIONUSEVOLUMEDESC */ 2222 break; 2223 case UDF_TAG_ID_PARTITION_DESC: /* UDFPARTITIONDESC */ 2224 break; 2225 case UDF_TAG_ID_LOGICAL_VOLUME_DESC: /* UDFLOGICALVOLUMEDESC */ 2226 break; 2227 case UDF_TAG_ID_UNALLOCATED_SPACE_DESC: /* UDFUNALLOCATEDSPACEDESC */ 2228 break; 2229 case UDF_TAG_ID_TERMINATING_DESC: /* UDFTERMINATINGDESC */ 2230 break; 2231 case UDF_TAG_ID_LOGICAL_VOLUME_INTEGRITY_DESC: /* UDFLOGICALVOLINTEGRITYDESC */ 2232 break; 2233 2234 } 2235 2236 /* 2237 * Advance. 2238 */ 2239 offInSeq += pThis->cbSector; 2240 } 2241 2242 return VINF_SUCCESS; 2243 } 2244 2245 2246 2247 /** 2248 * Processes a volume descriptor sequence (VDS). 2249 * 2250 * @returns IPRT status code. 2251 * @param pThis The instance. 2252 * @param offSeq The byte offset of the sequence. 2253 * @param cbSeq The length of the sequence. 2254 * @param pSeenSequences Structure where to keep track of VDSes we've already 2255 * processed, to avoid redoing one that we don't 2256 * understand. 2257 * @param pbBuf Read buffer. 2258 * @param cbBuf Size of the read buffer. This is at least one 2259 * sector big. 2260 * @param pErrInfo Where to report extended error information. 2261 */ 2262 static int rtFsIsoVolReadAndProcessUdfVds(PRTFSISOVOL pThis, uint64_t offSeq, uint32_t cbSeq, 2263 PRTFSISOSEENSEQENCES pSeenSequences, uint8_t *pbBuf, size_t cbBuf, 2264 PRTERRINFO pErrInfo) 2265 { 2266 /* 2267 * Skip if already seen. 2268 */ 2269 uint32_t i = pSeenSequences->cSequences; 2270 while (i-- > 0) 2271 if ( pSeenSequences->aSequences[i].off == offSeq 2272 && pSeenSequences->aSequences[i].cb == cbSeq) 2273 return VERR_NOT_FOUND; 2274 2275 /* Not seen, so add it. */ 2276 Assert(pSeenSequences->cSequences + 1 <= RT_ELEMENTS(pSeenSequences->aSequences)); 2277 pSeenSequences->aSequences[pSeenSequences->cSequences].cb = cbSeq; 2278 pSeenSequences->aSequences[pSeenSequences->cSequences].off = offSeq; 2279 pSeenSequences->cSequences++; 2280 2281 LogFlow(("ISO/UDF: Processing anchor volume descriptor sequence at %#RX64 LB %#RX32\n", offSeq, cbSeq)); 2282 2283 /* 2284 * Reset the state before we start processing the descriptors. 2285 */ 2286 2287 NOREF(pThis); NOREF(pbBuf); NOREF(cbBuf); NOREF(pErrInfo); 2288 return VINF_SUCCESS; 2289 } 2290 2291 2292 static int rtFsIsoVolReadAndHandleUdfAvdp(PRTFSISOVOL pThis, uint64_t offAvdp, uint8_t *pbBuf, size_t cbBuf, 2293 PRTFSISOSEENSEQENCES pSeenSequences, PRTERRINFO pErrInfo) 2294 { 2295 /* 2296 * Try read the descriptor and validate its tag. 2297 */ 2298 PUDFANCHORVOLUMEDESCPTR pAvdp = (PUDFANCHORVOLUMEDESCPTR)pbBuf; 2299 size_t cbAvdpRead = RT_MIN(pThis->cbSector, cbBuf); 2300 int rc = RTVfsFileReadAt(pThis->hVfsBacking, offAvdp, pAvdp, cbAvdpRead, NULL); 2301 if (RT_SUCCESS(rc)) 2302 { 2303 rc = rtFsIsoVolValidateUdfDescTag(&pAvdp->Tag, UDF_TAG_ID_ANCHOR_VOLUME_DESC_PTR, offAvdp / pThis->cbSector, pErrInfo); 2304 if (RT_SUCCESS(rc)) 2305 { 2306 Log2(("ISO/UDF: AVDP: MainVolumeDescSeq=%#RX32 LB %#RX32, ReserveVolumeDescSeq=%#RX32 LB %#RX32\n", 2307 pAvdp->MainVolumeDescSeq.off, pAvdp->MainVolumeDescSeq.cb, 2308 pAvdp->ReserveVolumeDescSeq.off, pAvdp->ReserveVolumeDescSeq.cb)); 2309 2310 /* 2311 * Try the main sequence if it looks sane. 2312 */ 2313 UDFEXTENTAD const ReserveVolumeDescSeq = pAvdp->ReserveVolumeDescSeq; 2314 if ( pAvdp->MainVolumeDescSeq.off < pThis->cBackingSectors 2315 && (uint64_t)pAvdp->MainVolumeDescSeq.off 2316 + (pAvdp->MainVolumeDescSeq.cb + pThis->cbSector - 1) / pThis->cbSector 2317 <= pThis->cBackingSectors) 2318 { 2319 rc = rtFsIsoVolReadAndProcessUdfVds(pThis, (uint64_t)pAvdp->MainVolumeDescSeq.off * pThis->cbSector, 2320 pAvdp->MainVolumeDescSeq.cb, pSeenSequences, pbBuf, cbBuf, pErrInfo); 2321 if (RT_SUCCESS(rc)) 2322 return rc; 2323 } 2324 else 2325 rc = RTErrInfoSetF(pErrInfo, VERR_NOT_FOUND, 2326 "MainVolumeDescSeq is out of bounds: sector %#RX32 LB %#RX32 bytes, image is %#RX64 sectors", 2327 pAvdp->MainVolumeDescSeq.off, pAvdp->MainVolumeDescSeq.cb, pThis->cBackingSectors); 2328 if (ReserveVolumeDescSeq.cb > 0) 2329 { 2330 if ( ReserveVolumeDescSeq.off < pThis->cBackingSectors 2331 && (uint64_t)ReserveVolumeDescSeq.off 2332 + (ReserveVolumeDescSeq.cb + pThis->cbSector - 1) / pThis->cbSector 2333 <= pThis->cBackingSectors) 2334 { 2335 rc = rtFsIsoVolReadAndProcessUdfVds(pThis, (uint64_t)ReserveVolumeDescSeq.off * pThis->cbSector, 2336 ReserveVolumeDescSeq.cb, pSeenSequences, pbBuf, cbBuf, pErrInfo); 2337 if (RT_SUCCESS(rc)) 2338 return rc; 2339 } 2340 else if (RT_SUCCESS(rc)) 2341 rc = RTErrInfoSetF(pErrInfo, VERR_NOT_FOUND, 2342 "ReserveVolumeDescSeq is out of bounds: sector %#RX32 LB %#RX32 bytes, image is %#RX64 sectors", 2343 ReserveVolumeDescSeq.off, ReserveVolumeDescSeq.cb, pThis->cBackingSectors); 2344 } 2345 } 2346 } 2347 else 2348 rc = RTErrInfoSetF(pErrInfo, rc, 2349 "Error reading sector at offset %#RX64 (anchor volume descriptor pointer): %Rrc", offAvdp, rc); 2350 2351 return rc; 2352 } 2353 2354 2355 /** 2356 * Goes looking for UDF when we've seens a volume recognition sequence. 2357 * 2358 * @returns IPRT status code. 2359 * @param pThis The volume instance data. 2360 * @param puUdfLevel The UDF level indicated by the VRS. 2361 * @param offUdfBootVolDesc The offset of the BOOT2 descriptor, UINT64_MAX 2362 * if not encountered. 2363 * @param pbBuf Buffer for reading into. 2364 * @param cbBuf The size of the buffer. At least one sector. 2365 * @param pErrInfo Where to return extended error info. 2366 */ 2367 static int rtFsIsoVolHandleUdfDetection(PRTFSISOVOL pThis, uint8_t *puUdfLevel, uint64_t offUdfBootVolDesc, 2368 uint8_t *pbBuf, size_t cbBuf, PRTERRINFO pErrInfo) 2369 { 2370 NOREF(offUdfBootVolDesc); 2371 2372 /* 2373 * There are up to three anchor volume descriptor pointers that can give us 2374 * two different descriptor sequences each. Usually, the different AVDP 2375 * structures points to the same two sequences. The idea here is that 2376 * sectors may deteriorate and become unreadable, and we're supposed to try 2377 * out alternative sectors to get the job done. If we really took this 2378 * seriously, we could try read all sequences in parallel and use the 2379 * sectors that are good. However, we'll try keep things reasonably simple 2380 * since we'll most likely be reading from hard disks rather than optical 2381 * media. 2382 * 2383 * We keep track of which sequences we've processed so we don't try to do it 2384 * again when alternative AVDP sectors points to the same sequences. 2385 */ 2386 RTFSISOSEENSEQENCES SeenSequences = { 0 }; 2387 int rc = rtFsIsoVolReadAndHandleUdfAvdp(pThis, 256 * pThis->cbSector, pbBuf, cbBuf, 2388 &SeenSequences, pErrInfo); 2389 if (RT_FAILURE(rc)) 2390 rc = rtFsIsoVolReadAndHandleUdfAvdp(pThis, pThis->cbBacking - 256 * pThis->cbSector, 2391 pbBuf, cbBuf, &SeenSequences, pErrInfo); 2392 if (RT_FAILURE(rc)) 2393 rc = rtFsIsoVolReadAndHandleUdfAvdp(pThis, pThis->cbBacking - pThis->cbSector, 2394 pbBuf, cbBuf, &SeenSequences, pErrInfo); 2395 if (RT_SUCCESS(rc)) 2396 return rc; 2397 *puUdfLevel = 0; 2398 return VINF_SUCCESS; 2399 } 2400 2401 2082 2402 2083 2403 #ifdef LOG_ENABLED 2084 2404 2085 2405 /** Logging helper. */ 2086 static size_t rtFsIso 9660VolGetStrippedLength(const char *pachField, size_t cchField)2406 static size_t rtFsIsoVolGetStrippedLength(const char *pachField, size_t cchField) 2087 2407 { 2088 2408 while (cchField > 0 && pachField[cchField - 1] == ' ') … … 2092 2412 2093 2413 /** Logging helper. */ 2094 static char *rtFsIso 9660VolGetMaybeUtf16Be(const char *pachField, size_t cchField, char *pszDst, size_t cbDst)2414 static char *rtFsIsoVolGetMaybeUtf16Be(const char *pachField, size_t cchField, char *pszDst, size_t cbDst) 2095 2415 { 2096 2416 /* Check the format by looking for zero bytes. ISO-9660 doesn't allow zeros. … … 2202 2522 * @param pVolDesc The descriptor. 2203 2523 */ 2204 static void rtFsIso 9660VolLogPrimarySupplementaryVolDesc(PCISO9660SUPVOLDESC pVolDesc)2524 static void rtFsIsoVolLogPrimarySupplementaryVolDesc(PCISO9660SUPVOLDESC pVolDesc) 2205 2525 { 2206 2526 if (LogIs2Enabled()) … … 2208 2528 char szTmp[384]; 2209 2529 Log2(("ISO9660: fVolumeFlags: %#RX8\n", pVolDesc->fVolumeFlags)); 2210 Log2(("ISO9660: achSystemId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achSystemId, sizeof(pVolDesc->achSystemId), szTmp, sizeof(szTmp)) ));2211 Log2(("ISO9660: achVolumeId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achVolumeId, sizeof(pVolDesc->achVolumeId), szTmp, sizeof(szTmp)) ));2530 Log2(("ISO9660: achSystemId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achSystemId, sizeof(pVolDesc->achSystemId), szTmp, sizeof(szTmp)) )); 2531 Log2(("ISO9660: achVolumeId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achVolumeId, sizeof(pVolDesc->achVolumeId), szTmp, sizeof(szTmp)) )); 2212 2532 Log2(("ISO9660: Unused73: {%#RX32,%#RX32}\n", RT_BE2H_U32(pVolDesc->Unused73.be), RT_LE2H_U32(pVolDesc->Unused73.le))); 2213 2533 Log2(("ISO9660: VolumeSpaceSize: {%#RX32,%#RX32}\n", RT_BE2H_U32(pVolDesc->VolumeSpaceSize.be), RT_LE2H_U32(pVolDesc->VolumeSpaceSize.le))); 2214 Log2(("ISO9660: abEscapeSequences: '%.*s'\n", rtFsIso 9660VolGetStrippedLength((char *)pVolDesc->abEscapeSequences, sizeof(pVolDesc->abEscapeSequences)), pVolDesc->abEscapeSequences));2534 Log2(("ISO9660: abEscapeSequences: '%.*s'\n", rtFsIsoVolGetStrippedLength((char *)pVolDesc->abEscapeSequences, sizeof(pVolDesc->abEscapeSequences)), pVolDesc->abEscapeSequences)); 2215 2535 Log2(("ISO9660: cVolumesInSet: {%#RX16,%#RX16}\n", RT_BE2H_U16(pVolDesc->cVolumesInSet.be), RT_LE2H_U16(pVolDesc->cVolumesInSet.le))); 2216 2536 Log2(("ISO9660: VolumeSeqNo: {%#RX16,%#RX16}\n", RT_BE2H_U16(pVolDesc->VolumeSeqNo.be), RT_LE2H_U16(pVolDesc->VolumeSeqNo.le))); … … 2221 2541 Log2(("ISO9660: offTypeMPathTable: %#RX32\n", RT_BE2H_U32(pVolDesc->offTypeMPathTable))); 2222 2542 Log2(("ISO9660: offOptionalTypeMPathTable: %#RX32\n", RT_BE2H_U32(pVolDesc->offOptionalTypeMPathTable))); 2223 Log2(("ISO9660: achVolumeSetId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achVolumeSetId, sizeof(pVolDesc->achVolumeSetId), szTmp, sizeof(szTmp)) ));2224 Log2(("ISO9660: achPublisherId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achPublisherId, sizeof(pVolDesc->achPublisherId), szTmp, sizeof(szTmp)) ));2225 Log2(("ISO9660: achDataPreparerId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achDataPreparerId, sizeof(pVolDesc->achDataPreparerId), szTmp, sizeof(szTmp)) ));2226 Log2(("ISO9660: achApplicationId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achApplicationId, sizeof(pVolDesc->achApplicationId), szTmp, sizeof(szTmp)) ));2227 Log2(("ISO9660: achCopyrightFileId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achCopyrightFileId, sizeof(pVolDesc->achCopyrightFileId), szTmp, sizeof(szTmp)) ));2228 Log2(("ISO9660: achAbstractFileId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achAbstractFileId, sizeof(pVolDesc->achAbstractFileId), szTmp, sizeof(szTmp)) ));2229 Log2(("ISO9660: achBibliographicFileId: %s\n", rtFsIso 9660VolGetMaybeUtf16Be(pVolDesc->achBibliographicFileId, sizeof(pVolDesc->achBibliographicFileId), szTmp, sizeof(szTmp)) ));2543 Log2(("ISO9660: achVolumeSetId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achVolumeSetId, sizeof(pVolDesc->achVolumeSetId), szTmp, sizeof(szTmp)) )); 2544 Log2(("ISO9660: achPublisherId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achPublisherId, sizeof(pVolDesc->achPublisherId), szTmp, sizeof(szTmp)) )); 2545 Log2(("ISO9660: achDataPreparerId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achDataPreparerId, sizeof(pVolDesc->achDataPreparerId), szTmp, sizeof(szTmp)) )); 2546 Log2(("ISO9660: achApplicationId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achApplicationId, sizeof(pVolDesc->achApplicationId), szTmp, sizeof(szTmp)) )); 2547 Log2(("ISO9660: achCopyrightFileId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achCopyrightFileId, sizeof(pVolDesc->achCopyrightFileId), szTmp, sizeof(szTmp)) )); 2548 Log2(("ISO9660: achAbstractFileId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achAbstractFileId, sizeof(pVolDesc->achAbstractFileId), szTmp, sizeof(szTmp)) )); 2549 Log2(("ISO9660: achBibliographicFileId: %s\n", rtFsIsoVolGetMaybeUtf16Be(pVolDesc->achBibliographicFileId, sizeof(pVolDesc->achBibliographicFileId), szTmp, sizeof(szTmp)) )); 2230 2550 Log2(("ISO9660: BirthTime: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s%+03d\n", 2231 2551 pVolDesc->BirthTime.achYear, … … 2306 2626 * @param pErrInfo Where to return additional error info. Can be NULL. 2307 2627 */ 2308 static int rtFsIso 9660VolHandleRootDir(PRTFSISO9660VOL pThis, PCISO9660DIRREC pRootDir,2309 2628 static int rtFsIsoVolHandleRootDir(PRTFSISOVOL pThis, PCISO9660DIRREC pRootDir, 2629 PISO9660DIRREC pDstRootDir, PRTERRINFO pErrInfo) 2310 2630 { 2311 2631 if (pRootDir->cbDirRec < RT_OFFSETOF(ISO9660DIRREC, achFileId)) … … 2357 2677 * @param pErrInfo Where to return additional error info. Can be NULL. 2358 2678 */ 2359 static int rtFsIso 9660VolHandlePrimaryVolDesc(PRTFSISO9660VOL pThis, PCISO9660PRIMARYVOLDESC pVolDesc, uint32_t offVolDesc,2360 2679 static int rtFsIsoVolHandlePrimaryVolDesc(PRTFSISOVOL pThis, PCISO9660PRIMARYVOLDESC pVolDesc, uint32_t offVolDesc, 2680 PISO9660DIRREC pRootDir, uint64_t *poffRootDirRec, PRTERRINFO pErrInfo) 2361 2681 { 2362 2682 if (pVolDesc->bFileStructureVersion != ISO9660_FILE_STRUCTURE_VERSION) … … 2412 2732 */ 2413 2733 *poffRootDirRec = offVolDesc + RT_OFFSETOF(ISO9660PRIMARYVOLDESC, RootDir.DirRec); 2414 return rtFsIso 9660VolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo);2734 return rtFsIsoVolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo); 2415 2735 } 2416 2736 … … 2430 2750 * @param pErrInfo Where to return additional error info. Can be NULL. 2431 2751 */ 2432 static int rtFsIso 9660VolHandleSupplementaryVolDesc(PRTFSISO9660VOL pThis, PCISO9660SUPVOLDESC pVolDesc, uint32_t offVolDesc,2433 2434 2752 static int rtFsIsoVolHandleSupplementaryVolDesc(PRTFSISOVOL pThis, PCISO9660SUPVOLDESC pVolDesc, uint32_t offVolDesc, 2753 uint8_t *pbUcs2Level, PISO9660DIRREC pRootDir, uint64_t *poffRootDirRec, 2754 PRTERRINFO pErrInfo) 2435 2755 { 2436 2756 if (pVolDesc->bFileStructureVersion != ISO9660_FILE_STRUCTURE_VERSION) … … 2485 2805 * Switch to the joliet root dir as it has UTF-16 stuff in it. 2486 2806 */ 2487 int rc = rtFsIso 9660VolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo);2807 int rc = rtFsIsoVolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo); 2488 2808 if (RT_SUCCESS(rc)) 2489 2809 { … … 2502 2822 * 2503 2823 * @returns IPRT status code. 2504 * @param pThis The FATVFS instance to initialize.2505 * @param hVfsSelf The FATVFS handle (no reference consumed).2824 * @param pThis The ISO VFS instance to initialize. 2825 * @param hVfsSelf The ISO VFS handle (no reference consumed). 2506 2826 * @param hVfsBacking The file backing the alleged FAT file system. 2507 * Reference is consumed (via rtFsIso 9660Vol_Close).2508 * @param fFlags Flags, MBZ.2827 * Reference is consumed (via rtFsIsoVol_Close). 2828 * @param fFlags Flags, RTFSISO9660_F_XXX. 2509 2829 * @param pErrInfo Where to return additional error info. Can be NULL. 2510 2830 */ 2511 static int rtFsIso 9660VolTryInit(PRTFSISO9660VOL pThis, RTVFS hVfsSelf, RTVFSFILE hVfsBacking, uint32_t fFlags, PRTERRINFO pErrInfo)2831 static int rtFsIsoVolTryInit(PRTFSISOVOL pThis, RTVFS hVfsSelf, RTVFSFILE hVfsBacking, uint32_t fFlags, PRTERRINFO pErrInfo) 2512 2832 { 2513 2833 uint32_t const cbSector = 2048; 2514 2834 2515 2835 /* 2516 * First initialize the state so that rtFsIso 9660Vol_Destroy won't trip up.2836 * First initialize the state so that rtFsIsoVol_Destroy won't trip up. 2517 2837 */ 2518 2838 pThis->hVfsSelf = hVfsSelf; 2519 pThis->hVfsBacking = hVfsBacking; /* Caller referenced it for us, we consume it; rtFsIso 9660Vol_Destroy releases it. */2839 pThis->hVfsBacking = hVfsBacking; /* Caller referenced it for us, we consume it; rtFsIsoVol_Destroy releases it. */ 2520 2840 pThis->cbBacking = 0; 2841 pThis->cBackingSectors = 0; 2521 2842 pThis->fFlags = fFlags; 2522 2843 pThis->cbSector = cbSector; … … 2533 2854 */ 2534 2855 int rc = RTVfsFileGetSize(hVfsBacking, &pThis->cbBacking); 2535 if (RT_FAILURE(rc)) 2856 if (RT_SUCCESS(rc)) 2857 pThis->cBackingSectors = pThis->cbBacking / pThis->cbSector; 2858 else 2536 2859 return rc; 2537 2860 … … 2615 2938 "Unsupported primary volume descriptor version: %#x", Buf.VolDescHdr.bDescVersion); 2616 2939 #ifdef LOG_ENABLED 2617 rtFsIso 9660VolLogPrimarySupplementaryVolDesc(&Buf.SupVolDesc);2940 rtFsIsoVolLogPrimarySupplementaryVolDesc(&Buf.SupVolDesc); 2618 2941 #endif 2619 2942 if (cPrimaryVolDescs > 1) 2620 2943 return RTErrInfoSet(pErrInfo, VERR_VFS_UNSUPPORTED_FORMAT, "More than one primary volume descriptor"); 2621 rc = rtFsIso 9660VolHandlePrimaryVolDesc(pThis, &Buf.PrimaryVolDesc, offVolDesc, &RootDir, &offRootDirRec, pErrInfo);2944 rc = rtFsIsoVolHandlePrimaryVolDesc(pThis, &Buf.PrimaryVolDesc, offVolDesc, &RootDir, &offRootDirRec, pErrInfo); 2622 2945 } 2623 2946 else if (Buf.VolDescHdr.bDescType == ISO9660VOLDESC_TYPE_SUPPLEMENTARY) … … 2628 2951 "Unsupported supplemental volume descriptor version: %#x", Buf.VolDescHdr.bDescVersion); 2629 2952 #ifdef LOG_ENABLED 2630 rtFsIso 9660VolLogPrimarySupplementaryVolDesc(&Buf.SupVolDesc);2953 rtFsIsoVolLogPrimarySupplementaryVolDesc(&Buf.SupVolDesc); 2631 2954 #endif 2632 rc = rtFsIso 9660VolHandleSupplementaryVolDesc(pThis, &Buf.SupVolDesc, offVolDesc, &bJolietUcs2Level, &JolietRootDir,2633 2955 rc = rtFsIsoVolHandleSupplementaryVolDesc(pThis, &Buf.SupVolDesc, offVolDesc, &bJolietUcs2Level, &JolietRootDir, 2956 &offJolietRootDirRec, pErrInfo); 2634 2957 } 2635 2958 else if (Buf.VolDescHdr.bDescType == ISO9660VOLDESC_TYPE_BOOT_RECORD) … … 2706 3029 * If we found a UDF VRS and are interested in UDF, we have more work to do here. 2707 3030 */ 2708 if (uUdfLevel > 0) 2709 { 2710 Log(("rtFsIso9660VolTryInit: uUdfLevel=%d - TODO\n", uUdfLevel)); 3031 if (uUdfLevel > 0 && !(fFlags & RTFSISO9660_F_NO_UDF) && /* Just disable this code for now: */ (fFlags & RT_BIT(24))) 3032 { 3033 Log(("rtFsIsoVolTryInit: uUdfLevel=%d\n", uUdfLevel)); 3034 rc = rtFsIsoVolHandleUdfDetection(pThis, &uUdfLevel, offUdfBootVolDesc, Buf.ab, sizeof(Buf), pErrInfo); 3035 if (RT_FAILURE(rc)) 3036 return rc; 2711 3037 } 2712 3038 … … 2724 3050 { 2725 3051 pThis->fIsUtf16 = true; 2726 return rtFsIso 9660DirShrd_New(pThis, NULL, &JolietRootDir, 1, offJolietRootDirRec, &pThis->pRootDir);2727 } 2728 return rtFsIso 9660DirShrd_New(pThis, NULL, &RootDir, 1, offRootDirRec, &pThis->pRootDir);3052 return rtFsIsoDirShrd_New9660(pThis, NULL, &JolietRootDir, 1, offJolietRootDirRec, &pThis->pRootDir); 3053 } 3054 return rtFsIsoDirShrd_New9660(pThis, NULL, &RootDir, 1, offRootDirRec, &pThis->pRootDir); 2729 3055 } 2730 3056 … … 2756 3082 RTVFS hVfs = NIL_RTVFS; 2757 3083 void *pvThis = NULL; 2758 int rc = RTVfsNew(&g_rtFsIso 9660VolOps, sizeof(RTFSISO9660VOL), NIL_RTVFS, RTVFSLOCK_CREATE_RW, &hVfs, &pvThis);3084 int rc = RTVfsNew(&g_rtFsIsoVolOps, sizeof(RTFSISOVOL), NIL_RTVFS, RTVFSLOCK_CREATE_RW, &hVfs, &pvThis); 2759 3085 if (RT_SUCCESS(rc)) 2760 3086 { 2761 rc = rtFsIso 9660VolTryInit((PRTFSISO9660VOL)pvThis, hVfs, hVfsFileIn, fFlags, pErrInfo);3087 rc = rtFsIsoVolTryInit((PRTFSISOVOL)pvThis, hVfs, hVfsFileIn, fFlags, pErrInfo); 2762 3088 if (RT_SUCCESS(rc)) 2763 3089 *phVfs = hVfs;
Note:
See TracChangeset
for help on using the changeset viewer.