VirtualBox

Changeset 67271 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 6, 2017 1:30:41 PM (8 years ago)
Author:
vboxsync
Message:

post meeting

File:
1 edited

Legend:

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

    r67270 r67271  
    5858/** The sector size. */
    5959#define RTFSISOMAKER_SECTOR_SIZE            _2K
     60/** Maximum number of objects. */
     61#define RTFSISOMAKER_MAX_OBJECTS            _16M
    6062
    6163
     
    193195    RTFSISOMAKERSRCTYPE_PATH,
    194196    RTFSISOMAKERSRCTYPE_VFS_IO_STREAM,
    195     RTFSISOMAKERSRCTYPE_END,
     197    RTFSISOMAKERSRCTYPE_END
    196198} RTFSISOMAKERSRCTYPE;
    197199
     
    300302 * Help for iterating over namespaces.
    301303 */
    302 struct const struct
     304static const struct
    303305{
    304306    /** The RTFSISOMAKERNAMESPACE_XXX indicator.  */
     
    312314} g_aRTFsIosNamespaces[] =
    313315{
    314     {   RTFSISOMAKERNAMESPACE_ISO_9660, RT_OFFSETOF(RTFSISOMAKERINT, pPrimaryIsoRoot), RT_OFFSETOF(RTFSISOMAKERNAMESPACE, pPrimaryName), "iso-9660" },
    315     {   RTFSISOMAKERNAMESPACE_JOLIET,   RT_OFFSETOF(RTFSISOMAKERINT, pJolietRoot),     RT_OFFSETOF(RTFSISOMAKERNAMESPACE, pJolietName),  "joliet" },
    316     {   RTFSISOMAKERNAMESPACE_UDF,      RT_OFFSETOF(RTFSISOMAKERINT, pUdfRoot),        RT_OFFSETOF(RTFSISOMAKERNAMESPACE, pUdfName),     "udf" },
    317     {   RTFSISOMAKERNAMESPACE_HFS,      RT_OFFSETOF(RTFSISOMAKERINT, pHfsRoot),        RT_OFFSETOF(RTFSISOMAKERNAMESPACE, pHfsName),     "hfs" },
     316    {   RTFSISOMAKERNAMESPACE_ISO_9660, RT_OFFSETOF(RTFSISOMAKERINT, pPrimaryIsoRoot), RT_OFFSETOF(RTFSISOMAKEROBJ, pPrimaryName), "iso-9660" },
     317    {   RTFSISOMAKERNAMESPACE_JOLIET,   RT_OFFSETOF(RTFSISOMAKERINT, pJolietRoot),     RT_OFFSETOF(RTFSISOMAKEROBJ, pJolietName),  "joliet" },
     318    {   RTFSISOMAKERNAMESPACE_UDF,      RT_OFFSETOF(RTFSISOMAKERINT, pUdfRoot),        RT_OFFSETOF(RTFSISOMAKEROBJ, pUdfName),     "udf" },
     319    {   RTFSISOMAKERNAMESPACE_HFS,      RT_OFFSETOF(RTFSISOMAKERINT, pHfsRoot),        RT_OFFSETOF(RTFSISOMAKEROBJ, pHfsName),     "hfs" },
    318320};
    319321
     
    573575
    574576
    575 /**
    576  * Adds an unnamed directory to the image.
    577  *
    578  * The directory must explictly be entered into the desired namespaces.
    579  *
    580  * @returns IPRT status code
    581  * @param   hIsoMaker           The ISO maker handle.
    582  * @param   pidxObj             Where to return the configuration index of the
    583  *                              directory.
    584  */
    585 RTDECL(int) RTFsIsoMakerAddUnnamedDir(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj)
    586 {
    587     PRTFSISOMAKERINT pThis = hIsoMaker;
    588     RTFSISOMAKER_ASSER_VALID_HANDLE_RET(pThis);
    589     AssertPtr(pidxObj);
    590 
    591 
    592 
    593     return VINF_SUCCESS;
    594 }
    595 
    596577static int rtTFsIsoMakerObjSetPathInOne(RTFSISOMAKER hIsoMaker, uint32_t idxEntry,
    597578                                        uint32_t fNamespace, const char *pszPath)
     
    612593 * @param   hIsoMaker           The ISO maker handle.
    613594 * @param   idxObj              The configuration index of to name.
    614  * @param   fNamespaces         The namespaces to apply the path to.
     595 * @param   fNamespaces         The namespaces to apply the path to
     596 *                              (RTFSISOMAKERNAMESPACE_XXX).
    615597 * @param   pszPath             The ISO-9660 path.
    616598 */
     
    623605    RTFSISOMAKER_ASSER_VALID_HANDLE_RET(pThis);
    624606    AssertReturn(!(fNamespaces & ~RTFSISOMAKERNAMESPACE_VALID_MASK), VERR_INVALID_FLAGS);
    625     AssertPtrReturn(pszPath);
     607    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
    626608    AssertReturn(RTPATH_IS_SLASH(pszPath == '/'), VERR_INVALID_NAME);
    627609    PRTFSISOMAKEROBJ pObj = rtFsIsoMakerIndexToObj(pThis, idxObj);
     
    646628
    647629
    648 
    649 
    650 /**
    651  * Adds a directory to the image.
     630/**
     631 * Initalizes the common part of a file system object and links it into global
     632 * chain.
     633 *
     634 * @returns IPRT status code
     635 * @param   pThis               The ISO maker instance.
     636 * @param   pObj                The common object.
     637 * @param   enmType             The object type.
     638 */
     639static void rtFsIsoMakerInitCommonObj(PRTFSISOMAKERINT pThis, PRTFSISOMAKEROBJ pObj, RTFSISOMAKEROBJTYPE enmType)
     640{
     641    AssertReturn(pThis->cObjects < RTFSISOMAKER_MAX_OBJECTS, VERR_OUT_OF_RANGE);
     642    pObj->enmType       = enmType;
     643    pObj->pPrimaryName  = NULL;
     644    pObj->pJolietName   = NULL;
     645    pObj->pUdfName      = NULL;
     646    pObj->pHfsName      = NULL;
     647    pObj->idxObj        = pThis->cObjects++;
     648    RTListAppend(&pThis->ObjectHead, &pObj->Entry);
     649    return VINF_SUCCESS;
     650}
     651
     652
     653/**
     654 * Adds an unnamed directory to the image.
     655 *
     656 * The directory must explictly be entered into the desired namespaces.
     657 *
     658 * @returns IPRT status code
     659 * @param   hIsoMaker           The ISO maker handle.
     660 * @param   pidxObj             Where to return the configuration index of the
     661 *                              directory.
     662 * @sa      RTFsIsoMakerAddDir, RTFsIsoMakerObjSetPath
     663 */
     664RTDECL(int) RTFsIsoMakerAddUnnamedDir(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj)
     665{
     666    PRTFSISOMAKERINT pThis = hIsoMaker;
     667    RTFSISOMAKER_ASSER_VALID_HANDLE_RET(pThis);
     668    AssertPtrReturn(pidxObj, VERR_INVALID_POINTER);
     669
     670    PRTFSISOMAKERDIR pDir = (PRTFSISOMAKERDIR)RTMemAllocZ(sizeof(*pDir));
     671    AssertReturn(pDir, VERR_NO_MEMORY);
     672    int rc = rtFsIsoMakerInitCommonObj(&pDir->Core, RTFSISOMAKEROBJTYPE_DIR);
     673    if (RT_SUCCESS(rc))
     674    {
     675        *pidxObj = pObj->idxObj;
     676        return VINF_SUCCESS;
     677    }
     678    RTMemFree(pDir);
     679    return rc;
     680}
     681
     682
     683/**
     684 * Adds a directory to the image in all namespaces and default attributes.
    652685 *
    653686 * @returns IPRT status code
     
    655688 * @param   pszDir              The path (UTF-8) to the directory in the ISO.
    656689 *
    657  * @param   pidxEntry           Where to return the configuration index of the
     690 * @param   pidxObj             Where to return the configuration index of the
    658691 *                              directory.  Optional.
    659  */
    660 RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxEntry)
     692 * @sa      RTFsIsoMakerAddUnnamedDir, RTFsIsoMakerObjSetPath
     693 */
     694RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxObj)
    661695{
    662696    PRTFSISOMAKERINT pThis = hIsoMaker;
    663697    RTFSISOMAKER_ASSER_VALID_HANDLE_RET(pThis);
    664 
    665 
    666     AssertReturn(!pThis->fSeenContent, VERR_WRONG_ORDER);
    667     AssertReturn(uLevel <= 2, VERR_INVALID_PARAMETER);
    668 
    669     pThis->uJolietRockRidgeLevel = uLevel;
    670     return VINF_SUCCESS;
    671 }
    672 
     698    AssertPtrReturn(pszDir, VERR_INVALID_POINTER);
     699    AssertReturn(RTPATH_IS_SLASH(pszPath == '/'), VERR_INVALID_NAME);
     700
     701    uint32_t idxObj;
     702    int rc = RTFsIsoMakerAddUnnamedDir(hIsoMaker, &idxObj);
     703    if (RT_SUCCESS(rc))
     704    {
     705        rc = RTFsIsoMakerObjSetPath(hIsoMaker, idxObj, RTFSISOMAKERNAMESPACE_ALL);
     706        if (RT_SUCCESS(rc))
     707        {
     708            if (pidxObj)
     709                *pidxObj = idxObj;
     710        }
     711        /** @todo else: back out later?  */
     712    }
     713    return rc;
     714}
     715
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