mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcAppleDiskImageLib: Only store SectorCount rather than Trailer in Context.
This commit is contained in:
parent
ce0c2cf1c2
commit
3672891504
@ -23,8 +23,8 @@ typedef struct {
|
||||
UINT8 *Buffer;
|
||||
UINTN Length;
|
||||
|
||||
// Disk image info.
|
||||
APPLE_DISK_IMAGE_TRAILER Trailer;
|
||||
UINT64 SectorCount;
|
||||
|
||||
UINT32 BlockCount;
|
||||
APPLE_DISK_IMAGE_BLOCK_DATA **Blocks;
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ DiskImageBlockIoReadBlocks (
|
||||
|
||||
DiskImageData = OC_APPLE_DISK_IMAGE_MOUNTED_DATA_FROM_THIS (This);
|
||||
|
||||
if (Lba >= DiskImageData->ImageContext->Trailer.SectorCount) {
|
||||
if (Lba >= DiskImageData->ImageContext->SectorCount) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ OcAppleDiskImageInstallBlockIo (
|
||||
DiskImageData->BlockIoMedia.MediaPresent = TRUE;
|
||||
DiskImageData->BlockIoMedia.ReadOnly = TRUE;
|
||||
DiskImageData->BlockIoMedia.BlockSize = APPLE_DISK_IMAGE_SECTOR_SIZE;
|
||||
DiskImageData->BlockIoMedia.LastBlock = (Context->Trailer.SectorCount - 1);
|
||||
DiskImageData->BlockIoMedia.LastBlock = (Context->SectorCount - 1);
|
||||
|
||||
InternalConstructDmgDevicePath (DiskImageData, RamDmgAddress);
|
||||
|
||||
|
||||
@ -207,11 +207,11 @@ OcAppleDiskImageInitializeContext (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DmgContext->Buffer = BufferBytes;
|
||||
DmgContext->Length = (TrailerOffset + sizeof (DmgContext->Trailer));
|
||||
DmgContext->BlockCount = DmgBlockCount;
|
||||
DmgContext->Blocks = DmgBlocks;
|
||||
CopyMem (&DmgContext->Trailer, &Trailer, sizeof (DmgContext->Trailer));
|
||||
DmgContext->Buffer = BufferBytes;
|
||||
DmgContext->Length = (TrailerOffset + sizeof (Trailer));
|
||||
DmgContext->BlockCount = DmgBlockCount;
|
||||
DmgContext->Blocks = DmgBlocks;
|
||||
DmgContext->SectorCount = Trailer.SectorCount;
|
||||
|
||||
*Context = DmgContext;
|
||||
|
||||
@ -264,7 +264,7 @@ OcAppleDiskImageRead (
|
||||
|
||||
ASSERT (Context != NULL);
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (Lba < Context->Trailer.SectorCount);
|
||||
ASSERT (Lba < Context->SectorCount);
|
||||
|
||||
LbaCurrent = Lba;
|
||||
RemainingBufferSize = BufferSize;
|
||||
|
||||
@ -70,7 +70,7 @@ int main (int argc, char *argv[]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
UncompSize = (DmgContext->Trailer.SectorCount * APPLE_DISK_IMAGE_SECTOR_SIZE);
|
||||
UncompSize = (DmgContext->SectorCount * APPLE_DISK_IMAGE_SECTOR_SIZE);
|
||||
UncompDmg = malloc (UncompSize);
|
||||
if (UncompDmg == NULL) {
|
||||
printf ("DMG data allocation failed.\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user