Changeset 95438 in vbox for trunk/src/VBox/Runtime/common/fs
- Timestamp:
- Jun 29, 2022 8:38:48 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152043
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r95435 r95438 647 647 * Directory entry type. 648 648 */ 649 typedef enum RTFSISOMAKERDIR ENTRY649 typedef enum RTFSISOMAKERDIRTYPE 650 650 { 651 651 /** Invalid directory entry. */ 652 RTFSISOMAKERDIR ENTRY_INVALID = 0,652 RTFSISOMAKERDIRTYPE_INVALID = 0, 653 653 /** Entry for the current directory, aka ".". */ 654 RTFSISOMAKERDIR ENTRY_CURRENT,654 RTFSISOMAKERDIRTYPE_CURRENT, 655 655 /** Entry for the parent directory, aka "..". */ 656 RTFSISOMAKERDIR ENTRY_PARENT,656 RTFSISOMAKERDIRTYPE_PARENT, 657 657 /** Entry for a regular directory entry. */ 658 RTFSISOMAKERDIR ENTRY_OTHER659 } RTFSISOMAKERDIR ENTRY;658 RTFSISOMAKERDIRTYPE_OTHER 659 } RTFSISOMAKERDIRTYPE; 660 660 661 661 … … 4687 4687 /* Set directory and translation table offsets. (These are for 4688 4688 helping generating data blocks later.) */ 4689 pName->offDirRec 4689 pName->offDirRec = offInDir; 4690 4690 4691 4691 /* Calculate the minimal directory record size. */ 4692 size_t cbDirRec 4692 size_t cbDirRec = RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pName->cbNameInDirRec + !(pName->cbNameInDirRec & 1); 4693 4693 AssertReturn(cbDirRec <= UINT8_MAX, VERR_FILENAME_TOO_LONG); 4694 4694 … … 4731 4731 && pName->cchRockRidgeNm > 0 4732 4732 && ( pName->cbNameInDirRec != 1 4733 || (uint8_t)pName->szName[0] > (uint8_t)0x01) ) 4733 || (uint8_t)pName->szName[0] > (uint8_t)0x01) ) /** @todo only root dir ever uses an ID byte here? [RR NM ./..] */ 4734 4734 { 4735 4735 uint16_t cchNm = pName->cchRockRidgeNm; … … 4802 4802 cbRock += sizeof(ISO9660SUSPSP); 4803 4803 Assert(pName->cbDirRec + cbRock < UINT8_MAX); 4804 pName->cbRockInDirRec = cbRock 4804 pName->cbRockInDirRec = cbRock; 4805 4805 pName->cbRockSpill = 0; 4806 4806 pName->fRockNeedER = false; … … 4890 4890 entries, instead we use the directory entry in the parent directory 4891 4891 with a 1 byte name (00 or 01). */ 4892 /** @todo r=bird: This causes trouble with RR NM records, since we'll be 4893 * emitting the real directory name rather than '.' or '..' (or 4894 * whatever we should be emitting for these two special dirs). 4895 * FreeBSD got confused with this. The RTFSISOMAKERDIRTYPE stuff is a 4896 * workaround for this, however it doesn't hold up if we have to use 4897 * the spill file. [RR NM ./..] */ 4892 4898 Assert(pCurName->cbDirRec != 0); 4893 4899 Assert(pParentName->cbDirRec != 0); … … 5852 5858 * @param fInSpill Indicates whether we're in a spill file (true) or 5853 5859 * directory record (false). 5854 */ 5855 static void rtFsIosMakerOutFile_GenerateRockRidge(PRTFSISOMAKERNAME pName, uint8_t *pbSys, size_t cbSys, bool fInSpill, 5856 RTFSISOMAKERDIRENTRY enmEntry) 5860 * @param enmDirType The kind of directory entry this is. 5861 */ 5862 static void rtFsIosMakerOutFile_GenerateRockRidge(PRTFSISOMAKERNAME pName, uint8_t *pbSys, size_t cbSys, 5863 bool fInSpill, RTFSISOMAKERDIRTYPE enmDirType) 5857 5864 { 5858 5865 /* … … 5998 6005 pNM->Hdr.bVersion = ISO9660RRIPNM_VER; 5999 6006 pNM->fFlags = cchThis == cchSrc ? 0 : ISO9660RRIP_NM_F_CONTINUE; 6000 if (enmEntry == RTFSISOMAKERDIRENTRY_CURRENT) 6007 /** @todo r=bird: This only works when not using the spill file. The spill 6008 * file entry will be shared between the original and all the '.' and 6009 * '..' entries. FreeBSD gets confused by this w/o the 6010 * ISO9660RRIP_NM_F_CURRENT and ISO9660RRIP_NM_F_PARENT flags. */ 6011 if (enmDirType == RTFSISOMAKERDIRTYPE_CURRENT) 6001 6012 pNM->fFlags |= ISO9660RRIP_NM_F_CURRENT; 6002 else if (enm Entry == RTFSISOMAKERDIRENTRY_PARENT)6013 else if (enmDirType == RTFSISOMAKERDIRTYPE_PARENT) 6003 6014 pNM->fFlags |= ISO9660RRIP_NM_F_PARENT; 6004 6015 memcpy(&pNM->achName[0], pszSrc, cchThis); … … 6170 6181 6171 6182 AssertReturn(cbToRead >= pChild->cbRockSpill, VERR_ISOMK_IPE_RR_READ); 6172 rtFsIosMakerOutFile_GenerateRockRidge(pDir->pName, pbBuf, cbToRead, true /*fInSpill*/, RTFSISOMAKERDIRENTRY_OTHER); 6183 /** @todo r=bird: using RTFSISOMAKERDIRTYPE_OTHER is correct as we don't seem to 6184 * have separate name entries for '.' and '..'. However it means that if 6185 * any directory ends up in the spill file we'll end up with the wrong 6186 * data for the '.' and '..' entries. [RR NM ./..] */ 6187 rtFsIosMakerOutFile_GenerateRockRidge(pDir->pName, pbBuf, cbToRead, true /*fInSpill*/, RTFSISOMAKERDIRTYPE_OTHER); 6173 6188 cbToRead -= pChild->cbRockSpill; 6174 6189 pbBuf += pChild->cbRockSpill; … … 6677 6692 * big (i.e. at most 256 bytes). 6678 6693 * @param pFinalizedDirs The finalized directory data for the namespace. 6694 * @param enmDirType The kind of directory entry this is. 6679 6695 */ 6680 6696 static uint32_t rtFsIsoMakerOutFile_GenerateDirRec(PRTFSISOMAKERNAME pName, bool fUnicode, uint8_t *pbBuf, 6681 PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, RTFSISOMAKERDIR ENTRY enmEntry)6697 PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, RTFSISOMAKERDIRTYPE enmDirType) 6682 6698 { 6683 6699 /* … … 6754 6770 RT_BZERO(&pbSys[pName->cbRockInDirRec], cbSys - pName->cbRockInDirRec); 6755 6771 if (pName->cbRockSpill == 0) 6756 rtFsIosMakerOutFile_GenerateRockRidge(pName, pbSys, cbSys, false /*fInSpill*/, enm Entry);6772 rtFsIosMakerOutFile_GenerateRockRidge(pName, pbSys, cbSys, false /*fInSpill*/, enmDirType); 6757 6773 else 6758 6774 { … … 6819 6835 * Normally there is just a single record without any zero padding. 6820 6836 */ 6821 uint32_t cbReturn = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, pbBuf, pFinalizedDirs, RTFSISOMAKERDIR ENTRY_OTHER);6837 uint32_t cbReturn = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, pbBuf, pFinalizedDirs, RTFSISOMAKERDIRTYPE_OTHER); 6822 6838 if (RT_LIKELY(pName->cbDirRecTotal == cbReturn)) 6823 6839 return cbReturn; … … 6895 6911 uint8_t abTmpBuf[256]; 6896 6912 Assert(pName->cbDirRec <= sizeof(abTmpBuf)); 6897 uint32_t const cbOne = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, abTmpBuf, pFinalizedDirs, RTFSISOMAKERDIRENTRY_OTHER); 6913 uint32_t const cbOne = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, abTmpBuf, 6914 pFinalizedDirs, RTFSISOMAKERDIRTYPE_OTHER); 6898 6915 Assert(cbOne == pName->cbDirRec); 6899 6916 if (cbOne == pName->cbDirRecTotal) … … 7015 7032 Assert(off < pName->cbDirRec); 7016 7033 size_t cbToCopy = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, abTmpBuf, pFinalizedDirs, 7017 bDirId == 0 ? RTFSISOMAKERDIR ENTRY_CURRENT : RTFSISOMAKERDIRENTRY_PARENT);7034 bDirId == 0 ? RTFSISOMAKERDIRTYPE_CURRENT : RTFSISOMAKERDIRTYPE_PARENT); 7018 7035 Assert(cbToCopy == pName->cbDirRec); 7036 7037 /** @todo r=bird: This isn't working quite right as the NM record includes the 7038 * full directory name. Spill file stuff is shared with the (grand)parent 7039 * directory entry. [RR NM ./..] */ 7019 7040 7020 7041 /* Replace the filename part. */
Note:
See TracChangeset
for help on using the changeset viewer.