Changeset 67842 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 6, 2017 5:27:42 PM (7 years ago)
- Location:
- trunk/src/VBox/Runtime/common/fs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r67839 r67842 4140 4140 4141 4141 /** 4142 * Allocates space in the rock ridge spill file. 4143 * 4144 * @returns Spill file offset, UINT32_MAX on failure. 4145 * @param pRRSpillFile The spill file. 4146 * @param cbRock Number of bytes to allocate. 4147 */ 4148 static uint32_t rtFsIsoMakerFinalizeAllocRockRidgeSpill(PRTFSISOMAKERFILE pRRSpillFile, uint32_t cbRock) 4149 { 4150 uint32_t off = pRRSpillFile->cbData; 4151 if (ISO9660_SECTOR_SIZE - (pRRSpillFile->cbData & ISO9660_SECTOR_OFFSET_MASK) >= cbRock) 4152 { /* likely */ } 4153 else 4154 { 4155 off |= ISO9660_SECTOR_OFFSET_MASK; 4156 off++; 4157 AssertLogRelReturn(off > 0, UINT32_MAX); 4158 pRRSpillFile->cbData = off; 4159 } 4160 pRRSpillFile->cbData += RT_ALIGN_32(cbRock, 4); 4161 return off; 4162 } 4163 4164 4165 /** 4142 4166 * Finalizes a directory entry (i.e. namespace node). 4143 4167 * … … 4202 4226 || (uint8_t)pName->szName[0] > (uint8_t)0x01) ) 4203 4227 { 4204 cbRock += (pName->cchRockRidgeNm + ISO9660RRIPNM_MAX_NAME_LEN - 1) / ISO9660RRIPNM_MAX_NAME_LEN; 4228 uint16_t cchNm = pName->cchRockRidgeNm; 4229 while (cchNm > ISO9660RRIPNM_MAX_NAME_LEN) 4230 { 4231 cbRock += (uint16_t)RT_UOFFSETOF(ISO9660RRIPNM, achName) + ISO9660RRIPNM_MAX_NAME_LEN; 4232 cchNm -= ISO9660RRIPNM_MAX_NAME_LEN; 4233 } 4234 cbRock += (uint16_t)RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchNm; 4205 4235 fFlags |= ISO9660RRIP_RR_F_NM; 4206 4236 } … … 4245 4275 pName->fRockNeedRRInSpill = uRockRidgeLevel >= 2; 4246 4276 } 4247 if (ISO9660_SECTOR_SIZE - (pFinalizedDirs->pRRSpillFile->cbData & ISO9660_SECTOR_OFFSET_MASK) < cbRock) 4248 pFinalizedDirs->pRRSpillFile->cbData = (pFinalizedDirs->pRRSpillFile->cbData | ISO9660_SECTOR_OFFSET_MASK) + 1; 4249 pName->offRockSpill = pFinalizedDirs->pRRSpillFile->cbData; 4250 pFinalizedDirs->pRRSpillFile->cbData += RT_ALIGN_T(cbRock, 4, uint16_t); 4277 pName->offRockSpill = rtFsIsoMakerFinalizeAllocRockRidgeSpill(pFinalizedDirs->pRRSpillFile, cbRock); 4278 AssertReturn(pName->offRockSpill != UINT32_MAX, VERR_ISOMK_RR_SPILL_FILE_FULL); 4251 4279 } 4252 4280 else … … 4281 4309 cbRock += ISO9660_RRIP_ER_LEN; 4282 4310 pName->cbRockSpill = cbRock; 4283 if ( ISO9660_SECTOR_SIZE - (pFinalizedDirs->pRRSpillFile->cbData & ISO9660_SECTOR_OFFSET_MASK) < cbRock) 4284 pFinalizedDirs->pRRSpillFile->cbData = (pFinalizedDirs->pRRSpillFile->cbData | ISO9660_SECTOR_OFFSET_MASK) + 1; 4285 pName->offRockSpill = pFinalizedDirs->pRRSpillFile->cbData; 4286 pFinalizedDirs->pRRSpillFile->cbData += RT_ALIGN_T(cbRock, 4, uint16_t); 4311 pName->offRockSpill = rtFsIsoMakerFinalizeAllocRockRidgeSpill(pFinalizedDirs->pRRSpillFile, cbRock); 4287 4312 } 4288 4313 } … … 4430 4455 4431 4456 /* 4432 * Update the rock ridge spill file size. 4457 * Remove rock ridge spill file if we haven't got any spill. 4458 * If we have, round the size up to a whole sector to avoid the slow path 4459 * when reading from it. 4433 4460 */ 4434 4461 if (pFinalizedDirs->pRRSpillFile) 4435 4462 { 4436 rc = RTVfsFileGetSize(pFinalizedDirs->pRRSpillFile->u.hVfsFile, &pFinalizedDirs->pRRSpillFile->cbData); 4437 AssertRCReturn(rc, rc); 4438 pThis->cbData += pFinalizedDirs->pRRSpillFile->cbData; 4463 if (pFinalizedDirs->pRRSpillFile->cbData > 0) 4464 { 4465 pFinalizedDirs->pRRSpillFile->cbData = RT_ALIGN_64(pFinalizedDirs->pRRSpillFile->cbData, ISO9660_SECTOR_SIZE); 4466 pThis->cbData += pFinalizedDirs->pRRSpillFile->cbData; 4467 } 4468 else 4469 { 4470 rc = rtFsIsoMakerObjRemoveWorker(pThis, &pFinalizedDirs->pRRSpillFile->Core); 4471 if (RT_SUCCESS(rc)) 4472 pFinalizedDirs->pRRSpillFile = NULL; 4473 } 4439 4474 } 4440 4475 … … 5328 5363 } 5329 5364 5330 if (pName->fRockEntries & ISO9660RRIP_RR_F_PX) 5331 { 5332 PISO9660RRIPPX pPX = (PISO9660RRIPPX)pbSys; 5333 Assert(cbSys >= sizeof(*pPX)); 5334 pPX->Hdr.bSig1 = ISO9660RRIPPX_SIG1; 5335 pPX->Hdr.bSig2 = ISO9660RRIPPX_SIG2; 5336 pPX->Hdr.cbEntry = ISO9660RRIPPX_LEN; 5337 pPX->Hdr.bVersion = ISO9660RRIPPX_VER; 5338 pPX->fMode.be = RT_H2BE_U32((uint32_t)pName->fMode); 5339 pPX->fMode.le = RT_H2LE_U32((uint32_t)pName->fMode); 5340 pPX->cHardlinks.be = RT_H2BE_U32((uint32_t)pName->cHardlinks); 5341 pPX->cHardlinks.le = RT_H2LE_U32((uint32_t)pName->cHardlinks); 5342 pPX->uid.be = RT_H2BE_U32((uint32_t)pName->uid); 5343 pPX->uid.le = RT_H2LE_U32((uint32_t)pName->uid); 5344 pPX->gid.be = RT_H2BE_U32((uint32_t)pName->gid); 5345 pPX->gid.le = RT_H2LE_U32((uint32_t)pName->gid); 5346 pPX->INode.be = RT_H2BE_U32((uint32_t)pName->pObj->idxObj); 5347 pPX->INode.le = RT_H2LE_U32((uint32_t)pName->pObj->idxObj); 5348 pbSys += sizeof(*pPX); 5349 cbSys -= sizeof(*pPX); 5350 } 5351 5352 if (pName->fRockEntries & ISO9660RRIP_RR_F_TF) 5353 { 5354 PISO9660RRIPTF pTF = (PISO9660RRIPTF)pbSys; 5355 pTF->Hdr.bSig1 = ISO9660RRIPTF_SIG1; 5356 pTF->Hdr.bSig2 = ISO9660RRIPTF_SIG2; 5357 pTF->Hdr.cbEntry = Iso9660RripTfCalcLength(ISO9660RRIPTF_F_BIRTH | ISO9660RRIPTF_F_MODIFY | ISO9660RRIPTF_F_ACCESS | ISO9660RRIPTF_F_CHANGE); 5358 Assert(cbSys >= pTF->Hdr.cbEntry); 5359 pTF->Hdr.bVersion = ISO9660RRIPTF_VER; 5360 pTF->fFlags = ISO9660RRIPTF_F_BIRTH | ISO9660RRIPTF_F_MODIFY | ISO9660RRIPTF_F_ACCESS | ISO9660RRIPTF_F_CHANGE; 5361 PISO9660RECTIMESTAMP paTimestamps = (PISO9660RECTIMESTAMP)&pTF->abPayload[0]; 5362 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->BirthTime, &paTimestamps[0]); 5363 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->ModificationTime, &paTimestamps[1]); 5364 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->AccessedTime, &paTimestamps[2]); 5365 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->ChangeTime, &paTimestamps[3]); 5366 cbSys += pTF->Hdr.cbEntry; 5367 pbSys += pTF->Hdr.cbEntry; 5368 } 5369 5370 if (pName->fRockEntries & ISO9660RRIP_RR_F_PN) 5371 { 5372 PISO9660RRIPPN pPN = (PISO9660RRIPPN)pbSys; 5373 Assert(cbSys >= sizeof(*pPN)); 5374 pPN->Hdr.bSig1 = ISO9660RRIPPN_SIG1; 5375 pPN->Hdr.bSig2 = ISO9660RRIPPN_SIG2; 5376 pPN->Hdr.cbEntry = ISO9660RRIPPN_LEN; 5377 pPN->Hdr.bVersion = ISO9660RRIPPN_VER; 5378 pPN->Major.be = RT_H2BE_U32((uint32_t)RTDEV_MAJOR(pName->Device)); 5379 pPN->Major.le = RT_H2LE_U32((uint32_t)RTDEV_MAJOR(pName->Device)); 5380 pPN->Minor.be = RT_H2BE_U32((uint32_t)RTDEV_MINOR(pName->Device)); 5381 pPN->Minor.le = RT_H2LE_U32((uint32_t)RTDEV_MINOR(pName->Device)); 5382 } 5383 5384 if (pName->fRockEntries & ISO9660RRIP_RR_F_NM) 5385 { 5386 size_t cchSrc = pName->cchRockRidgeNm; 5387 const char *pszSrc = pName->pszRockRidgeNm; 5388 for (;;) 5389 { 5390 size_t cchThis = RT_MIN(cchSrc, ISO9660RRIPNM_MAX_NAME_LEN); 5391 PISO9660RRIPNM pNM = (PISO9660RRIPNM)pbSys; 5392 Assert(cbSys >= RT_UOFFSETOF(ISO9660RRIPNM, achName[cchThis])); 5393 pNM->Hdr.bSig1 = ISO9660RRIPNM_SIG1; 5394 pNM->Hdr.bSig2 = ISO9660RRIPNM_SIG2; 5395 pNM->Hdr.cbEntry = (uint8_t)(RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis); 5396 pNM->Hdr.bVersion = ISO9660RRIPNM_VER; 5397 pNM->fFlags = cchThis == cchSrc ? 0 : ISO9660RRIP_NM_F_CONTINUE; 5398 memcpy(&pNM->achName[0], pszSrc, cchThis); 5399 pbSys += RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis; 5400 cbSys -= RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis; 5401 cchSrc -= cchThis; 5402 if (!cchSrc) 5403 break; 5404 } 5405 } 5406 5407 if (pName->fRockEntries & ISO9660RRIP_RR_F_SL) 5408 { 5409 AssertReturnVoid(pName->pObj->enmType == RTFSISOMAKEROBJTYPE_SYMLINK); 5410 PCRTFSISOMAKERSYMLINK pSymlink = (PCRTFSISOMAKERSYMLINK)pName->pObj; 5411 5412 ssize_t cbSlRockRidge = rtFsIsoMakerOutFile_RockRidgeGenSL(pSymlink->szTarget, pbSys, cbSys); 5413 AssertReturnVoid(cbSlRockRidge > 0); 5414 Assert(cbSys >= (size_t)cbSlRockRidge); 5415 cbSys -= (size_t)cbSlRockRidge; 5416 pbSys -= (size_t)cbSlRockRidge; 5365 /* 5366 * The following entries all end up in the spill or fully in 5367 * the directory record. 5368 */ 5369 if (fInSpill || pName->cbRockSpill == 0) 5370 { 5371 if (pName->fRockEntries & ISO9660RRIP_RR_F_PX) 5372 { 5373 PISO9660RRIPPX pPX = (PISO9660RRIPPX)pbSys; 5374 Assert(cbSys >= sizeof(*pPX)); 5375 pPX->Hdr.bSig1 = ISO9660RRIPPX_SIG1; 5376 pPX->Hdr.bSig2 = ISO9660RRIPPX_SIG2; 5377 pPX->Hdr.cbEntry = ISO9660RRIPPX_LEN; 5378 pPX->Hdr.bVersion = ISO9660RRIPPX_VER; 5379 pPX->fMode.be = RT_H2BE_U32((uint32_t)pName->fMode); 5380 pPX->fMode.le = RT_H2LE_U32((uint32_t)pName->fMode); 5381 pPX->cHardlinks.be = RT_H2BE_U32((uint32_t)pName->cHardlinks); 5382 pPX->cHardlinks.le = RT_H2LE_U32((uint32_t)pName->cHardlinks); 5383 pPX->uid.be = RT_H2BE_U32((uint32_t)pName->uid); 5384 pPX->uid.le = RT_H2LE_U32((uint32_t)pName->uid); 5385 pPX->gid.be = RT_H2BE_U32((uint32_t)pName->gid); 5386 pPX->gid.le = RT_H2LE_U32((uint32_t)pName->gid); 5387 pPX->INode.be = RT_H2BE_U32((uint32_t)pName->pObj->idxObj); 5388 pPX->INode.le = RT_H2LE_U32((uint32_t)pName->pObj->idxObj); 5389 pbSys += sizeof(*pPX); 5390 cbSys -= sizeof(*pPX); 5391 } 5392 5393 if (pName->fRockEntries & ISO9660RRIP_RR_F_TF) 5394 { 5395 PISO9660RRIPTF pTF = (PISO9660RRIPTF)pbSys; 5396 pTF->Hdr.bSig1 = ISO9660RRIPTF_SIG1; 5397 pTF->Hdr.bSig2 = ISO9660RRIPTF_SIG2; 5398 pTF->Hdr.cbEntry = Iso9660RripTfCalcLength(ISO9660RRIPTF_F_BIRTH | ISO9660RRIPTF_F_MODIFY | ISO9660RRIPTF_F_ACCESS | ISO9660RRIPTF_F_CHANGE); 5399 Assert(cbSys >= pTF->Hdr.cbEntry); 5400 pTF->Hdr.bVersion = ISO9660RRIPTF_VER; 5401 pTF->fFlags = ISO9660RRIPTF_F_BIRTH | ISO9660RRIPTF_F_MODIFY | ISO9660RRIPTF_F_ACCESS | ISO9660RRIPTF_F_CHANGE; 5402 PISO9660RECTIMESTAMP paTimestamps = (PISO9660RECTIMESTAMP)&pTF->abPayload[0]; 5403 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->BirthTime, &paTimestamps[0]); 5404 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->ModificationTime, &paTimestamps[1]); 5405 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->AccessedTime, &paTimestamps[2]); 5406 rtFsIsoMakerTimespecToIso9660RecTimestamp(&pName->pObj->ChangeTime, &paTimestamps[3]); 5407 cbSys -= pTF->Hdr.cbEntry; 5408 pbSys += pTF->Hdr.cbEntry; 5409 } 5410 5411 if (pName->fRockEntries & ISO9660RRIP_RR_F_PN) 5412 { 5413 PISO9660RRIPPN pPN = (PISO9660RRIPPN)pbSys; 5414 Assert(cbSys >= sizeof(*pPN)); 5415 pPN->Hdr.bSig1 = ISO9660RRIPPN_SIG1; 5416 pPN->Hdr.bSig2 = ISO9660RRIPPN_SIG2; 5417 pPN->Hdr.cbEntry = ISO9660RRIPPN_LEN; 5418 pPN->Hdr.bVersion = ISO9660RRIPPN_VER; 5419 pPN->Major.be = RT_H2BE_U32((uint32_t)RTDEV_MAJOR(pName->Device)); 5420 pPN->Major.le = RT_H2LE_U32((uint32_t)RTDEV_MAJOR(pName->Device)); 5421 pPN->Minor.be = RT_H2BE_U32((uint32_t)RTDEV_MINOR(pName->Device)); 5422 pPN->Minor.le = RT_H2LE_U32((uint32_t)RTDEV_MINOR(pName->Device)); 5423 cbSys -= sizeof(*pPN); 5424 pbSys += sizeof(*pPN); 5425 } 5426 5427 if (pName->fRockEntries & ISO9660RRIP_RR_F_NM) 5428 { 5429 size_t cchSrc = pName->cchRockRidgeNm; 5430 const char *pszSrc = pName->pszRockRidgeNm; 5431 for (;;) 5432 { 5433 size_t cchThis = RT_MIN(cchSrc, ISO9660RRIPNM_MAX_NAME_LEN); 5434 PISO9660RRIPNM pNM = (PISO9660RRIPNM)pbSys; 5435 Assert(cbSys >= RT_UOFFSETOF(ISO9660RRIPNM, achName[cchThis])); 5436 pNM->Hdr.bSig1 = ISO9660RRIPNM_SIG1; 5437 pNM->Hdr.bSig2 = ISO9660RRIPNM_SIG2; 5438 pNM->Hdr.cbEntry = (uint8_t)(RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis); 5439 pNM->Hdr.bVersion = ISO9660RRIPNM_VER; 5440 pNM->fFlags = cchThis == cchSrc ? 0 : ISO9660RRIP_NM_F_CONTINUE; 5441 memcpy(&pNM->achName[0], pszSrc, cchThis); 5442 pbSys += RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis; 5443 cbSys -= RT_UOFFSETOF(ISO9660RRIPNM, achName) + cchThis; 5444 cchSrc -= cchThis; 5445 if (!cchSrc) 5446 break; 5447 } 5448 } 5449 5450 if (pName->fRockEntries & ISO9660RRIP_RR_F_SL) 5451 { 5452 AssertReturnVoid(pName->pObj->enmType == RTFSISOMAKEROBJTYPE_SYMLINK); 5453 PCRTFSISOMAKERSYMLINK pSymlink = (PCRTFSISOMAKERSYMLINK)pName->pObj; 5454 5455 ssize_t cbSlRockRidge = rtFsIsoMakerOutFile_RockRidgeGenSL(pSymlink->szTarget, pbSys, cbSys); 5456 AssertReturnVoid(cbSlRockRidge > 0); 5457 Assert(cbSys >= (size_t)cbSlRockRidge); 5458 pbSys += (size_t)cbSlRockRidge; 5459 cbSys -= (size_t)cbSlRockRidge; 5460 } 5417 5461 } 5418 5462 -
trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
r67799 r67842 660 660 } 661 661 pbSys += pUnion->Hdr.cbEntry; 662 cbSys += pUnion->Hdr.cbEntry;662 cbSys -= pUnion->Hdr.cbEntry; 663 663 664 664 /* … … 678 678 case MAKE_SIG(ISO9660SUSPCE_SIG1, ISO9660SUSPCE_SIG2): 679 679 { 680 __debugbreak(); 680 681 if (RT_BE2H_U32(pUnion->CE.offBlock.be) != RT_LE2H_U32(pUnion->CE.offBlock.le)) 681 682 LogRel(("rtFsIsoImport/Rock: Invalid CE offBlock field: be=%#x vs le=%#x\n", … … 756 757 || (pUnion->ER.cchIdentifier >= 10 && strncmp(pUnion->ER.achPayload, RT_STR_TUPLE(ISO9660_RRIP_1_12_ID)) == 0) )) 757 758 { 758 pObjInfo->Attr.u.Unix.fFlags |= RT_BIT_32(31); /** @todo define RRIP ER entry flag. Or do we call the maker? */759 //pObjInfo->Attr.u.Unix.fFlags |= RT_BIT_32(31); /** @todo define RRIP ER entry flag. Or do we call the maker? */ 759 760 LogRel(("rtFsIsoImport/Rock: Rock Ridge 'ER' entry: v%u id='%.*s' desc='%.*s' source='%.*s'\n", 760 761 pUnion->ER.bVersion, pUnion->ER.cchIdentifier, pUnion->ER.achPayload, … … 777 778 * Rock ridge interchange protocol entries. 778 779 */ 780 case MAKE_SIG(ISO9660RRIPRR_SIG1, ISO9660RRIPRR_SIG2): /* RR */ 781 if ( pUnion->RR.Hdr.cbEntry != ISO9660RRIPRR_LEN 782 || pUnion->RR.Hdr.bVersion != ISO9660RRIPRR_VER) 783 LogRel(("rtFsIsoImport/Rock: Malformed 'RR' entry: cbEntry=%#x (vs %#x), bVersion=%#x (vs %#x) fFlags=%#x\n", 784 pUnion->RR.Hdr.cbEntry, ISO9660RRIPRR_LEN, pUnion->RR.Hdr.bVersion, ISO9660RRIPRR_VER, pUnion->RR.fFlags)); 785 /* else: ignore it */ 786 break; 787 779 788 case MAKE_SIG(ISO9660RRIPPX_SIG1, ISO9660RRIPPX_SIG2): /* PX */ 780 if ( pUnion->PX.Hdr.cbEntry != ISO9660RRIPPX_LEN 789 if ( ( pUnion->PX.Hdr.cbEntry != ISO9660RRIPPX_LEN 790 && pUnion->PX.Hdr.cbEntry != ISO9660RRIPPX_LEN_NO_INODE) 781 791 || pUnion->PX.Hdr.bVersion != ISO9660RRIPPX_VER 782 792 || RT_BE2H_U32(pUnion->PX.fMode.be) != RT_LE2H_U32(pUnion->PX.fMode.le) 783 793 || RT_BE2H_U32(pUnion->PX.cHardlinks.be) != RT_LE2H_U32(pUnion->PX.cHardlinks.le) 784 794 || RT_BE2H_U32(pUnion->PX.uid.be) != RT_LE2H_U32(pUnion->PX.uid.le) 785 || RT_BE2H_U32(pUnion->PX.gid.be) != RT_LE2H_U32(pUnion->PX.gid.le) ) 786 LogRel(("rtFsIsoImport/Rock: Malformed 'PX' entry: cbEntry=%#x (vs %#x), bVersion=%#x (vs %#x) fMode=%#x/%#x cHardlinks=%#x/%#x uid=%#x/%#x gid=%#x/%#x\n", 787 pUnion->PX.Hdr.cbEntry, ISO9660RRIPPX_LEN, pUnion->PX.Hdr.bVersion, ISO9660RRIPPX_VER, 795 || RT_BE2H_U32(pUnion->PX.gid.be) != RT_LE2H_U32(pUnion->PX.gid.le) 796 || ( pUnion->PX.Hdr.cbEntry == ISO9660RRIPPX_LEN 797 && RT_BE2H_U32(pUnion->PX.INode.be) != RT_LE2H_U32(pUnion->PX.INode.le)) ) 798 LogRel(("rtFsIsoImport/Rock: Malformed 'PX' entry: cbEntry=%#x (vs %#x or %#x), bVersion=%#x (vs %#x) fMode=%#x/%#x cHardlinks=%#x/%#x uid=%#x/%#x gid=%#x/%#x inode=%#x/%#x\n", 799 pUnion->PX.Hdr.cbEntry, ISO9660RRIPPX_LEN, ISO9660RRIPPX_LEN_NO_INODE, 800 pUnion->PX.Hdr.bVersion, ISO9660RRIPPX_VER, 788 801 RT_BE2H_U32(pUnion->PX.fMode.be), RT_LE2H_U32(pUnion->PX.fMode.le), 789 802 RT_BE2H_U32(pUnion->PX.cHardlinks.be), RT_LE2H_U32(pUnion->PX.cHardlinks.le), 790 803 RT_BE2H_U32(pUnion->PX.uid.be), RT_LE2H_U32(pUnion->PX.uid.le), 791 RT_BE2H_U32(pUnion->PX.gid.be), RT_LE2H_U32(pUnion->PX.gid.le) )); 804 RT_BE2H_U32(pUnion->PX.gid.be), RT_LE2H_U32(pUnion->PX.gid.le), 805 pUnion->PX.Hdr.cbEntry == ISO9660RRIPPX_LEN ? RT_BE2H_U32(pUnion->PX.INode.be) : 0, 806 pUnion->PX.Hdr.cbEntry == ISO9660RRIPPX_LEN ? RT_LE2H_U32(pUnion->PX.INode.le) : 0 )); 792 807 else 793 808 { … … 800 815 pObjInfo->Attr.u.Unix.uid = ISO9660_GET_ENDIAN(&pUnion->PX.uid); 801 816 pObjInfo->Attr.u.Unix.gid = ISO9660_GET_ENDIAN(&pUnion->PX.gid); 817 /* ignore inode */ 802 818 } 803 819 break; … … 874 890 } 875 891 } 876 877 LogRel(("rtFsIsoImport/Rock: Sparse file support not yet implemented!\n"));878 892 break; 879 893 … … 1052 1066 1053 1067 /** 1068 * Deals with the special '.' entry in the root directory. 1069 * 1070 * @returns IPRT status code. 1071 * @param pThis The import instance. 1072 * @param pDirRec The root directory record. 1073 */ 1074 static int rtFsIsoImportProcessIso9660TreeWorkerDoRockForRoot(PRTFSISOMKIMPORTER pThis, PCISO9660DIRREC pDirRec) 1075 { 1076 uint8_t const cbSys = pDirRec->cbDirRec - RT_UOFFSETOF(ISO9660DIRREC, achFileId) 1077 - pDirRec->bFileIdLength - !(pDirRec->bFileIdLength & 1); 1078 uint8_t const * const pbSys = (uint8_t const *)&pDirRec->achFileId[pDirRec->bFileIdLength + !(pDirRec->bFileIdLength & 1)]; 1079 if (cbSys > 4) 1080 { 1081 RTFSOBJINFO ObjInfo; 1082 ObjInfo.cbObject = 0; 1083 ObjInfo.cbAllocated = 0; 1084 rtFsIsoImpIso9660RecDateTime2TimeSpec(&ObjInfo.AccessTime, &pDirRec->RecTime); 1085 ObjInfo.ModificationTime = ObjInfo.AccessTime; 1086 ObjInfo.ChangeTime = ObjInfo.AccessTime; 1087 ObjInfo.BirthTime = ObjInfo.AccessTime; 1088 ObjInfo.Attr.fMode = RTFS_TYPE_DIRECTORY | RTFS_DOS_DIRECTORY | 0555; 1089 ObjInfo.Attr.enmAdditional = RTFSOBJATTRADD_UNIX; 1090 ObjInfo.Attr.u.Unix.uid = NIL_RTUID; 1091 ObjInfo.Attr.u.Unix.gid = NIL_RTGID; 1092 ObjInfo.Attr.u.Unix.cHardlinks = 2; 1093 ObjInfo.Attr.u.Unix.INodeIdDevice = 0; 1094 ObjInfo.Attr.u.Unix.INodeId = 0; 1095 ObjInfo.Attr.u.Unix.fFlags = 0; 1096 ObjInfo.Attr.u.Unix.GenerationId = 0; 1097 ObjInfo.Attr.u.Unix.Device = 0; 1098 1099 rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(pThis, &ObjInfo, pbSys, cbSys, 1100 false /*fContinuationRecord*/, true /*fIsFirstDirRec*/); 1101 /** @todo Update root dir attribs. Need API. */ 1102 } 1103 return VINF_SUCCESS; 1104 } 1105 1106 1107 /** 1054 1108 * Validates a directory record. 1055 1109 * 1056 1110 * @returns IPRT status code (safe to ignore, see pThis->rc). 1057 1111 * @param pThis The importer instance. 1058 * @param pDirRec The rootdirectory record to validate.1112 * @param pDirRec The directory record to validate. 1059 1113 * @param cbMax The maximum size. 1060 1114 */ … … 1275 1329 if (RT_FAILURE(rc)) 1276 1330 return rc; 1331 if ( cDepth == 0 1332 && !(pThis->fFlags & RTFSISOMK_IMPORT_F_NO_ROCK_RIDGE) 1333 && pDirRec->cbDirRec > RT_UOFFSETOF(ISO9660DIRREC, achFileId[1])) 1334 { 1335 rc = rtFsIsoImportProcessIso9660TreeWorkerDoRockForRoot(pThis, pDirRec); 1336 if (RT_FAILURE(rc)) 1337 return rc; 1338 } 1277 1339 1278 1340 cbChunk -= pDirRec->cbDirRec;
Note:
See TracChangeset
for help on using the changeset viewer.