VirtualBox

Changeset 95438 in vbox for trunk/src/VBox/Runtime/common/fs


Ignore:
Timestamp:
Jun 29, 2022 8:38:48 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152043
Message:

IPRT/isomaker.cpp: A bunch of TODOs following from the fix in r152039, as it seems to me the fix isn't addressing the real issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fs/isomaker.cpp

    r95435 r95438  
    647647 * Directory entry type.
    648648 */
    649 typedef enum RTFSISOMAKERDIRENTRY
     649typedef enum RTFSISOMAKERDIRTYPE
    650650{
    651651    /** Invalid directory entry. */
    652     RTFSISOMAKERDIRENTRY_INVALID = 0,
     652    RTFSISOMAKERDIRTYPE_INVALID = 0,
    653653    /** Entry for the current directory, aka ".". */
    654     RTFSISOMAKERDIRENTRY_CURRENT,
     654    RTFSISOMAKERDIRTYPE_CURRENT,
    655655    /** Entry for the parent directory, aka "..". */
    656     RTFSISOMAKERDIRENTRY_PARENT,
     656    RTFSISOMAKERDIRTYPE_PARENT,
    657657    /** Entry for a regular directory entry. */
    658     RTFSISOMAKERDIRENTRY_OTHER
    659 } RTFSISOMAKERDIRENTRY;
     658    RTFSISOMAKERDIRTYPE_OTHER
     659} RTFSISOMAKERDIRTYPE;
    660660
    661661
     
    46874687    /* Set directory and translation table offsets.  (These are for
    46884688       helping generating data blocks later.) */
    4689     pName->offDirRec   = offInDir;
     4689    pName->offDirRec = offInDir;
    46904690
    46914691    /* Calculate the minimal directory record size. */
    4692     size_t cbDirRec  = RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pName->cbNameInDirRec + !(pName->cbNameInDirRec & 1);
     4692    size_t cbDirRec = RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pName->cbNameInDirRec + !(pName->cbNameInDirRec & 1);
    46934693    AssertReturn(cbDirRec <= UINT8_MAX, VERR_FILENAME_TOO_LONG);
    46944694
     
    47314731            && pName->cchRockRidgeNm > 0
    47324732            && (   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 ./..] */
    47344734        {
    47354735            uint16_t cchNm = pName->cchRockRidgeNm;
     
    48024802                cbRock += sizeof(ISO9660SUSPSP);
    48034803                Assert(pName->cbDirRec + cbRock < UINT8_MAX);
    4804                 pName->cbRockInDirRec       = cbRock ;
     4804                pName->cbRockInDirRec       = cbRock;
    48054805                pName->cbRockSpill          = 0;
    48064806                pName->fRockNeedER          = false;
     
    48904890               entries, instead we use the directory entry in the parent directory
    48914891               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 ./..] */
    48924898            Assert(pCurName->cbDirRec != 0);
    48934899            Assert(pParentName->cbDirRec != 0);
     
    58525858 * @param   fInSpill        Indicates whether we're in a spill file (true) or
    58535859 *                          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 */
     5862static void rtFsIosMakerOutFile_GenerateRockRidge(PRTFSISOMAKERNAME pName, uint8_t *pbSys, size_t cbSys,
     5863                                                  bool fInSpill, RTFSISOMAKERDIRTYPE enmDirType)
    58575864{
    58585865    /*
     
    59986005                pNM->Hdr.bVersion   = ISO9660RRIPNM_VER;
    59996006                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)
    60016012                    pNM->fFlags    |= ISO9660RRIP_NM_F_CURRENT;
    6002                 else if (enmEntry == RTFSISOMAKERDIRENTRY_PARENT)
     6013                else if (enmDirType == RTFSISOMAKERDIRTYPE_PARENT)
    60036014                    pNM->fFlags    |= ISO9660RRIP_NM_F_PARENT;
    60046015                memcpy(&pNM->achName[0], pszSrc, cchThis);
     
    61706181
    61716182        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);
    61736188        cbToRead  -= pChild->cbRockSpill;
    61746189        pbBuf     += pChild->cbRockSpill;
     
    66776692 *                          big (i.e. at most 256 bytes).
    66786693 * @param   pFinalizedDirs  The finalized directory data for the namespace.
     6694 * @param   enmDirType      The kind of directory entry this is.
    66796695 */
    66806696static uint32_t rtFsIsoMakerOutFile_GenerateDirRec(PRTFSISOMAKERNAME pName, bool fUnicode, uint8_t *pbBuf,
    6681                                                    PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, RTFSISOMAKERDIRENTRY enmEntry)
     6697                                                   PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, RTFSISOMAKERDIRTYPE enmDirType)
    66826698{
    66836699    /*
     
    67546770            RT_BZERO(&pbSys[pName->cbRockInDirRec], cbSys - pName->cbRockInDirRec);
    67556771        if (pName->cbRockSpill == 0)
    6756             rtFsIosMakerOutFile_GenerateRockRidge(pName, pbSys, cbSys, false /*fInSpill*/, enmEntry);
     6772            rtFsIosMakerOutFile_GenerateRockRidge(pName, pbSys, cbSys, false /*fInSpill*/, enmDirType);
    67576773        else
    67586774        {
     
    68196835     * Normally there is just a single record without any zero padding.
    68206836     */
    6821     uint32_t cbReturn = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, pbBuf, pFinalizedDirs, RTFSISOMAKERDIRENTRY_OTHER);
     6837    uint32_t cbReturn = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, pbBuf, pFinalizedDirs, RTFSISOMAKERDIRTYPE_OTHER);
    68226838    if (RT_LIKELY(pName->cbDirRecTotal == cbReturn))
    68236839        return cbReturn;
     
    68956911    uint8_t abTmpBuf[256];
    68966912    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);
    68986915    Assert(cbOne == pName->cbDirRec);
    68996916    if (cbOne == pName->cbDirRecTotal)
     
    70157032    Assert(off < pName->cbDirRec);
    70167033    size_t cbToCopy = rtFsIsoMakerOutFile_GenerateDirRec(pName, fUnicode, abTmpBuf, pFinalizedDirs,
    7017                                                          bDirId == 0 ? RTFSISOMAKERDIRENTRY_CURRENT : RTFSISOMAKERDIRENTRY_PARENT);
     7034                                                         bDirId == 0 ? RTFSISOMAKERDIRTYPE_CURRENT : RTFSISOMAKERDIRTYPE_PARENT);
    70187035    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 ./..] */
    70197040
    70207041    /* Replace the filename part. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette