Changeset 67502 in vbox
- Timestamp:
- Jun 20, 2017 11:59:43 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/fsisomaker.h
r67491 r67502 406 406 * @param hIsoMaker The ISO maker handle. 407 407 * @param pszIso Path to the existing image to import / clone. 408 * This is fed to RTVfsChainOpenFile. 408 409 * @param fFlags Reserved for the future, MBZ. 410 * @param poffError Where to return the position in @a pszIso 411 * causing trouble when opening it for reading. 412 * Optional. 409 413 * @param pErrInfo Where to return additional error information. 410 414 * Optional. 411 415 */ 412 RTDECL(int) RTFsIsoMakerImport(RTFSISOMAKER hIsoMaker, const char *pszIso, uint32_t fFlags, PRTERRINFO pErrInfo); 416 RTDECL(int) RTFsIsoMakerImport(RTFSISOMAKER hIsoMaker, const char *pszIso, uint32_t fFlags, 417 uint32_t *poffError, PRTERRINFO pErrInfo); 413 418 414 419 /** @name RTFSISOMK_IMPORT_F_XXX - Flags for RTFsIsoMakerImport. -
trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp
r67461 r67502 95 95 RTFSISOMAKERCMD_OPT_NAME_SETUP, 96 96 RTFSISOMAKERCMD_OPT_NO_JOLIET, 97 RTFSISOMAKERCMD_OPT_IMPORT_ISO, 97 98 98 99 RTFSISOMAKERCMD_OPT_ELTORITO_NEW_ENTRY, … … 414 415 { "--name-setup", RTFSISOMAKERCMD_OPT_NAME_SETUP, RTGETOPT_REQ_STRING }, 415 416 { "--no-joliet", RTFSISOMAKERCMD_OPT_NO_JOLIET, RTGETOPT_REQ_NOTHING }, 417 { "--import-iso", RTFSISOMAKERCMD_OPT_IMPORT_ISO, RTGETOPT_REQ_STRING }, 418 416 419 { "--eltorito-new-entry", RTFSISOMAKERCMD_OPT_ELTORITO_NEW_ENTRY, RTGETOPT_REQ_NOTHING }, 417 420 { "--eltorito-add-image", RTFSISOMAKERCMD_OPT_ELTORITO_ADD_IMAGE, RTGETOPT_REQ_NOTHING }, … … 1386 1389 1387 1390 /** 1391 * Deals with the --import-iso {iso-file-spec} options. 1392 * 1393 * @returns IPRT status code 1394 * @param pOpts The ISO maker command instance. 1395 * @param pszIsoSpec The ISO path specifier. 1396 */ 1397 static int rtFsIsoMakerCmdOptImportIso(PRTFSISOMAKERCMDOPTS pOpts, const char *pszIsoSpec) 1398 { 1399 uint32_t offError = UINT32_MAX; 1400 RTERRINFOSTATIC ErrInfo; 1401 int rc = RTFsIsoMakerImport(pOpts->hIsoMaker, pszIsoSpec, 0 /*fFlags*/, &offError, RTErrInfoInitStatic(&ErrInfo)); 1402 if (RT_SUCCESS(rc)) 1403 return rc; 1404 if (offError != UINT32_MAX) 1405 return rtFsIsoMakerCmdChainError(pOpts, "RTFsIsoMakerImport", pszIsoSpec, rc, offError, &ErrInfo.Core); 1406 if (RTErrInfoIsSet(&ErrInfo.Core)) 1407 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTFsIsoMakerImport failed: %Rrc - %s", rc, ErrInfo.Core.pszMsg); 1408 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "RTFsIsoMakerImport failed: %Rrc", rc); 1409 } 1410 1411 1412 /** 1388 1413 * Deals with: -G|--generic-boot {file} 1389 1414 * … … 1949 1974 case RTFSISOMAKERCMD_OPT_IPRT_ISO_MAKER_FILE_MARKER: 1950 1975 /* ignored */ 1976 break; 1977 1978 case RTFSISOMAKERCMD_OPT_IMPORT_ISO: 1979 rc = rtFsIsoMakerCmdOptImportIso(&Opts, ValueUnion.psz); 1951 1980 break; 1952 1981 -
trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
r67485 r67502 327 327 328 328 static int rtFsIsoImportProcessIso9660TreeWorker(PRTFSISOMKIMPORTER pThis, uint32_t idxDir, 329 uint32_t offDirBlock, uint32_t cbDir, uint8_t cDepth, bool fUnicode) 329 uint32_t offDirBlock, uint32_t cbDir, uint8_t cDepth, bool fUnicode, 330 PRTLISTANCHOR pTodoList) 330 331 { 331 332 /* … … 420 421 * likely to get error with subsequent record too. 421 422 */ 423 Log3(("pDirRec=%p @%#010RX64 cb=%#04x ff=%#04x off=%#010RX32 cb=%#010RX32 id=%.*Rhxs\n", pDirRec, off - cbChunk, pDirRec->cbDirRec, pDirRec->fFileFlags, 424 ISO9660_GET_ENDIAN(&pDirRec->offExtent), ISO9660_GET_ENDIAN(&pDirRec->cbData), pDirRec->bFileIdLength, pDirRec->achFileId)); 422 425 rc = rtFsIsoImportValidateDirRec(pThis, pDirRec, cbChunk); 423 426 if (RT_FAILURE(rc)) … … 463 466 * Add the object and enter it into the namespace. 464 467 */ 465 uint32_t idxObj = UINT32_MAX; 468 PRTFSISOMKIMPBLOCK2FILE pBlock2File = NULL; 469 uint32_t idxObj = UINT32_MAX; 466 470 if (pDirRec->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY) 467 471 rc = RTFsIsoMakerAddUnnamedDir(pThis->hIsoMaker, &idxObj); 468 472 else 469 473 { 470 rc = VERR_NOT_IMPLEMENTED; /** @todo need new file add function */ 474 /* Add the common source file if we haven't done that already. */ 475 if (pThis->idxSrcFile != UINT32_MAX) 476 { /* likely */ } 477 else 478 { 479 rc = RTFsIsoMakerAddCommonSourceFile(pThis->hIsoMaker, pThis->hSrcFile, &pThis->idxSrcFile); 480 if (RT_FAILURE(rc)) 481 return rtFsIsoImpError(pThis, rc, "RTFsIsoMakerAddCommonSourceFile failed: %Rrc", rc); 482 Assert(pThis->idxSrcFile != UINT32_MAX); 483 } 484 485 pBlock2File = (PRTFSISOMKIMPBLOCK2FILE)RTAvlU32Get(&pThis->Block2FileRoot, ISO9660_GET_ENDIAN(&pDirRec->offExtent)); 486 if (!pBlock2File) 487 rc = RTFsIsoMakerAddUnnamedFileWithCommonSrc(pThis->hIsoMaker, pThis->idxSrcFile, 488 ISO9660_GET_ENDIAN(&pDirRec->offExtent) * ISO9660_SECTOR_SIZE, 489 ISO9660_GET_ENDIAN(&pDirRec->cbData), NULL /*pObjInfo*/, &idxObj); 490 else 491 { 492 idxObj = pBlock2File->idxObj; 493 rc = VINF_SUCCESS; 494 } 471 495 } 472 496 if (RT_SUCCESS(rc)) … … 481 505 * directory push it onto the traversal stack. 482 506 */ 507 if (pDirRec->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY) 508 { 509 PRTFSISOMKIMPDIR pImpDir = (PRTFSISOMKIMPDIR)RTMemAlloc(sizeof(*pImpDir)); 510 AssertReturn(pImpDir, rtFsIsoImpError(pThis, VERR_NO_MEMORY, "Could not allocate RTFSISOMKIMPDIR")); 511 pImpDir->cbDir = ISO9660_GET_ENDIAN(&pDirRec->cbData); 512 pImpDir->offDirBlock = ISO9660_GET_ENDIAN(&pDirRec->offExtent); 513 pImpDir->idxObj = idxObj; 514 pImpDir->cDepth = cDepth + 1; 515 RTListAppend(pTodoList, &pImpDir->Entry); 516 } 517 else if (!pBlock2File) 518 { 519 pBlock2File = (PRTFSISOMKIMPBLOCK2FILE)RTMemAlloc(sizeof(*pBlock2File)); 520 AssertReturn(pBlock2File, rtFsIsoImpError(pThis, VERR_NO_MEMORY, "Could not allocate RTFSISOMKIMPBLOCK2FILE")); 521 pBlock2File->idxObj = idxObj; 522 pBlock2File->Core.Key = ISO9660_GET_ENDIAN(&pDirRec->offExtent); 523 bool fRc = RTAvlU32Insert(&pThis->Block2FileRoot, &pBlock2File->Core); 524 Assert(fRc); RT_NOREF(fRc); 525 } 483 526 } 484 527 else … … 486 529 off - cbChunk, pDirRec->bFileIdLength, pDirRec->achFileId); 487 530 } 531 else 532 rtFsIsoImpError(pThis, rc, "Error adding '%s' (fFileFlags=%#x): %Rrc", 533 pThis->szNameBuf, pDirRec->fFileFlags, rc); 488 534 } 489 535 else 490 536 rtFsIsoImpError(pThis, rc, "Invalid name at %#RX64: %.Rhxs", 491 537 off - cbChunk, pDirRec->bFileIdLength, pDirRec->achFileId); 538 539 /* 540 * Advance to the next directory record. 541 */ 542 cbChunk -= pDirRec->cbDirRec; 543 pDirRec = (PCISO9660DIRREC)((uintptr_t)pDirRec + pDirRec->cbDirRec); 492 544 } 493 545 … … 504 556 if (idxDir == UINT32_MAX) 505 557 { 558 idxDir = RTFSISOMAKER_CFG_IDX_ROOT; 506 559 int rc = RTFsIsoMakerObjSetPath(pThis->hIsoMaker, RTFSISOMAKER_CFG_IDX_ROOT, RTFSISOMAKER_NAMESPACE_ISO_9660, "/"); 507 560 if (RT_FAILURE(rc)) … … 519 572 for (;;) 520 573 { 521 int rc2 = rtFsIsoImportProcessIso9660TreeWorker(pThis, idxDir, offDirBlock, cbDir, cDepth, fUnicode );574 int rc2 = rtFsIsoImportProcessIso9660TreeWorker(pThis, idxDir, offDirBlock, cbDir, cDepth, fUnicode, &TodoList); 522 575 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 523 576 rc = rc2; … … 700 753 * @param hIsoMaker The ISO maker handle. 701 754 * @param pszIso Path to the existing image to import / clone. 755 * This is fed to RTVfsChainOpenFile. 702 756 * @param fFlags Reserved for the future, MBZ. 757 * @param poffError Where to return the position in @a pszIso 758 * causing trouble when opening it for reading. 759 * Optional. 703 760 * @param pErrInfo Where to return additional error information. 704 761 * Optional. 705 762 */ 706 RTDECL(int) RTFsIsoMakerImport(RTFSISOMAKER hIsoMaker, const char *pszIso, uint32_t fFlags, PRTERRINFO pErrInfo) 763 RTDECL(int) RTFsIsoMakerImport(RTFSISOMAKER hIsoMaker, const char *pszIso, uint32_t fFlags, 764 uint32_t *poffError, PRTERRINFO pErrInfo) 707 765 { 708 766 /* … … 715 773 */ 716 774 RTVFSFILE hSrcFile; 717 uint32_t offError; 718 int rc = RTVfsChainOpenFile(pszIso, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hSrcFile, &offError, pErrInfo); 775 int rc = RTVfsChainOpenFile(pszIso, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hSrcFile, poffError, pErrInfo); 719 776 if (RT_FAILURE(rc)) 720 777 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.