VirtualBox

Changeset 67325 in vbox for trunk


Ignore:
Timestamp:
Jun 9, 2017 3:09:10 PM (7 years ago)
Author:
vboxsync
Message:

IPRT: More ISO maker code.

File:
1 edited

Legend:

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

    r67305 r67325  
    129129    /** Sorted array of children. */
    130130    PPRTFSISOMAKERNAME      papChildren;
    131 
    132131    /** The translate table file. */
    133132    PRTFSISOMAKERFILE       pTransTblFile;
     133
     134    /** The offset in the path table (ISO-9660).
     135     * This is set when finalizing the image.  */
     136    uint32_t                offPathTable;
     137    /** The path table identifier of this directory (ISO-9660).
     138    * This is set when finalizing the image.  */
     139    uint16_t                idPathTable;
     140    /** Pointer to back to the namespace node this belongs to (for the finalized
     141     *  entry list). */
     142    PRTFSISOMAKERNAME       pName;
     143    /** Entry in the list of finalized directories. */
     144    RTLISTNODE              FinalizedEntry;
    134145} RTFSISOMAKERNAMEDIR;
    135146/** Pointer to directory specfic name space node info. */
     
    194205    uint64_t                INode;
    195206
     207    /** Size of the directory record (ISO-9660).
     208     * This is set when the image is being finalized. */
     209    uint16_t                cbDirRec;
     210
     211    /** The number of bytes the name requires in the directory record. */
     212    uint16_t                cbNameInDirRec;
    196213    /** The name length. */
    197214    uint16_t                cchName;
     
    300317    /** The file data size. */
    301318    uint64_t                cbData;
    302     /** Byte offset of the data in the image. */
     319    /** Byte offset of the data in the image.
     320     * UINT64_MAX until the location is finalized. */
    303321    uint64_t                offData;
    304322
     
    316334        PRTFSISOMAKERNAME   pTransTblDir;
    317335    } u;
     336
     337    /** Entry in the list of finalized directories. */
     338    RTLISTNODE              FinalizedEntry;
    318339} RTFSISOMAKERFILE;
    319340
     
    372393    uint64_t                cbData;
    373394    /** Number of volume descriptors. */
    374     uint8_t                 cVolumeDescriptors;
     395    uint32_t                cVolumeDescriptors;
    375396
    376397    /** The 'now' timestamp we use for the whole image.
     
    387408    RTFMODE                 fDefaultDirMode;
    388409
     410
     411    /** @name Finalized image stuff
     412     * @{ */
    389413    /** The finalized image size. */
    390414    uint64_t                cbFinalizedImage;
    391     //PISO9660PRIMARYVOLDESC
     415    /** System area content (sectors 0 thur 15).  This is NULL if the system area
     416     * are all zeros, which is often the case.   Hybrid ISOs have an MBR followed by
     417     * a GUID partition table here, helping making the image bootable when
     418     * transfered to a USB stick. */
     419    uint8_t                *pbSysArea;
     420    /** Number of non-zero system area bytes pointed to by pbSysArea.  */
     421    size_t                  cbSysArea;
     422
     423    /** Pointer to the buffer holding the volume descriptors. */
     424    uint8_t                *pbVolDescs;
     425    /** Pointer to the primary volume descriptor. */
     426    PISO9660PRIMARYVOLDESC  pPrimaryVolDesc;
     427    /** El Torito volume descriptor.
     428     * @todo fix type  */
     429    PISO9660BOOTRECORD      pElToritoDesc;
     430    /** Pointer to the primary volume descriptor. */
     431    PISO9660SUPVOLDESC      pJolietVolDesc;
     432    /** Terminating ISO-9660 volume descriptor. */
     433    PISO9660VOLDESCHDR      pTerminatorVolDesc;
     434
     435    /** Finalized ISO-9660 directory structures. */
     436    struct RTFSISOMAKERFINALIZEDDIRS
     437    {
     438        /** The image byte offset of the first directory. */
     439        uint64_t            offDirs;
     440        /** The image byte offset of the little endian path table.
     441         * This always follows offDirs.  */
     442        uint64_t            offPathTableL;
     443        /** The image byte offset of the big endian path table.
     444         * This always follows offPathTableL.  */
     445        uint64_t            offPathTableM;
     446        /** List of finalized directories for this namespace.
     447         * The list is in path table order so it can be generated on the fly.  The
     448         * directories will be ordered in the same way. */
     449        RTLISTANCHOR        FinalizedDirs;
     450        /** Rock ridge spill file. */
     451        PRTFSISOMAKERFILE   pRRSpillFile;
     452    }
     453    /** The finalized directory data for the primary ISO-9660 namespace. */
     454                            PrimaryIsoDirs,
     455    /** The finalized directory data for the joliet namespace. */
     456                            JolietDirs;
     457
     458    /** The image byte offset of the first file. */
     459    uint64_t                offFirstFile;
     460    /** Finalized file head (RTFSISOMAKERFILE).
     461     * The list is ordered by disk location.  Files are following the
     462     * directories and path tables. */
     463    RTLISTANCHOR            FinalizedFiles;
     464    /** @} */
     465
    392466} RTFSISOMAKERINT;
    393467/** Pointer to an ISO maker instance. */
    394468typedef RTFSISOMAKERINT *PRTFSISOMAKERINT;
     469
     470/** Pointer to the data for finalized ISO-9660 (primary / joliet) dirs. */
     471typedef struct RTFSISOMAKERINT::RTFSISOMAKERFINALIZEDDIRS *PRTFSISOMAKERFINALIZEDDIRS;
    395472
    396473
     
    505582        pThis->cRefs                        = 1;
    506583        //pThis->fSeenContent               = false;
     584        //pThis->fFinalized                 = false;
    507585
    508586        pThis->PrimaryIso.fNamespace        = RTFSISOMAKER_NAMESPACE_ISO_9660;
     
    538616        pThis->fDefaultDirMode              = 0555 | RTFS_TYPE_DIRECTORY | RTFS_DOS_DIRECTORY | RTFS_DOS_READONLY;
    539617
     618        pThis->cbFinalizedImage             = UINT64_MAX;
     619        //pThis->pbSysArea                  = NULL;
     620        //pThis->cbSysArea                  = 0;
     621        //pThis->pbVolDescs                 = NULL;
     622        //pThis->pPrimaryVolDesc            = NULL;
     623        //pThis->pElToritoDesc              = NULL;
     624        //pThis->pJolietVolDesc             = NULL;
     625
     626        pThis->PrimaryIsoDirs.offDirs       = UINT64_MAX;
     627        pThis->PrimaryIsoDirs.offPathTableL = UINT64_MAX;
     628        pThis->PrimaryIsoDirs.offPathTableM = UINT64_MAX;
     629        RTListInit(&pThis->PrimaryIsoDirs.FinalizedDirs);
     630        //pThis->PrimaryIsoDirs.pRRSpillFile = NULL;
     631
     632        pThis->JolietDirs.offDirs           = UINT64_MAX;
     633        pThis->JolietDirs.offPathTableL     = UINT64_MAX;
     634        pThis->JolietDirs.offPathTableM     = UINT64_MAX;
     635        RTListInit(&pThis->JolietDirs.FinalizedDirs);
     636        //pThis->JolietDirs.pRRSpillFile    = NULL;
     637
     638        pThis->offFirstFile                 = UINT64_MAX;
     639        RTListInit(&pThis->FinalizedFiles);
     640
    540641        RTTimeNow(&pThis->ImageCreationTime);
    541 
    542642        *phIsoMaker = pThis;
    543643        return VINF_SUCCESS;
     
    11671267 * @param   pcchDst     Where to return the length of the returned string (i.e.
    11681268 *                      not counting the terminator).
     1269 * @param   pcbInDirRec Where to return the name size in the directory record.
    11691270 */
    11701271static int rtFsIsoMakerNormalizeNameForPrimaryIso9660(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAME pParent,
    11711272                                                      const char *pchSrc, size_t cchSrc, bool fIsDir,
    1172                                                       char *pszDst, size_t cbDst, size_t *pcchDst)
     1273                                                      char *pszDst, size_t cbDst, size_t *pcchDst, size_t *pcbInDirRec)
    11731274{
    11741275    AssertReturn(cbDst > ISO9660_MAX_NAME_LEN, VERR_INTERNAL_ERROR_3);
     
    12411342    if (!rtFsIsoMakerFindObjInDir(pParent, pszDst, cchDst))
    12421343    {
    1243         *pcchDst = cchDst;
     1344        *pcchDst     = cchDst;
     1345        *pcbInDirRec = cchDst;
    12441346        return VINF_SUCCESS;
    12451347    }
     
    12731375        if (!rtFsIsoMakerFindObjInDir(pParent, pszDst, cchDst))
    12741376        {
    1275             *pcchDst = cchDst;
     1377            *pcchDst     = cchDst;
     1378            *pcbInDirRec = cchDst;
    12761379            return VINF_SUCCESS;
    12771380        }
     
    12971400 * @param   pcchDst     Where to return the length of the returned string (i.e.
    12981401 *                      not counting the terminator).
     1402 * @param   pcbInDirRec Where to return the name size in the directory record.
    12991403 */
    13001404static int rtFsIsoMakerNormalizeNameForNamespace(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace,
    13011405                                                 PRTFSISOMAKERNAME pParent, const char *pchSrc, size_t cchSrc, bool fIsDir,
    1302                                                  char *pszDst, size_t cbDst, size_t *pcchDst)
     1406                                                 char *pszDst, size_t cbDst, size_t *pcchDst, size_t *pcbInDirRec)
    13031407{
    13041408    if (cchSrc > 0)
     
    13141418             */
    13151419            case RTFSISOMAKER_NAMESPACE_ISO_9660:
    1316                 return rtFsIsoMakerNormalizeNameForPrimaryIso9660(pThis, pParent, pchSrc, cchSrc, fIsDir, pszDst, cbDst, pcchDst);
     1420                return rtFsIsoMakerNormalizeNameForPrimaryIso9660(pThis, pParent, pchSrc, cchSrc, fIsDir,
     1421                                                                  pszDst, cbDst, pcchDst, pcbInDirRec);
    13171422
    13181423            /*
     
    13251430                memcpy(pszDst, pchSrc, cchSrc);
    13261431                pszDst[cchSrc] = '\0';
    1327                 *pcchDst = cchSrc;
     1432                *pcchDst     = cchSrc;
     1433                *pcbInDirRec = RTStrCalcUtf16Len(pszDst);
    13281434                return VINF_SUCCESS;
    13291435            }
     
    13421448         * Root special case.
    13431449         */
     1450        *pszDst      = '\0';
     1451        *pcchDst     = 0;
     1452        *pcbInDirRec = 0;
    13441453        AssertReturn(pParent, VERR_INTERNAL_ERROR_3);
    1345         *pszDst = '\0';
    1346         *pcchDst = 0;
    13471454        return VINF_SUCCESS;
    13481455    }
     
    14491556     */
    14501557    size_t cchName;
     1558    size_t cbNameInDirRec;
    14511559    char   szName[RTFSISOMAKER_MAX_NAME_BUF];
    14521560    int rc = rtFsIsoMakerNormalizeNameForNamespace(pThis, pNamespace, pParent, pchSpec, cchSpec,
    14531561                                                   pObj->enmType == RTFSISOMAKEROBJTYPE_DIR,
    1454                                                    szName, sizeof(szName), &cchName);
     1562                                                   szName, sizeof(szName), &cchName, &cbNameInDirRec);
    14551563    if (RT_SUCCESS(rc))
    14561564    {
     
    14651573            pName->pObj                 = pObj;
    14661574            pName->pParent              = pParent;
     1575            pName->cbNameInDirRec       = (uint16_t)cbNameInDirRec;
    14671576            pName->cchName              = (uint16_t)cchName;
    14681577
     
    14861595            pName->cHardlinks           = 1;
    14871596            pName->INode                = pObj->idxObj;
     1597            pName->cbDirRec             = 0;
    14881598
    14891599            memcpy(pName->szName, szName, cchName);
     
    15021612                pDir->papChildren   = NULL;
    15031613                pDir->pTransTblFile = NULL;
     1614                pDir->pName         = pName;
     1615                pDir->offPathTable  = UINT32_MAX;
     1616                pDir->idPathTable   = UINT16_MAX;
     1617                RTListInit(&pDir->FinalizedEntry);
    15041618                pName->pDir = pDir;
    15051619
     
    22342348        pFile->enmSrcType   = RTFSISOMAKERSRCTYPE_INVALID;
    22352349        pFile->u.pszSrcPath = NULL;
     2350        RTListInit(&pFile->FinalizedEntry);
    22362351
    22372352        *ppFile = pFile;
     
    24812596
    24822597/**
     2598 * Gathers the dirs for an ISO-9660 namespace (e.g. primary or joliet).
     2599 *
     2600 * @param   pNamespace          The namespace.
     2601 * @param   pFinalizedDirs      The finalized directory structure.  The
     2602 *                              FinalizedDirs will be worked here.
     2603 */
     2604static void rtFsIsoMakerFinalizeGatherDirs(PRTFSISOMAKERNAMESPACE pNamespace, PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs)
     2605{
     2606    RTListInit(&pFinalizedDirs->FinalizedDirs);
     2607
     2608    /*
     2609     * Enter the root directory (if we got one).
     2610     */
     2611    if (!pNamespace->pRoot)
     2612        return;
     2613    PRTFSISOMAKERNAMEDIR pCurDir = pNamespace->pRoot->pDir;
     2614    RTListAppend(&pFinalizedDirs->FinalizedDirs, &pCurDir->FinalizedEntry);
     2615    do
     2616    {
     2617        /*
     2618         * Scan pCurDir and add directories.  We don't need to sort anything
     2619         * here because the directory is already in path table compatible order.
     2620         */
     2621        uint32_t            cLeft    = pCurDir->cChildren;
     2622        PPRTFSISOMAKERNAME  ppChild  = pCurDir->papChildren;
     2623        while (cLeft-- > 0)
     2624        {
     2625            PRTFSISOMAKERNAME pChild = *ppChild++;
     2626            if (pChild->pDir)
     2627                RTListAppend(&pFinalizedDirs->FinalizedDirs, &pChild->pDir->FinalizedEntry);
     2628        }
     2629
     2630        /*
     2631         * Advance to the next directory.
     2632         */
     2633        pCurDir = RTListGetNext(&pFinalizedDirs->FinalizedDirs, pCurDir, RTFSISOMAKERNAMEDIR, FinalizedEntry);
     2634    } while (pCurDir);
     2635}
     2636
     2637
     2638/**
     2639 * Finalizes a directory entry (i.e. namespace node).
     2640 *
     2641 * This calculates the directory record size.
     2642 *
     2643 * @returns IPRT status code.
     2644 * @param   pFinalizedDirs  .
     2645 * @param   pName           The directory entry to finalize.
     2646 * @param   offInDir        The offset in the directory of this record.
     2647 * @param   fIsRoot         Indicates whether this is the root and would
     2648 *                          therefore require more rock ridge fun and stuff.
     2649 */
     2650static int rtFsIsoMakerFinalizeIsoDirectoryEntry(PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, PRTFSISOMAKERNAME pName,
     2651                                                 uint32_t offInDir, bool fIsRoot)
     2652{
     2653    RT_NOREF(pFinalizedDirs, pName, offInDir, fIsRoot);
     2654    return VERR_NOT_IMPLEMENTED;
     2655}
     2656
     2657
     2658/**
     2659 * Finalizes either a primary and secondary ISO namespace.
     2660 *
     2661 * @returns IPRT status code
     2662 * @param   pThis           The ISO maker instance.
     2663 * @param   pNamespace      The namespace.
     2664 * @param   pFinalizedDirs  The finalized directories structure for the
     2665 *                          namespace.
     2666 * @param   poffData        The data offset.  We will allocate blocks for the
     2667 *                          directories and the path tables.
     2668 */
     2669static int rtFsIsoMakerFinalizeDirectoriesInIsoNamespace(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace,
     2670                                                         PRTFSISOMAKERFINALIZEDDIRS pFinalizedDirs, uint64_t *poffData)
     2671{
     2672    /* The directory data comes first, so take down it's offset. */
     2673    pFinalizedDirs->offDirs = *poffData;
     2674
     2675    /* Reset the rock ridge spill file, in case we someone are finalized multiple times. */
     2676    if (pFinalizedDirs->pRRSpillFile)
     2677    {
     2678        rtFsIsoMakerObjRemoveWorker(pThis, &pFinalizedDirs->pRRSpillFile->Core);
     2679        pFinalizedDirs->pRRSpillFile = NULL;
     2680    }
     2681
     2682    int      rc;
     2683    uint16_t idPathTable = 0;
     2684    uint32_t cbPathTable = 0;
     2685    if (pNamespace->pRoot)
     2686    {
     2687        /*
     2688         * Precalc the directory record size for the root directory.
     2689         */
     2690        rc = rtFsIsoMakerFinalizeIsoDirectoryEntry(pFinalizedDirs, pNamespace->pRoot, 0 /*offInDir*/, true /*fIsRoot*/);
     2691        AssertRCReturn(rc, rc);
     2692
     2693        /*
     2694         * Work thru the directories.
     2695         */
     2696        PRTFSISOMAKERNAMEDIR pCurDir;
     2697        RTListForEach(&pThis->PrimaryIsoDirs.FinalizedDirs, pCurDir, RTFSISOMAKERNAMEDIR, FinalizedEntry)
     2698        {
     2699            PRTFSISOMAKERNAME pCurName    = pCurDir->pName;
     2700            PRTFSISOMAKERNAME pParentName = pCurName->pParent ? pCurName->pParent : pCurName;
     2701
     2702            /* We don't do anything special for the special '.' and '..' directory
     2703               entries, instead we use the directory entry in the parent directory
     2704               with a 1 byte name (00 or 01). */
     2705            Assert(pCurName->cbDirRec != 0);
     2706            uint32_t offInDir = pCurName->cbDirRec    - pCurName->cbNameInDirRec    + 1;
     2707            offInDir         += pParentName->cbDirRec - pParentName->cbNameInDirRec + 1;
     2708
     2709            /* Finalize the directory entries. */
     2710            uint32_t            cbTransTbl = 0;
     2711            uint32_t            cLeft      = pCurDir->cChildren;
     2712            PPRTFSISOMAKERNAME  ppChild    = pCurDir->papChildren;
     2713            while (cLeft-- > 0)
     2714            {
     2715                PRTFSISOMAKERNAME pChild = *ppChild++;
     2716                rc = rtFsIsoMakerFinalizeIsoDirectoryEntry(pFinalizedDirs, pChild, offInDir, false /*fIsRoot*/);
     2717                AssertRCReturn(rc, rc);
     2718
     2719                offInDir += pChild->cbDirRec;
     2720                if (pChild->cchTransNm)
     2721                    cbTransTbl += 2 /* type & space*/
     2722                                + RT_MAX(pChild->cchName, 39)
     2723                                + 1 /* tab */
     2724                                + pChild->cchTransNm
     2725                                + 1 /* newline */;
     2726            }
     2727
     2728            /* Set the directory size and location, advancing the data offset. */
     2729            pCurDir->cbDir  = offInDir;
     2730            pCurDir->offDir = *poffData;
     2731            *poffData += RT_ALIGN_32(offInDir, RTFSISOMAKER_SECTOR_SIZE);
     2732
     2733            /* Set the translation table file size. */
     2734            if (pCurDir->pTransTblFile)
     2735                pCurDir->pTransTblFile->cbData = cbTransTbl;
     2736
     2737            /* Add to the path table size calculation. */
     2738            pCurDir->offPathTable = cbPathTable;
     2739            pCurDir->idPathTable  = idPathTable++;
     2740            cbPathTable += RT_OFFSETOF(ISO9660PATHREC, achDirId[pCurName->cbNameInDirRec]) + (pCurName->cbNameInDirRec & 1);
     2741        }
     2742    }
     2743
     2744    /*
     2745     * Update the rock ridge spill file size.
     2746     */
     2747    if (pFinalizedDirs->pRRSpillFile)
     2748    {
     2749        rc = RTVfsFileGetSize(pFinalizedDirs->pRRSpillFile->u.hVfsFile, &pFinalizedDirs->pRRSpillFile->cbData);
     2750        AssertRCReturn(rc, rc);
     2751        pThis->cbData += pFinalizedDirs->pRRSpillFile->cbData;
     2752    }
     2753
     2754    /*
     2755     * Calculate the path table offsets and move past them.
     2756     */
     2757    pFinalizedDirs->offPathTableL = *poffData;
     2758    *poffData += RT_ALIGN_64(cbPathTable, RTFSISOMAKER_SECTOR_SIZE);
     2759
     2760    pFinalizedDirs->offPathTableM = *poffData;
     2761    *poffData += RT_ALIGN_64(cbPathTable, RTFSISOMAKER_SECTOR_SIZE);
     2762
     2763    return VINF_SUCCESS;
     2764}
     2765
     2766
     2767
     2768/**
    24832769 * Finalizes directories and related stuff.
    24842770 *
     
    24932779static int rtFsIsoMakerFinalizeDirectories(PRTFSISOMAKERINT pThis, uint64_t *poffData)
    24942780{
    2495     RT_NOREF(pThis, poffData);
    2496     return VINF_SUCCESS;
     2781    /*
     2782     * Locate the directories, width first, inserting them in the finalized lists so
     2783     * we can process them efficiently.
     2784     */
     2785    rtFsIsoMakerFinalizeGatherDirs(&pThis->PrimaryIso, &pThis->PrimaryIsoDirs);
     2786    rtFsIsoMakerFinalizeGatherDirs(&pThis->Joliet, &pThis->JolietDirs);
     2787
     2788    /*
     2789     * Process the primary ISO and joliet namespaces.
     2790     */
     2791    int rc = rtFsIsoMakerFinalizeDirectoriesInIsoNamespace(pThis, &pThis->PrimaryIso, &pThis->PrimaryIsoDirs, poffData);
     2792    if (RT_SUCCESS(rc))
     2793        rc = rtFsIsoMakerFinalizeDirectoriesInIsoNamespace(pThis, &pThis->Joliet, &pThis->JolietDirs, poffData);
     2794    if (RT_SUCCESS(rc))
     2795    {
     2796        /*
     2797         * Later: UDF, HFS.
     2798         */
     2799    }
     2800    return rc;
    24972801}
    24982802
     
    25092813static int rtFsIsoMakerFinalizeData(PRTFSISOMAKERINT pThis, uint64_t *poffData)
    25102814{
    2511     RT_NOREF(pThis, poffData);
     2815    /*
     2816     * We currently does not have any ordering prioritizing implemented, so we
     2817     * just store files in the order they were added.
     2818     */
     2819    PRTFSISOMAKEROBJ pCur;
     2820    RTListForEach(&pThis->ObjectHead, pCur, RTFSISOMAKEROBJ, Entry)
     2821    {
     2822        if (pCur->enmType == RTFSISOMAKEROBJTYPE_FILE)
     2823        {
     2824            PRTFSISOMAKERFILE pCurFile = (PRTFSISOMAKERFILE)pCur;
     2825            if (pCurFile->offData == UINT64_MAX)
     2826            {
     2827                pCurFile->offData = *poffData;
     2828                *poffData += RT_ALIGN_64(pCurFile->cbData, RTFSISOMAKER_SECTOR_SIZE);
     2829            }
     2830        }
     2831    }
     2832
    25122833    return VINF_SUCCESS;
    25132834}
     
    25242845static int rtFsIsoMakerFinalizeVolumeDescriptors(PRTFSISOMAKERINT pThis)
    25252846{
    2526     RT_NOREF(pThis);
     2847    AssertReturn(pThis->pbVolDescs && pThis->pPrimaryVolDesc && pThis->pTerminatorVolDesc, VERR_INTERNAL_ERROR_3);
     2848
     2849    /*
     2850     * The primary descriptor.
     2851     */
     2852
     2853
     2854    /*
     2855     * The terminator record.
     2856     */
     2857    pThis->pTerminatorVolDesc->bDescType    = ISO9660VOLDESC_TYPE_TERMINATOR;
     2858    pThis->pTerminatorVolDesc->bDescVersion = 1;
     2859    memcpy(pThis->pTerminatorVolDesc->achStdId, ISO9660VOLDESC_STD_ID, sizeof(pThis->pTerminatorVolDesc->achStdId));
     2860
    25272861    return VINF_SUCCESS;
    25282862}
     
    25492883
    25502884    /*
     2885     * Allocate space for the volume descriptors.
     2886     */
     2887    RTMemFree(pThis->pbVolDescs);
     2888    pThis->pbVolDescs = (uint8_t *)RTMemAllocZ(pThis->cVolumeDescriptors * RTFSISOMAKER_SECTOR_SIZE);
     2889    AssertReturn(pThis->pbVolDescs, VERR_NO_MEMORY);
     2890
     2891    uint32_t offVolDescs = 0;
     2892
     2893    pThis->pPrimaryVolDesc = (PISO9660PRIMARYVOLDESC)&pThis->pbVolDescs[offVolDescs];
     2894    offVolDescs += RTFSISOMAKER_SECTOR_SIZE;
     2895
     2896    if (true)
     2897        pThis->pElToritoDesc = NULL;
     2898    else
     2899    {
     2900        pThis->pElToritoDesc = (PISO9660BOOTRECORD)&pThis->pbVolDescs[offVolDescs];
     2901        offVolDescs += RTFSISOMAKER_SECTOR_SIZE;
     2902    }
     2903
     2904    if (!pThis->Joliet.uLevel)
     2905        pThis->pJolietVolDesc = NULL;
     2906    else
     2907    {
     2908        pThis->pJolietVolDesc = (PISO9660SUPVOLDESC)&pThis->pbVolDescs[offVolDescs];
     2909        offVolDescs += RTFSISOMAKER_SECTOR_SIZE;
     2910    }
     2911
     2912    pThis->pTerminatorVolDesc = (PISO9660VOLDESCHDR)&pThis->pbVolDescs[offVolDescs];
     2913    offVolDescs += RTFSISOMAKER_SECTOR_SIZE;
     2914
     2915    if (pThis->Udf.uLevel > 0)
     2916    {
     2917        /** @todo UDF descriptors. */
     2918    }
     2919    AssertReturn(offVolDescs == pThis->cVolumeDescriptors * RTFSISOMAKER_SECTOR_SIZE, VERR_INTERNAL_ERROR_2);
     2920
     2921    /*
    25512922     * If there is any boot related stuff to be included, it ends up right after
    25522923     * the descriptors.
     
    25562927    if (RT_SUCCESS(rc))
    25572928    {
     2929        /*
     2930         * Directories and path tables comes next.
     2931         */
    25582932        rc = rtFsIsoMakerFinalizeDirectories(pThis, &offData);
    25592933        if (RT_SUCCESS(rc))
    25602934        {
     2935            /*
     2936             * Then we store the file data.
     2937             */
    25612938            rc = rtFsIsoMakerFinalizeData(pThis, &offData);
    25622939            if (RT_SUCCESS(rc))
     
    25652942
    25662943                /*
    2567                  * Finally, finalize the volume descriptors.
     2944                 * Finally, finalize the volume descriptors as they depend on some of the
     2945                 * block allocations done in the previous steps.
    25682946                 */
    25692947                rc = rtFsIsoMakerFinalizeVolumeDescriptors(pThis);
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