Changeset 67271 in vbox for trunk/src/VBox
- Timestamp:
- Jun 6, 2017 1:30:41 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r67270 r67271 58 58 /** The sector size. */ 59 59 #define RTFSISOMAKER_SECTOR_SIZE _2K 60 /** Maximum number of objects. */ 61 #define RTFSISOMAKER_MAX_OBJECTS _16M 60 62 61 63 … … 193 195 RTFSISOMAKERSRCTYPE_PATH, 194 196 RTFSISOMAKERSRCTYPE_VFS_IO_STREAM, 195 RTFSISOMAKERSRCTYPE_END ,197 RTFSISOMAKERSRCTYPE_END 196 198 } RTFSISOMAKERSRCTYPE; 197 199 … … 300 302 * Help for iterating over namespaces. 301 303 */ 302 st ructconst struct304 static const struct 303 305 { 304 306 /** The RTFSISOMAKERNAMESPACE_XXX indicator. */ … … 312 314 } g_aRTFsIosNamespaces[] = 313 315 { 314 { RTFSISOMAKERNAMESPACE_ISO_9660, RT_OFFSETOF(RTFSISOMAKERINT, pPrimaryIsoRoot), RT_OFFSETOF(RTFSISOMAKER NAMESPACE, pPrimaryName), "iso-9660" },315 { RTFSISOMAKERNAMESPACE_JOLIET, RT_OFFSETOF(RTFSISOMAKERINT, pJolietRoot), RT_OFFSETOF(RTFSISOMAKER NAMESPACE, pJolietName), "joliet" },316 { RTFSISOMAKERNAMESPACE_UDF, RT_OFFSETOF(RTFSISOMAKERINT, pUdfRoot), RT_OFFSETOF(RTFSISOMAKER NAMESPACE, pUdfName), "udf" },317 { RTFSISOMAKERNAMESPACE_HFS, RT_OFFSETOF(RTFSISOMAKERINT, pHfsRoot), RT_OFFSETOF(RTFSISOMAKER NAMESPACE, 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" }, 318 320 }; 319 321 … … 573 575 574 576 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 code581 * @param hIsoMaker The ISO maker handle.582 * @param pidxObj Where to return the configuration index of the583 * 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 596 577 static int rtTFsIsoMakerObjSetPathInOne(RTFSISOMAKER hIsoMaker, uint32_t idxEntry, 597 578 uint32_t fNamespace, const char *pszPath) … … 612 593 * @param hIsoMaker The ISO maker handle. 613 594 * @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). 615 597 * @param pszPath The ISO-9660 path. 616 598 */ … … 623 605 RTFSISOMAKER_ASSER_VALID_HANDLE_RET(pThis); 624 606 AssertReturn(!(fNamespaces & ~RTFSISOMAKERNAMESPACE_VALID_MASK), VERR_INVALID_FLAGS); 625 AssertPtrReturn(pszPath );607 AssertPtrReturn(pszPath, VERR_INVALID_POINTER); 626 608 AssertReturn(RTPATH_IS_SLASH(pszPath == '/'), VERR_INVALID_NAME); 627 609 PRTFSISOMAKEROBJ pObj = rtFsIsoMakerIndexToObj(pThis, idxObj); … … 646 628 647 629 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 */ 639 static 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 */ 664 RTDECL(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. 652 685 * 653 686 * @returns IPRT status code … … 655 688 * @param pszDir The path (UTF-8) to the directory in the ISO. 656 689 * 657 * @param pidx EntryWhere to return the configuration index of the690 * @param pidxObj Where to return the configuration index of the 658 691 * directory. Optional. 659 */ 660 RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxEntry) 692 * @sa RTFsIsoMakerAddUnnamedDir, RTFsIsoMakerObjSetPath 693 */ 694 RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxObj) 661 695 { 662 696 PRTFSISOMAKERINT pThis = hIsoMaker; 663 697 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.