//\r
// Vendor-Defined Device Path GUID for UDF file system\r
//\r
-EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;\r
+EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;\r
\r
/**\r
Find the anchor volume descriptor pointer.\r
UINTN Index;\r
UDF_DESCRIPTOR_TAG *DescriptorTag;\r
\r
- BlockSize = BlockIo->Media->BlockSize;\r
- EndLBA = BlockIo->Media->LastBlock;\r
+ BlockSize = BlockIo->Media->BlockSize;\r
+ EndLBA = BlockIo->Media->LastBlock;\r
DescriptorLBAs[0] = 256;\r
DescriptorLBAs[1] = EndLBA - 256;\r
DescriptorLBAs[2] = EndLBA;\r
\r
for (Index = 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) {\r
Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (DescriptorLBAs[Index], BlockSize),\r
- sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER),\r
- (VOID *)AnchorPoint\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (DescriptorLBAs[Index], BlockSize),\r
+ sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER),\r
+ (VOID *)AnchorPoint\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
return EFI_SUCCESS;\r
}\r
}\r
+\r
//\r
// No AVDP found.\r
//\r
OUT UDF_VOLUME_INFO *Volume\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 BlockSize;\r
- UDF_EXTENT_AD *ExtentAd;\r
- EFI_LBA SeqStartBlock;\r
- EFI_LBA SeqEndBlock;\r
- BOOLEAN StopSequence;\r
- VOID *Buffer;\r
- UDF_DESCRIPTOR_TAG *DescriptorTag;\r
- UINT32 LogicalBlockSize;\r
+ EFI_STATUS Status;\r
+ UINT32 BlockSize;\r
+ UDF_EXTENT_AD *ExtentAd;\r
+ EFI_LBA SeqStartBlock;\r
+ EFI_LBA SeqEndBlock;\r
+ BOOLEAN StopSequence;\r
+ VOID *Buffer;\r
+ UDF_DESCRIPTOR_TAG *DescriptorTag;\r
+ UINT32 LogicalBlockSize;\r
\r
BlockSize = BlockIo->Media->BlockSize;\r
- ExtentAd = &AnchorPoint->MainVolumeDescriptorSequenceExtent;\r
+ ExtentAd = &AnchorPoint->MainVolumeDescriptorSequenceExtent;\r
\r
//\r
// Allocate buffer for reading disk blocks\r
// Partition driver already did.\r
//\r
SeqStartBlock = 0;\r
- SeqEndBlock = SeqStartBlock + DivU64x32 ((UINT64)ExtentAd->ExtentLength,\r
- BlockSize);\r
+ SeqEndBlock = SeqStartBlock + DivU64x32 (\r
+ (UINT64)ExtentAd->ExtentLength,\r
+ BlockSize\r
+ );\r
StopSequence = FALSE;\r
- for (; SeqStartBlock < SeqEndBlock && !StopSequence; SeqStartBlock++) {\r
+ for ( ; SeqStartBlock < SeqEndBlock && !StopSequence; SeqStartBlock++) {\r
//\r
// Read disk block\r
//\r
Status = BlockIo->ReadBlocks (\r
- BlockIo,\r
- BlockIo->Media->MediaId,\r
- SeqStartBlock,\r
- BlockSize,\r
- Buffer\r
- );\r
+ BlockIo,\r
+ BlockIo->Media->MediaId,\r
+ SeqStartBlock,\r
+ BlockSize,\r
+ Buffer\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Out_Free;\r
}\r
DescriptorTag = Buffer;\r
\r
switch (DescriptorTag->TagIdentifier) {\r
- case UdfPartitionDescriptor:\r
- //\r
- // Save Partition Descriptor\r
- //\r
- CopyMem (&Volume->PartitionDesc, Buffer, sizeof (Volume->PartitionDesc));\r
- break;\r
+ case UdfPartitionDescriptor:\r
+ //\r
+ // Save Partition Descriptor\r
+ //\r
+ CopyMem (&Volume->PartitionDesc, Buffer, sizeof (Volume->PartitionDesc));\r
+ break;\r
\r
- case UdfLogicalVolumeDescriptor:\r
- //\r
- // Save Logical Volume Descriptor\r
- //\r
- CopyMem (&Volume->LogicalVolDesc, Buffer, sizeof (Volume->LogicalVolDesc));\r
- break;\r
+ case UdfLogicalVolumeDescriptor:\r
+ //\r
+ // Save Logical Volume Descriptor\r
+ //\r
+ CopyMem (&Volume->LogicalVolDesc, Buffer, sizeof (Volume->LogicalVolDesc));\r
+ break;\r
\r
- case UdfTerminatingDescriptor:\r
- StopSequence = TRUE;\r
- break;\r
+ case UdfTerminatingDescriptor:\r
+ StopSequence = TRUE;\r
+ break;\r
\r
- default:\r
- ;\r
+ default:\r
+ ;\r
}\r
}\r
\r
LogicalVolDesc = &Volume->LogicalVolDesc;\r
\r
switch (LogicalVolDesc->DomainIdentifier.Suffix.Domain.UdfRevision) {\r
- case 0x0102:\r
- case 0x0150:\r
- case 0x0200:\r
- case 0x0201:\r
- case 0x0250:\r
- case 0x0260:\r
- //\r
- // UDF 1.02 specification:\r
- //\r
- // There shall be exactly one prevailing Logical Volume Descriptor recorded\r
- // per Volume Set. The Partition Maps field shall contain only Type 1\r
- // Partition Maps.\r
- //\r
- // UDF 1.50 through 2.60 specs say:\r
- //\r
- // For the purpose of interchange partition maps shall be limited to\r
- // Partition Map type 1, except type 2 maps as described in the document.\r
- //\r
- // NOTE: Only one Type 1 (Physical) Partition is supported. It has been\r
- // checked already in Partition driver for existence of a single Type 1\r
- // Partition map. Hence, the 'PartitionReferenceNumber' field (the index\r
- // used to access Partition Maps data within the Logical Volume Descriptor)\r
- // in the Long Allocation Descriptor should be 0 to indicate there is only\r
- // one partition.\r
- //\r
- if (LongAd->ExtentLocation.PartitionReferenceNumber != 0) {\r
- return NULL;\r
- }\r
- //\r
- // Since only one partition, get the first one directly.\r
- //\r
- PartitionNum = *(UINT16 *)((UINTN)&LogicalVolDesc->PartitionMaps[4]);\r
- break;\r
+ case 0x0102:\r
+ case 0x0150:\r
+ case 0x0200:\r
+ case 0x0201:\r
+ case 0x0250:\r
+ case 0x0260:\r
+ //\r
+ // UDF 1.02 specification:\r
+ //\r
+ // There shall be exactly one prevailing Logical Volume Descriptor recorded\r
+ // per Volume Set. The Partition Maps field shall contain only Type 1\r
+ // Partition Maps.\r
+ //\r
+ // UDF 1.50 through 2.60 specs say:\r
+ //\r
+ // For the purpose of interchange partition maps shall be limited to\r
+ // Partition Map type 1, except type 2 maps as described in the document.\r
+ //\r
+ // NOTE: Only one Type 1 (Physical) Partition is supported. It has been\r
+ // checked already in Partition driver for existence of a single Type 1\r
+ // Partition map. Hence, the 'PartitionReferenceNumber' field (the index\r
+ // used to access Partition Maps data within the Logical Volume Descriptor)\r
+ // in the Long Allocation Descriptor should be 0 to indicate there is only\r
+ // one partition.\r
+ //\r
+ if (LongAd->ExtentLocation.PartitionReferenceNumber != 0) {\r
+ return NULL;\r
+ }\r
\r
- default:\r
- //\r
- // Unsupported UDF revision\r
- //\r
- return NULL;\r
+ //\r
+ // Since only one partition, get the first one directly.\r
+ //\r
+ PartitionNum = *(UINT16 *)((UINTN)&LogicalVolDesc->PartitionMaps[4]);\r
+ break;\r
+\r
+ default:\r
+ //\r
+ // Unsupported UDF revision\r
+ //\r
+ return NULL;\r
}\r
\r
//\r
OUT UINT64 *Lsn\r
)\r
{\r
- UDF_PARTITION_DESCRIPTOR *PartitionDesc;\r
+ UDF_PARTITION_DESCRIPTOR *PartitionDesc;\r
\r
PartitionDesc = GetPdFromLongAd (Volume, LongAd);\r
if (PartitionDesc == NULL) {\r
)\r
{\r
return (UINT64)PartitionDesc->PartitionStartingLocation -\r
- Volume->MainVdsStartLocation + ShortAd->ExtentPosition;\r
+ Volume->MainVdsStartLocation + ShortAd->ExtentPosition;\r
}\r
\r
/**\r
**/\r
EFI_STATUS\r
FindFileSetDescriptor (\r
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
- IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
- IN UDF_VOLUME_INFO *Volume\r
+ IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
+ IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
+ IN UDF_VOLUME_INFO *Volume\r
)\r
{\r
EFI_STATUS Status;\r
UDF_DESCRIPTOR_TAG *DescriptorTag;\r
\r
LogicalVolDesc = &Volume->LogicalVolDesc;\r
- Status = GetLongAdLsn (Volume, &LogicalVolDesc->LogicalVolumeContentsUse, &Lsn);\r
+ Status = GetLongAdLsn (Volume, &LogicalVolDesc->LogicalVolumeContentsUse, &Lsn);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
// Read disk block\r
//\r
Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (Lsn, LogicalVolDesc->LogicalBlockSize),\r
- sizeof (Volume->FileSetDesc),\r
- &Volume->FileSetDesc\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (Lsn, LogicalVolDesc->LogicalBlockSize),\r
+ sizeof (Volume->FileSetDesc),\r
+ &Volume->FileSetDesc\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
// Find Anchor Volume Descriptor Pointer\r
//\r
Status = FindAnchorVolumeDescriptorPointer (\r
- BlockIo,\r
- DiskIo,\r
- &AnchorPoint\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ &AnchorPoint\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
// Start Main Volume Descriptor Sequence.\r
//\r
Status = StartMainVolumeDescriptorSequence (\r
- BlockIo,\r
- DiskIo,\r
- &AnchorPoint,\r
- Volume\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ &AnchorPoint,\r
+ Volume\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
)\r
{\r
return (UINT64)(\r
- (INTN)((OFFSET_OF (UDF_FILE_IDENTIFIER_DESCRIPTOR, Data[0]) + 3 +\r
- FileIdentifierDesc->LengthOfFileIdentifier +\r
- FileIdentifierDesc->LengthOfImplementationUse) >> 2) << 2\r
- );\r
+ (INTN)((OFFSET_OF (UDF_FILE_IDENTIFIER_DESCRIPTOR, Data[0]) + 3 +\r
+ FileIdentifierDesc->LengthOfFileIdentifier +\r
+ FileIdentifierDesc->LengthOfImplementationUse) >> 2) << 2\r
+ );\r
}\r
\r
/**\r
{\r
*NewFileIdentifierDesc =\r
(UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool (\r
- (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);\r
+ (UINTN)GetFidDescriptorLength (FileIdentifierDesc),\r
+ FileIdentifierDesc\r
+ );\r
}\r
\r
/**\r
if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) {\r
ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)FileEntryData;\r
\r
- *Length = ExtendedFileEntry->InformationLength;\r
- *Data = (VOID *)((UINT8 *)ExtendedFileEntry->Data +\r
- ExtendedFileEntry->LengthOfExtendedAttributes);\r
+ *Length = ExtendedFileEntry->InformationLength;\r
+ *Data = (VOID *)((UINT8 *)ExtendedFileEntry->Data +\r
+ ExtendedFileEntry->LengthOfExtendedAttributes);\r
} else if (DescriptorTag->TagIdentifier == UdfFileEntry) {\r
FileEntry = (UDF_FILE_ENTRY *)FileEntryData;\r
\r
- *Length = FileEntry->InformationLength;\r
- *Data = (VOID *)((UINT8 *)FileEntry->Data +\r
- FileEntry->LengthOfExtendedAttributes);\r
+ *Length = FileEntry->InformationLength;\r
+ *Data = (VOID *)((UINT8 *)FileEntry->Data +\r
+ FileEntry->LengthOfExtendedAttributes);\r
}\r
\r
if ((*Length > FileEntrySize) ||\r
((UINTN)FileEntryData > (UINTN)(*Data)) ||\r
- ((UINTN)(*Data) - (UINTN)FileEntryData > FileEntrySize - *Length)) {\r
+ ((UINTN)(*Data) - (UINTN)FileEntryData > FileEntrySize - *Length))\r
+ {\r
return EFI_VOLUME_CORRUPTED;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) {\r
ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)FileEntryData;\r
\r
- *Length = ExtendedFileEntry->LengthOfAllocationDescriptors;\r
+ *Length = ExtendedFileEntry->LengthOfAllocationDescriptors;\r
*AdsData = (VOID *)((UINT8 *)ExtendedFileEntry->Data +\r
ExtendedFileEntry->LengthOfExtendedAttributes);\r
} else if (DescriptorTag->TagIdentifier == UdfFileEntry) {\r
FileEntry = (UDF_FILE_ENTRY *)FileEntryData;\r
\r
- *Length = FileEntry->LengthOfAllocationDescriptors;\r
+ *Length = FileEntry->LengthOfAllocationDescriptors;\r
*AdsData = (VOID *)((UINT8 *)FileEntry->Data +\r
FileEntry->LengthOfExtendedAttributes);\r
}\r
\r
if ((*Length > FileEntrySize) ||\r
((UINTN)FileEntryData > (UINTN)(*AdsData)) ||\r
- ((UINTN)(*AdsData) - (UINTN)FileEntryData > FileEntrySize - *Length)) {\r
+ ((UINTN)(*AdsData) - (UINTN)FileEntryData > FileEntrySize - *Length))\r
+ {\r
return EFI_VOLUME_CORRUPTED;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
UDF_LONG_ALLOCATION_DESCRIPTOR *LongAd;\r
UDF_EXTENT_FLAGS ExtentFlags;\r
\r
- for (;;) {\r
+ for ( ; ;) {\r
if (*Offset >= Length) {\r
//\r
// No more Long Allocation Descriptors.\r
// allocated AD, then return it.\r
//\r
ExtentFlags = GET_EXTENT_FLAGS (LongAdsSequence, LongAd);\r
- if (ExtentFlags == ExtentIsNextExtent ||\r
- ExtentFlags == ExtentRecordedAndAllocated) {\r
+ if ((ExtentFlags == ExtentIsNextExtent) ||\r
+ (ExtentFlags == ExtentRecordedAndAllocated))\r
+ {\r
break;\r
}\r
\r
OUT UDF_SHORT_ALLOCATION_DESCRIPTOR **FoundShortAd\r
)\r
{\r
- UDF_SHORT_ALLOCATION_DESCRIPTOR *ShortAd;\r
- UDF_EXTENT_FLAGS ExtentFlags;\r
+ UDF_SHORT_ALLOCATION_DESCRIPTOR *ShortAd;\r
+ UDF_EXTENT_FLAGS ExtentFlags;\r
\r
- for (;;) {\r
+ for ( ; ;) {\r
if (*Offset >= Length) {\r
//\r
// No more Short Allocation Descriptors.\r
// allocated AD, then return it.\r
//\r
ExtentFlags = GET_EXTENT_FLAGS (ShortAdsSequence, ShortAd);\r
- if (ExtentFlags == ExtentIsNextExtent ||\r
- ExtentFlags == ExtentRecordedAndAllocated) {\r
+ if ((ExtentFlags == ExtentIsNextExtent) ||\r
+ (ExtentFlags == ExtentRecordedAndAllocated))\r
+ {\r
break;\r
}\r
\r
{\r
if (RecordingFlags == LongAdsSequence) {\r
return GetLongAdFromAds (\r
- Data,\r
- Offset,\r
- Length,\r
- (UDF_LONG_ALLOCATION_DESCRIPTOR **)FoundAd\r
- );\r
+ Data,\r
+ Offset,\r
+ Length,\r
+ (UDF_LONG_ALLOCATION_DESCRIPTOR **)FoundAd\r
+ );\r
} else if (RecordingFlags == ShortAdsSequence) {\r
return GetShortAdFromAds (\r
- Data,\r
- Offset,\r
- Length,\r
- (UDF_SHORT_ALLOCATION_DESCRIPTOR **)FoundAd\r
- );\r
+ Data,\r
+ Offset,\r
+ Length,\r
+ (UDF_SHORT_ALLOCATION_DESCRIPTOR **)FoundAd\r
+ );\r
}\r
\r
//\r
OUT UINT64 *Lsn\r
)\r
{\r
- UDF_PARTITION_DESCRIPTOR *PartitionDesc;\r
+ UDF_PARTITION_DESCRIPTOR *PartitionDesc;\r
\r
if (RecordingFlags == LongAdsSequence) {\r
return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad, Lsn);\r
UDF_ALLOCATION_EXTENT_DESCRIPTOR *AllocExtDesc;\r
UDF_DESCRIPTOR_TAG *DescriptorTag;\r
\r
- ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);\r
- Status = GetAllocationDescriptorLsn (RecordingFlags,\r
- Volume,\r
- ParentIcb,\r
- Ad,\r
- &Lsn);\r
+ ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);\r
+ Status = GetAllocationDescriptorLsn (\r
+ RecordingFlags,\r
+ Volume,\r
+ ParentIcb,\r
+ Ad,\r
+ &Lsn\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
// Read extent.\r
//\r
Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (Lsn, LogicalBlockSize),\r
- ExtentLength,\r
- Data\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (Lsn, LogicalBlockSize),\r
+ ExtentLength,\r
+ Data\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Exit;\r
}\r
// Get AED's block offset and its length.\r
//\r
*Offset = MultU64x32 (Lsn, LogicalBlockSize) +\r
- sizeof (UDF_ALLOCATION_EXTENT_DESCRIPTOR);\r
+ sizeof (UDF_ALLOCATION_EXTENT_DESCRIPTOR);\r
*Length = AllocExtDesc->LengthOfAllocationDescriptors;\r
\r
Exit:\r
// Get AED's offset + length.\r
//\r
Status = GetAedAdsOffset (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- ParentIcb,\r
- RecordingFlags,\r
- Ad,\r
- &Offset,\r
- Length\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ ParentIcb,\r
+ RecordingFlags,\r
+ Ad,\r
+ &Offset,\r
+ Length\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// Allocate buffer to read in AED's data.\r
//\r
- *Data = AllocatePool ((UINTN) (*Length));\r
+ *Data = AllocatePool ((UINTN)(*Length));\r
if (*Data == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
return DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- Offset,\r
- (UINTN) (*Length),\r
- *Data\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ Offset,\r
+ (UINTN)(*Length),\r
+ *Data\r
+ );\r
}\r
\r
/**\r
IN UINT64 Length\r
)\r
{\r
- UINT32 ExtentLength;\r
+ UINT32 ExtentLength;\r
\r
ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);\r
\r
return EFI_OUT_OF_RESOURCES;\r
}\r
} else {\r
- *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLength), *Buffer);\r
+ *Buffer = ReallocatePool ((UINTN)Length, (UINTN)(Length + ExtentLength), *Buffer);\r
if (*Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
UINT32 ExtentLength;\r
UDF_FE_RECORDING_FLAGS RecordingFlags;\r
\r
- LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize;\r
- DoFreeAed = FALSE;\r
+ LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize;\r
+ DoFreeAed = FALSE;\r
\r
//\r
// set BytesLeft to suppress incorrect compiler/analyzer warnings\r
//\r
- BytesLeft = 0;\r
- DataOffset = 0;\r
- FilePosition = 0;\r
+ BytesLeft = 0;\r
+ DataOffset = 0;\r
+ FilePosition = 0;\r
FinishedSeeking = FALSE;\r
- Data = NULL;\r
+ Data = NULL;\r
\r
switch (ReadFileInfo->Flags) {\r
- case ReadFileGetFileSize:\r
- case ReadFileAllocateAndRead:\r
- //\r
- // Initialise ReadFileInfo structure for either getting file size, or\r
- // reading file's recorded data.\r
- //\r
- ReadFileInfo->ReadLength = 0;\r
- ReadFileInfo->FileData = NULL;\r
- break;\r
- case ReadFileSeekAndRead:\r
- //\r
- // About to seek a file and/or read its data.\r
- //\r
- Length = ReadFileInfo->FileSize - ReadFileInfo->FilePosition;\r
- if (ReadFileInfo->FileDataSize > Length) {\r
+ case ReadFileGetFileSize:\r
+ case ReadFileAllocateAndRead:\r
//\r
- // About to read beyond the EOF -- truncate it.\r
+ // Initialise ReadFileInfo structure for either getting file size, or\r
+ // reading file's recorded data.\r
//\r
- ReadFileInfo->FileDataSize = Length;\r
- }\r
-\r
- //\r
- // Initialise data to start seeking and/or reading a file.\r
- //\r
- BytesLeft = ReadFileInfo->FileDataSize;\r
- DataOffset = 0;\r
- FilePosition = 0;\r
- FinishedSeeking = FALSE;\r
-\r
- break;\r
- }\r
-\r
- RecordingFlags = GET_FE_RECORDING_FLAGS (FileEntryData);\r
- switch (RecordingFlags) {\r
- case InlineData:\r
- //\r
- // There are no extents for this FE/EFE. All data is inline.\r
- //\r
- Status = GetFileEntryData (FileEntryData, Volume->FileEntrySize, &Data, &Length);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- if (ReadFileInfo->Flags == ReadFileGetFileSize) {\r
- ReadFileInfo->ReadLength = Length;\r
- } else if (ReadFileInfo->Flags == ReadFileAllocateAndRead) {\r
+ ReadFileInfo->ReadLength = 0;\r
+ ReadFileInfo->FileData = NULL;\r
+ break;\r
+ case ReadFileSeekAndRead:\r
//\r
- // Allocate buffer for starting read data.\r
+ // About to seek a file and/or read its data.\r
//\r
- ReadFileInfo->FileData = AllocatePool ((UINTN) Length);\r
- if (ReadFileInfo->FileData == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
+ Length = ReadFileInfo->FileSize - ReadFileInfo->FilePosition;\r
+ if (ReadFileInfo->FileDataSize > Length) {\r
+ //\r
+ // About to read beyond the EOF -- truncate it.\r
+ //\r
+ ReadFileInfo->FileDataSize = Length;\r
}\r
\r
//\r
- // Read all inline data into ReadFileInfo->FileData\r
- //\r
- CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length);\r
- ReadFileInfo->ReadLength = Length;\r
- } else if (ReadFileInfo->Flags == ReadFileSeekAndRead) {\r
- //\r
- // If FilePosition is non-zero, seek file to FilePosition, read\r
- // FileDataSize bytes and then updates FilePosition.\r
+ // Initialise data to start seeking and/or reading a file.\r
//\r
- CopyMem (\r
- ReadFileInfo->FileData,\r
- (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),\r
- (UINTN) ReadFileInfo->FileDataSize\r
- );\r
-\r
- ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;\r
- } else {\r
- ASSERT (FALSE);\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Status = EFI_SUCCESS;\r
- break;\r
-\r
- case LongAdsSequence:\r
- case ShortAdsSequence:\r
- //\r
- // This FE/EFE contains a run of Allocation Descriptors. Get data + size\r
- // for start reading them out.\r
- //\r
- Status = GetAdsInformation (FileEntryData, Volume->FileEntrySize, &Data, &Length);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
+ BytesLeft = ReadFileInfo->FileDataSize;\r
+ DataOffset = 0;\r
+ FilePosition = 0;\r
+ FinishedSeeking = FALSE;\r
\r
- AdOffset = 0;\r
+ break;\r
+ }\r
\r
- for (;;) {\r
+ RecordingFlags = GET_FE_RECORDING_FLAGS (FileEntryData);\r
+ switch (RecordingFlags) {\r
+ case InlineData:\r
//\r
- // Read AD.\r
+ // There are no extents for this FE/EFE. All data is inline.\r
//\r
- Status = GetAllocationDescriptor (\r
- RecordingFlags,\r
- Data,\r
- &AdOffset,\r
- Length,\r
- &Ad\r
- );\r
- if (Status == EFI_DEVICE_ERROR) {\r
- Status = EFI_SUCCESS;\r
- goto Done;\r
+ Status = GetFileEntryData (FileEntryData, Volume->FileEntrySize, &Data, &Length);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
}\r
\r
- //\r
- // Check if AD is an indirect AD. If so, read Allocation Extent\r
- // Descriptor and its extents (ADs).\r
- //\r
- if (GET_EXTENT_FLAGS (RecordingFlags, Ad) == ExtentIsNextExtent) {\r
- DataBak = Data;\r
- Status = GetAedAdsData (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- ParentIcb,\r
- RecordingFlags,\r
- Ad,\r
- &Data,\r
- &Length\r
- );\r
-\r
- if (!DoFreeAed) {\r
- DoFreeAed = TRUE;\r
- } else {\r
- FreePool (DataBak);\r
+ if (ReadFileInfo->Flags == ReadFileGetFileSize) {\r
+ ReadFileInfo->ReadLength = Length;\r
+ } else if (ReadFileInfo->Flags == ReadFileAllocateAndRead) {\r
+ //\r
+ // Allocate buffer for starting read data.\r
+ //\r
+ ReadFileInfo->FileData = AllocatePool ((UINTN)Length);\r
+ if (ReadFileInfo->FileData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- if (EFI_ERROR (Status)) {\r
- goto Error_Get_Aed;\r
- }\r
- ASSERT (Data != NULL);\r
+ //\r
+ // Read all inline data into ReadFileInfo->FileData\r
+ //\r
+ CopyMem (ReadFileInfo->FileData, Data, (UINTN)Length);\r
+ ReadFileInfo->ReadLength = Length;\r
+ } else if (ReadFileInfo->Flags == ReadFileSeekAndRead) {\r
+ //\r
+ // If FilePosition is non-zero, seek file to FilePosition, read\r
+ // FileDataSize bytes and then updates FilePosition.\r
+ //\r
+ CopyMem (\r
+ ReadFileInfo->FileData,\r
+ (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),\r
+ (UINTN)ReadFileInfo->FileDataSize\r
+ );\r
\r
- AdOffset = 0;\r
- continue;\r
+ ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;\r
+ } else {\r
+ ASSERT (FALSE);\r
+ return EFI_INVALID_PARAMETER;\r
}\r
\r
- ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);\r
+ Status = EFI_SUCCESS;\r
+ break;\r
\r
- Status = GetAllocationDescriptorLsn (RecordingFlags,\r
- Volume,\r
- ParentIcb,\r
- Ad,\r
- &Lsn);\r
+ case LongAdsSequence:\r
+ case ShortAdsSequence:\r
+ //\r
+ // This FE/EFE contains a run of Allocation Descriptors. Get data + size\r
+ // for start reading them out.\r
+ //\r
+ Status = GetAdsInformation (FileEntryData, Volume->FileEntrySize, &Data, &Length);\r
if (EFI_ERROR (Status)) {\r
- goto Done;\r
+ return Status;\r
}\r
\r
- switch (ReadFileInfo->Flags) {\r
- case ReadFileGetFileSize:\r
- ReadFileInfo->ReadLength += ExtentLength;\r
- break;\r
- case ReadFileAllocateAndRead:\r
- //\r
- // Increase FileData (if necessary) to read next extent.\r
- //\r
- Status = GrowUpBufferToNextAd (\r
- RecordingFlags,\r
- Ad,\r
- &ReadFileInfo->FileData,\r
- ReadFileInfo->ReadLength\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Error_Alloc_Buffer_To_Next_Ad;\r
- }\r
+ AdOffset = 0;\r
\r
+ for ( ; ;) {\r
//\r
- // Read extent's data into FileData.\r
+ // Read AD.\r
//\r
- Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (Lsn, LogicalBlockSize),\r
- ExtentLength,\r
- (VOID *)((UINT8 *)ReadFileInfo->FileData +\r
- ReadFileInfo->ReadLength)\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Error_Read_Disk_Blk;\r
+ Status = GetAllocationDescriptor (\r
+ RecordingFlags,\r
+ Data,\r
+ &AdOffset,\r
+ Length,\r
+ &Ad\r
+ );\r
+ if (Status == EFI_DEVICE_ERROR) {\r
+ Status = EFI_SUCCESS;\r
+ goto Done;\r
}\r
\r
- ReadFileInfo->ReadLength += ExtentLength;\r
- break;\r
- case ReadFileSeekAndRead:\r
//\r
- // Seek file first before reading in its data.\r
+ // Check if AD is an indirect AD. If so, read Allocation Extent\r
+ // Descriptor and its extents (ADs).\r
//\r
- if (FinishedSeeking) {\r
- Offset = 0;\r
- goto Skip_File_Seek;\r
- }\r
+ if (GET_EXTENT_FLAGS (RecordingFlags, Ad) == ExtentIsNextExtent) {\r
+ DataBak = Data;\r
+ Status = GetAedAdsData (\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ ParentIcb,\r
+ RecordingFlags,\r
+ Ad,\r
+ &Data,\r
+ &Length\r
+ );\r
+\r
+ if (!DoFreeAed) {\r
+ DoFreeAed = TRUE;\r
+ } else {\r
+ FreePool (DataBak);\r
+ }\r
\r
- if (FilePosition + ExtentLength < ReadFileInfo->FilePosition) {\r
- FilePosition += ExtentLength;\r
- goto Skip_Ad;\r
- }\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error_Get_Aed;\r
+ }\r
\r
- if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) {\r
- Offset = ReadFileInfo->FilePosition - FilePosition;\r
- } else {\r
- Offset = 0;\r
+ ASSERT (Data != NULL);\r
+\r
+ AdOffset = 0;\r
+ continue;\r
}\r
\r
- //\r
- // Done with seeking file. Start reading its data.\r
- //\r
- FinishedSeeking = TRUE;\r
+ ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad);\r
\r
- Skip_File_Seek:\r
- //\r
- // Make sure we don't read more data than really wanted.\r
- //\r
- if (ExtentLength - Offset > BytesLeft) {\r
- DataLength = BytesLeft;\r
- } else {\r
- DataLength = ExtentLength - Offset;\r
+ Status = GetAllocationDescriptorLsn (\r
+ RecordingFlags,\r
+ Volume,\r
+ ParentIcb,\r
+ Ad,\r
+ &Lsn\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
}\r
\r
- //\r
- // Read extent's data into FileData.\r
- //\r
- Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- Offset + MultU64x32 (Lsn, LogicalBlockSize),\r
- (UINTN) DataLength,\r
- (VOID *)((UINT8 *)ReadFileInfo->FileData +\r
- DataOffset)\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Error_Read_Disk_Blk;\r
+ switch (ReadFileInfo->Flags) {\r
+ case ReadFileGetFileSize:\r
+ ReadFileInfo->ReadLength += ExtentLength;\r
+ break;\r
+ case ReadFileAllocateAndRead:\r
+ //\r
+ // Increase FileData (if necessary) to read next extent.\r
+ //\r
+ Status = GrowUpBufferToNextAd (\r
+ RecordingFlags,\r
+ Ad,\r
+ &ReadFileInfo->FileData,\r
+ ReadFileInfo->ReadLength\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error_Alloc_Buffer_To_Next_Ad;\r
+ }\r
+\r
+ //\r
+ // Read extent's data into FileData.\r
+ //\r
+ Status = DiskIo->ReadDisk (\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (Lsn, LogicalBlockSize),\r
+ ExtentLength,\r
+ (VOID *)((UINT8 *)ReadFileInfo->FileData +\r
+ ReadFileInfo->ReadLength)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error_Read_Disk_Blk;\r
+ }\r
+\r
+ ReadFileInfo->ReadLength += ExtentLength;\r
+ break;\r
+ case ReadFileSeekAndRead:\r
+ //\r
+ // Seek file first before reading in its data.\r
+ //\r
+ if (FinishedSeeking) {\r
+ Offset = 0;\r
+ goto Skip_File_Seek;\r
+ }\r
+\r
+ if (FilePosition + ExtentLength < ReadFileInfo->FilePosition) {\r
+ FilePosition += ExtentLength;\r
+ goto Skip_Ad;\r
+ }\r
+\r
+ if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) {\r
+ Offset = ReadFileInfo->FilePosition - FilePosition;\r
+ } else {\r
+ Offset = 0;\r
+ }\r
+\r
+ //\r
+ // Done with seeking file. Start reading its data.\r
+ //\r
+ FinishedSeeking = TRUE;\r
+\r
+Skip_File_Seek:\r
+ //\r
+ // Make sure we don't read more data than really wanted.\r
+ //\r
+ if (ExtentLength - Offset > BytesLeft) {\r
+ DataLength = BytesLeft;\r
+ } else {\r
+ DataLength = ExtentLength - Offset;\r
+ }\r
+\r
+ //\r
+ // Read extent's data into FileData.\r
+ //\r
+ Status = DiskIo->ReadDisk (\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ Offset + MultU64x32 (Lsn, LogicalBlockSize),\r
+ (UINTN)DataLength,\r
+ (VOID *)((UINT8 *)ReadFileInfo->FileData +\r
+ DataOffset)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error_Read_Disk_Blk;\r
+ }\r
+\r
+ //\r
+ // Update current file's position.\r
+ //\r
+ DataOffset += DataLength;\r
+ ReadFileInfo->FilePosition += DataLength;\r
+\r
+ BytesLeft -= DataLength;\r
+ if (BytesLeft == 0) {\r
+ //\r
+ // There is no more file data to read.\r
+ //\r
+ Status = EFI_SUCCESS;\r
+ goto Done;\r
+ }\r
+\r
+ break;\r
}\r
\r
+Skip_Ad:\r
//\r
- // Update current file's position.\r
+ // Point to the next AD (extent).\r
//\r
- DataOffset += DataLength;\r
- ReadFileInfo->FilePosition += DataLength;\r
-\r
- BytesLeft -= DataLength;\r
- if (BytesLeft == 0) {\r
- //\r
- // There is no more file data to read.\r
- //\r
- Status = EFI_SUCCESS;\r
- goto Done;\r
- }\r
-\r
- break;\r
+ AdOffset += AD_LENGTH (RecordingFlags);\r
}\r
\r
- Skip_Ad:\r
+ break;\r
+ case ExtendedAdsSequence:\r
+ // FIXME: Not supported. Got no volume with it, yet.\r
+ ASSERT (FALSE);\r
+ Status = EFI_UNSUPPORTED;\r
+ break;\r
+\r
+ default:\r
//\r
- // Point to the next AD (extent).\r
+ // A flag value reserved by the ECMA-167 standard (3rd Edition - June\r
+ // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found.\r
//\r
- AdOffset += AD_LENGTH (RecordingFlags);\r
- }\r
-\r
- break;\r
- case ExtendedAdsSequence:\r
- // FIXME: Not supported. Got no volume with it, yet.\r
- ASSERT (FALSE);\r
- Status = EFI_UNSUPPORTED;\r
- break;\r
-\r
- default:\r
- //\r
- // A flag value reserved by the ECMA-167 standard (3rd Edition - June\r
- // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found.\r
- //\r
- Status = EFI_UNSUPPORTED;\r
- break;\r
+ Status = EFI_UNSUPPORTED;\r
+ break;\r
}\r
\r
Done:\r
ZeroMem ((VOID *)&ReadDirInfo, sizeof (UDF_READ_DIRECTORY_INFO));\r
Found = FALSE;\r
\r
- for (;;) {\r
+ for ( ; ;) {\r
Status = ReadDirectoryEntry (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- (Parent->FileIdentifierDesc != NULL) ?\r
- &Parent->FileIdentifierDesc->Icb :\r
- Icb,\r
- Parent->FileEntry,\r
- &ReadDirInfo,\r
- &FileIdentifierDesc\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ (Parent->FileIdentifierDesc != NULL) ?\r
+ &Parent->FileIdentifierDesc->Icb :\r
+ Icb,\r
+ Parent->FileEntry,\r
+ &ReadDirInfo,\r
+ &FileIdentifierDesc\r
+ );\r
if (EFI_ERROR (Status)) {\r
if (Status == EFI_DEVICE_ERROR) {\r
Status = EFI_NOT_FOUND;\r
\r
break;\r
}\r
+\r
//\r
// After calling function ReadDirectoryEntry(), if 'FileIdentifierDesc' is\r
// NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the code\r
// directory (Parent), and if FileName is either ".." or "\\", then it's\r
// the expected FID.\r
//\r
- if (StrCmp (FileName, L"..") == 0 || StrCmp (FileName, L"\\") == 0) {\r
+ if ((StrCmp (FileName, L"..") == 0) || (StrCmp (FileName, L"\\") == 0)) {\r
Found = TRUE;\r
break;\r
}\r
//\r
if (StrCmp (FileName, L"\\") != 0) {\r
Status = FindFileEntry (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- &FileIdentifierDesc->Icb,\r
- &CompareFileEntry\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &FileIdentifierDesc->Icb,\r
+ &CompareFileEntry\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Error_Find_Fe;\r
}\r
//\r
// Make sure that both Parent's FE/EFE and found FE/EFE are not equal.\r
//\r
- if (CompareMem ((VOID *)Parent->FileEntry, (VOID *)CompareFileEntry,\r
- Volume->FileEntrySize) != 0) {\r
+ if (CompareMem (\r
+ (VOID *)Parent->FileEntry,\r
+ (VOID *)CompareFileEntry,\r
+ Volume->FileEntrySize\r
+ ) != 0)\r
+ {\r
File->FileEntry = CompareFileEntry;\r
} else {\r
FreePool ((VOID *)FileIdentifierDesc);\r
OUT UDF_VOLUME_INFO *Volume\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
//\r
// Read all necessary UDF volume information and keep it private to the driver\r
//\r
Status = ReadVolumeFileStructure (\r
- BlockIo,\r
- DiskIo,\r
- Volume\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
UDF_FILE_INFO Parent;\r
\r
Status = FindFileEntry (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- &Volume->FileSetDesc.RootDirectoryIcb,\r
- &File->FileEntry\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &Volume->FileSetDesc.RootDirectoryIcb,\r
+ &File->FileEntry\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- Parent.FileEntry = File->FileEntry;\r
+ Parent.FileEntry = File->FileEntry;\r
Parent.FileIdentifierDesc = NULL;\r
\r
Status = FindFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- L"\\",\r
- NULL,\r
- &Parent,\r
- &Volume->FileSetDesc.RootDirectoryIcb,\r
- File\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ L"\\",\r
+ NULL,\r
+ &Parent,\r
+ &Volume->FileSetDesc.RootDirectoryIcb,\r
+ File\r
+ );\r
if (EFI_ERROR (Status)) {\r
FreePool (File->FileEntry);\r
}\r
return Status;\r
}\r
\r
- LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize;\r
+ LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize;\r
\r
ReadBuffer = AllocateZeroPool (Volume->FileEntrySize);\r
if (ReadBuffer == NULL) {\r
// Read extent.\r
//\r
Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (Lsn, LogicalBlockSize),\r
- Volume->FileEntrySize,\r
- ReadBuffer\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (Lsn, LogicalBlockSize),\r
+ Volume->FileEntrySize,\r
+ ReadBuffer\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Error_Read_Disk_Blk;\r
}\r
// Check if the read extent contains a valid Tag Identifier for the expected\r
// FE/EFE.\r
//\r
- if (DescriptorTag->TagIdentifier != UdfFileEntry &&\r
- DescriptorTag->TagIdentifier != UdfExtendedFileEntry) {\r
+ if ((DescriptorTag->TagIdentifier != UdfFileEntry) &&\r
+ (DescriptorTag->TagIdentifier != UdfExtendedFileEntry))\r
+ {\r
Status = EFI_VOLUME_CORRUPTED;\r
goto Error_Invalid_Fe;\r
}\r
FileNamePointer = FileName;\r
while (*FilePath != L'\0' && *FilePath != L'\\') {\r
if ((((UINTN)FileNamePointer - (UINTN)FileName) / sizeof (CHAR16)) >=\r
- (ARRAY_SIZE (FileName) - 1)) {\r
+ (ARRAY_SIZE (FileName) - 1))\r
+ {\r
return EFI_NOT_FOUND;\r
}\r
\r
//\r
// See UdfOpenVolume() function.\r
//\r
- Status = InternalFindFile (BlockIo,\r
- DiskIo,\r
- Volume,\r
- L"\\",\r
- &PreviousFile,\r
- Icb,\r
- File);\r
+ Status = InternalFindFile (\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ L"\\",\r
+ &PreviousFile,\r
+ Icb,\r
+ File\r
+ );\r
} else {\r
//\r
// We've already a file pointer (Root) for the root directory. Duplicate\r
//\r
// No root directory. Find filename from the current directory.\r
//\r
- Status = InternalFindFile (BlockIo,\r
- DiskIo,\r
- Volume,\r
- FileName,\r
- &PreviousFile,\r
- Icb,\r
- File);\r
+ Status = InternalFindFile (\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ FileName,\r
+ &PreviousFile,\r
+ Icb,\r
+ File\r
+ );\r
}\r
\r
if (EFI_ERROR (Status)) {\r
\r
FileEntry = File->FileEntry;\r
\r
- Status = ResolveSymlink (BlockIo,\r
- DiskIo,\r
- Volume,\r
- &PreviousFile,\r
- FileEntry,\r
- File);\r
+ Status = ResolveSymlink (\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &PreviousFile,\r
+ FileEntry,\r
+ File\r
+ );\r
\r
FreePool (FileEntry);\r
\r
}\r
}\r
\r
- if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent,\r
- sizeof (UDF_FILE_INFO)) != 0) {\r
+ if (CompareMem (\r
+ (VOID *)&PreviousFile,\r
+ (VOID *)Parent,\r
+ sizeof (UDF_FILE_INFO)\r
+ ) != 0)\r
+ {\r
CleanupFileInformation (&PreviousFile);\r
}\r
\r
CopyMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO));\r
- if (*FilePath != L'\0' && *FilePath == L'\\') {\r
+ if ((*FilePath != L'\0') && (*FilePath == L'\\')) {\r
FilePath++;\r
}\r
}\r
ReadFileInfo.Flags = ReadFileAllocateAndRead;\r
\r
Status = ReadFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- ParentIcb,\r
- FileEntryData,\r
- &ReadFileInfo\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ ParentIcb,\r
+ FileEntryData,\r
+ &ReadFileInfo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// Fill in ReadDirInfo structure with the read directory's data information.\r
//\r
- ReadDirInfo->DirectoryData = ReadFileInfo.FileData;\r
+ ReadDirInfo->DirectoryData = ReadFileInfo.FileData;\r
ReadDirInfo->DirectoryLength = ReadFileInfo.ReadLength;\r
}\r
\r
//\r
// Get FID for this entry.\r
//\r
- FileIdentifierDesc = GET_FID_FROM_ADS (ReadDirInfo->DirectoryData,\r
- ReadDirInfo->FidOffset);\r
+ FileIdentifierDesc = GET_FID_FROM_ADS (\r
+ ReadDirInfo->DirectoryData,\r
+ ReadDirInfo->FidOffset\r
+ );\r
//\r
// Update FidOffset to point to next FID.\r
//\r
OUT CHAR16 *FileName\r
)\r
{\r
- UINT8 *OstaCompressed;\r
- UINT8 CompressionId;\r
- UINT8 Length;\r
- UINTN Index;\r
- CHAR16 *FileNameBak;\r
+ UINT8 *OstaCompressed;\r
+ UINT8 CompressionId;\r
+ UINT8 Length;\r
+ UINTN Index;\r
+ CHAR16 *FileNameBak;\r
\r
if (CharMax == 0) {\r
return EFI_BUFFER_TOO_SMALL;\r
\r
OstaCompressed =\r
(UINT8 *)(\r
- (UINT8 *)FileIdentifierDesc->Data +\r
- FileIdentifierDesc->LengthOfImplementationUse\r
- );\r
+ (UINT8 *)FileIdentifierDesc->Data +\r
+ FileIdentifierDesc->LengthOfImplementationUse\r
+ );\r
\r
CompressionId = OstaCompressed[0];\r
if (!IS_VALID_COMPRESSION_ID (CompressionId)) {\r
if (Index > CharMax - 1) {\r
Index = CharMax - 1;\r
}\r
+\r
FileNameBak[Index] = L'\0';\r
\r
return EFI_SUCCESS;\r
ReadFileInfo.Flags = ReadFileAllocateAndRead;\r
\r
Status = ReadFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- &Parent->FileIdentifierDesc->Icb,\r
- FileEntryData,\r
- &ReadFileInfo\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &Parent->FileIdentifierDesc->Icb,\r
+ FileEntryData,\r
+ &ReadFileInfo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
Length = ReadFileInfo.ReadLength;\r
\r
- Data = (UINT8 *)ReadFileInfo.FileData;\r
+ Data = (UINT8 *)ReadFileInfo.FileData;\r
EndData = Data + Length;\r
\r
CopyMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO));\r
\r
- for (;;) {\r
+ for ( ; ;) {\r
PathComp = (UDF_PATH_COMPONENT *)Data;\r
\r
PathCompLength = PathComp->LengthOfComponentIdentifier;\r
\r
switch (PathComp->ComponentType) {\r
- case 1:\r
+ case 1:\r
//\r
// This Path Component specifies the root directory hierarchy subject to\r
// agreement between the originator and recipient of the medium. Skip it.\r
//\r
// Fall through.\r
//\r
- case 2:\r
- //\r
- // "\\." of the current directory. Read next Path Component.\r
- //\r
- goto Next_Path_Component;\r
- case 3:\r
- //\r
- // ".." (parent directory). Go to it.\r
- //\r
- CopyMem ((VOID *)FileName, L"..", 6);\r
- break;\r
- case 4:\r
- //\r
- // "." (current file). Duplicate both FE/EFE and FID of this file.\r
- //\r
- DuplicateFe (BlockIo, Volume, PreviousFile.FileEntry, &File->FileEntry);\r
- if (File->FileEntry == NULL) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto Error_Find_File;\r
- }\r
+ case 2:\r
+ //\r
+ // "\\." of the current directory. Read next Path Component.\r
+ //\r
+ goto Next_Path_Component;\r
+ case 3:\r
+ //\r
+ // ".." (parent directory). Go to it.\r
+ //\r
+ CopyMem ((VOID *)FileName, L"..", 6);\r
+ break;\r
+ case 4:\r
+ //\r
+ // "." (current file). Duplicate both FE/EFE and FID of this file.\r
+ //\r
+ DuplicateFe (BlockIo, Volume, PreviousFile.FileEntry, &File->FileEntry);\r
+ if (File->FileEntry == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Error_Find_File;\r
+ }\r
\r
- DuplicateFid (PreviousFile.FileIdentifierDesc,\r
- &File->FileIdentifierDesc);\r
- if (File->FileIdentifierDesc == NULL) {\r
- FreePool (File->FileEntry);\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto Error_Find_File;\r
- }\r
- goto Next_Path_Component;\r
- case 5:\r
- //\r
- // This Path Component identifies an object, either a file or a\r
- // directory or an alias.\r
- //\r
- // Decode it from the compressed data in ComponentIdentifier and find\r
- // respective path.\r
- //\r
- CompressionId = PathComp->ComponentIdentifier[0];\r
- if (!IS_VALID_COMPRESSION_ID (CompressionId)) {\r
- return EFI_VOLUME_CORRUPTED;\r
- }\r
+ DuplicateFid (\r
+ PreviousFile.FileIdentifierDesc,\r
+ &File->FileIdentifierDesc\r
+ );\r
+ if (File->FileIdentifierDesc == NULL) {\r
+ FreePool (File->FileEntry);\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Error_Find_File;\r
+ }\r
\r
- if ((UINTN)PathComp->ComponentIdentifier + PathCompLength > (UINTN)EndData) {\r
- return EFI_VOLUME_CORRUPTED;\r
- }\r
+ goto Next_Path_Component;\r
+ case 5:\r
+ //\r
+ // This Path Component identifies an object, either a file or a\r
+ // directory or an alias.\r
+ //\r
+ // Decode it from the compressed data in ComponentIdentifier and find\r
+ // respective path.\r
+ //\r
+ CompressionId = PathComp->ComponentIdentifier[0];\r
+ if (!IS_VALID_COMPRESSION_ID (CompressionId)) {\r
+ return EFI_VOLUME_CORRUPTED;\r
+ }\r
\r
- Char = FileName;\r
- for (Index = 1; Index < PathCompLength; Index++) {\r
- if (CompressionId == 16) {\r
- *Char = *(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier +\r
- Index) << 8;\r
- Index++;\r
- } else {\r
- if (Index > ARRAY_SIZE (FileName)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
- *Char = 0;\r
+ if ((UINTN)PathComp->ComponentIdentifier + PathCompLength > (UINTN)EndData) {\r
+ return EFI_VOLUME_CORRUPTED;\r
}\r
\r
- if (Index < Length) {\r
- *Char |= (CHAR16)(*(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier + Index));\r
+ Char = FileName;\r
+ for (Index = 1; Index < PathCompLength; Index++) {\r
+ if (CompressionId == 16) {\r
+ *Char = *(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier +\r
+ Index) << 8;\r
+ Index++;\r
+ } else {\r
+ if (Index > ARRAY_SIZE (FileName)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ *Char = 0;\r
+ }\r
+\r
+ if (Index < Length) {\r
+ *Char |= (CHAR16)(*(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier + Index));\r
+ }\r
+\r
+ Char++;\r
}\r
\r
- Char++;\r
- }\r
+ Index = ((UINTN)Char - (UINTN)FileName) / sizeof (CHAR16);\r
+ if (Index > ARRAY_SIZE (FileName) - 1) {\r
+ Index = ARRAY_SIZE (FileName) - 1;\r
+ }\r
\r
- Index = ((UINTN)Char - (UINTN)FileName) / sizeof (CHAR16);\r
- if (Index > ARRAY_SIZE (FileName) - 1) {\r
- Index = ARRAY_SIZE (FileName) - 1;\r
- }\r
- FileName[Index] = L'\0';\r
- break;\r
- default:\r
- //\r
- // According to the ECMA-167 standard (3rd Edition - June 1997), Section\r
- // 14.16.1.1, all other values are reserved.\r
- //\r
- Status = EFI_VOLUME_CORRUPTED;\r
- goto Error_Find_File;\r
+ FileName[Index] = L'\0';\r
+ break;\r
+ default:\r
+ //\r
+ // According to the ECMA-167 standard (3rd Edition - June 1997), Section\r
+ // 14.16.1.1, all other values are reserved.\r
+ //\r
+ Status = EFI_VOLUME_CORRUPTED;\r
+ goto Error_Find_File;\r
}\r
\r
//\r
// Find file from the read filename in symlink's file data.\r
//\r
Status = InternalFindFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- FileName,\r
- &PreviousFile,\r
- NULL,\r
- File\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ FileName,\r
+ &PreviousFile,\r
+ NULL,\r
+ File\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Error_Find_File;\r
}\r
\r
- Next_Path_Component:\r
+Next_Path_Component:\r
Data += sizeof (UDF_PATH_COMPONENT) + PathCompLength;\r
if (Data >= EndData) {\r
break;\r
goto Error_Find_File;\r
}\r
\r
- NotParent = (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent,\r
- sizeof (UDF_FILE_INFO)) != 0);\r
- NotFile = (CompareMem ((VOID *)&PreviousFile, (VOID *)File,\r
- sizeof (UDF_FILE_INFO)) != 0);\r
+ NotParent = (CompareMem (\r
+ (VOID *)&PreviousFile,\r
+ (VOID *)Parent,\r
+ sizeof (UDF_FILE_INFO)\r
+ ) != 0);\r
+ NotFile = (CompareMem (\r
+ (VOID *)&PreviousFile,\r
+ (VOID *)File,\r
+ sizeof (UDF_FILE_INFO)\r
+ ) != 0);\r
\r
if (NotParent && NotFile) {\r
CleanupFileInformation (&PreviousFile);\r
return EFI_SUCCESS;\r
\r
Error_Find_File:\r
- if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent,\r
- sizeof (UDF_FILE_INFO)) != 0) {\r
+ if (CompareMem (\r
+ (VOID *)&PreviousFile,\r
+ (VOID *)Parent,\r
+ sizeof (UDF_FILE_INFO)\r
+ ) != 0)\r
+ {\r
CleanupFileInformation (&PreviousFile);\r
}\r
\r
**/\r
VOID\r
CleanupFileInformation (\r
- IN UDF_FILE_INFO *File\r
+ IN UDF_FILE_INFO *File\r
)\r
{\r
if (File->FileEntry != NULL) {\r
FreePool (File->FileEntry);\r
}\r
+\r
if (File->FileIdentifierDesc != NULL) {\r
FreePool ((VOID *)File->FileIdentifierDesc);\r
}\r
ReadFileInfo.Flags = ReadFileGetFileSize;\r
\r
Status = ReadFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- &File->FileIdentifierDesc->Icb,\r
- File->FileEntry,\r
- &ReadFileInfo\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &File->FileIdentifierDesc->Icb,\r
+ File->FileEntry,\r
+ &ReadFileInfo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
// Buffer now contains room enough to store EFI_FILE_INFO structure.\r
// Now, fill it in with all necessary information about the file.\r
//\r
- FileInfo = (EFI_FILE_INFO *)Buffer;\r
- FileInfo->Size = FileInfoLength;\r
- FileInfo->Attribute &= ~EFI_FILE_VALID_ATTR;\r
- FileInfo->Attribute |= EFI_FILE_READ_ONLY;\r
+ FileInfo = (EFI_FILE_INFO *)Buffer;\r
+ FileInfo->Size = FileInfoLength;\r
+ FileInfo->Attribute &= ~EFI_FILE_VALID_ATTR;\r
+ FileInfo->Attribute |= EFI_FILE_READ_ONLY;\r
\r
if (IS_FID_DIRECTORY_FILE (File->FileIdentifierDesc)) {\r
FileInfo->Attribute |= EFI_FILE_DIRECTORY;\r
FileInfo->Attribute |= EFI_FILE_SYSTEM;\r
}\r
\r
- FileInfo->FileSize = FileSize;\r
- FileInfo->PhysicalSize = FileSize;\r
-\r
- FileInfo->CreateTime.Year = FileEntry->AccessTime.Year;\r
- FileInfo->CreateTime.Month = FileEntry->AccessTime.Month;\r
- FileInfo->CreateTime.Day = FileEntry->AccessTime.Day;\r
- FileInfo->CreateTime.Hour = FileEntry->AccessTime.Hour;\r
- FileInfo->CreateTime.Minute = FileEntry->AccessTime.Minute;\r
- FileInfo->CreateTime.Second = FileEntry->AccessTime.Second;\r
- FileInfo->CreateTime.Nanosecond =\r
- FileEntry->AccessTime.HundredsOfMicroseconds;\r
-\r
- FileInfo->LastAccessTime.Year =\r
- FileEntry->AccessTime.Year;\r
- FileInfo->LastAccessTime.Month =\r
- FileEntry->AccessTime.Month;\r
- FileInfo->LastAccessTime.Day =\r
- FileEntry->AccessTime.Day;\r
- FileInfo->LastAccessTime.Hour =\r
- FileEntry->AccessTime.Hour;\r
- FileInfo->LastAccessTime.Minute =\r
- FileEntry->AccessTime.Minute;\r
- FileInfo->LastAccessTime.Second =\r
- FileEntry->AccessTime.Second;\r
- FileInfo->LastAccessTime.Nanosecond =\r
- FileEntry->AccessTime.HundredsOfMicroseconds;\r
+ FileInfo->FileSize = FileSize;\r
+ FileInfo->PhysicalSize = FileSize;\r
+\r
+ FileInfo->CreateTime.Year = FileEntry->AccessTime.Year;\r
+ FileInfo->CreateTime.Month = FileEntry->AccessTime.Month;\r
+ FileInfo->CreateTime.Day = FileEntry->AccessTime.Day;\r
+ FileInfo->CreateTime.Hour = FileEntry->AccessTime.Hour;\r
+ FileInfo->CreateTime.Minute = FileEntry->AccessTime.Minute;\r
+ FileInfo->CreateTime.Second = FileEntry->AccessTime.Second;\r
+ FileInfo->CreateTime.Nanosecond =\r
+ FileEntry->AccessTime.HundredsOfMicroseconds;\r
+\r
+ FileInfo->LastAccessTime.Year =\r
+ FileEntry->AccessTime.Year;\r
+ FileInfo->LastAccessTime.Month =\r
+ FileEntry->AccessTime.Month;\r
+ FileInfo->LastAccessTime.Day =\r
+ FileEntry->AccessTime.Day;\r
+ FileInfo->LastAccessTime.Hour =\r
+ FileEntry->AccessTime.Hour;\r
+ FileInfo->LastAccessTime.Minute =\r
+ FileEntry->AccessTime.Minute;\r
+ FileInfo->LastAccessTime.Second =\r
+ FileEntry->AccessTime.Second;\r
+ FileInfo->LastAccessTime.Nanosecond =\r
+ FileEntry->AccessTime.HundredsOfMicroseconds;\r
} else if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) {\r
ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)File->FileEntry;\r
\r
FileInfo->Attribute |= EFI_FILE_SYSTEM;\r
}\r
\r
- FileInfo->FileSize = FileSize;\r
- FileInfo->PhysicalSize = FileSize;\r
-\r
- FileInfo->CreateTime.Year = ExtendedFileEntry->CreationTime.Year;\r
- FileInfo->CreateTime.Month = ExtendedFileEntry->CreationTime.Month;\r
- FileInfo->CreateTime.Day = ExtendedFileEntry->CreationTime.Day;\r
- FileInfo->CreateTime.Hour = ExtendedFileEntry->CreationTime.Hour;\r
- FileInfo->CreateTime.Minute = ExtendedFileEntry->CreationTime.Second;\r
- FileInfo->CreateTime.Second = ExtendedFileEntry->CreationTime.Second;\r
- FileInfo->CreateTime.Nanosecond =\r
- ExtendedFileEntry->AccessTime.HundredsOfMicroseconds;\r
-\r
- FileInfo->LastAccessTime.Year =\r
- ExtendedFileEntry->AccessTime.Year;\r
- FileInfo->LastAccessTime.Month =\r
- ExtendedFileEntry->AccessTime.Month;\r
- FileInfo->LastAccessTime.Day =\r
- ExtendedFileEntry->AccessTime.Day;\r
- FileInfo->LastAccessTime.Hour =\r
- ExtendedFileEntry->AccessTime.Hour;\r
- FileInfo->LastAccessTime.Minute =\r
- ExtendedFileEntry->AccessTime.Minute;\r
- FileInfo->LastAccessTime.Second =\r
- ExtendedFileEntry->AccessTime.Second;\r
- FileInfo->LastAccessTime.Nanosecond =\r
- ExtendedFileEntry->AccessTime.HundredsOfMicroseconds;\r
- }\r
-\r
- FileInfo->CreateTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
- FileInfo->CreateTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT;\r
- FileInfo->LastAccessTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
- FileInfo->LastAccessTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT;\r
-\r
- CopyMem ((VOID *)&FileInfo->ModificationTime,\r
- (VOID *)&FileInfo->LastAccessTime,\r
- sizeof (EFI_TIME));\r
+ FileInfo->FileSize = FileSize;\r
+ FileInfo->PhysicalSize = FileSize;\r
+\r
+ FileInfo->CreateTime.Year = ExtendedFileEntry->CreationTime.Year;\r
+ FileInfo->CreateTime.Month = ExtendedFileEntry->CreationTime.Month;\r
+ FileInfo->CreateTime.Day = ExtendedFileEntry->CreationTime.Day;\r
+ FileInfo->CreateTime.Hour = ExtendedFileEntry->CreationTime.Hour;\r
+ FileInfo->CreateTime.Minute = ExtendedFileEntry->CreationTime.Second;\r
+ FileInfo->CreateTime.Second = ExtendedFileEntry->CreationTime.Second;\r
+ FileInfo->CreateTime.Nanosecond =\r
+ ExtendedFileEntry->AccessTime.HundredsOfMicroseconds;\r
+\r
+ FileInfo->LastAccessTime.Year =\r
+ ExtendedFileEntry->AccessTime.Year;\r
+ FileInfo->LastAccessTime.Month =\r
+ ExtendedFileEntry->AccessTime.Month;\r
+ FileInfo->LastAccessTime.Day =\r
+ ExtendedFileEntry->AccessTime.Day;\r
+ FileInfo->LastAccessTime.Hour =\r
+ ExtendedFileEntry->AccessTime.Hour;\r
+ FileInfo->LastAccessTime.Minute =\r
+ ExtendedFileEntry->AccessTime.Minute;\r
+ FileInfo->LastAccessTime.Second =\r
+ ExtendedFileEntry->AccessTime.Second;\r
+ FileInfo->LastAccessTime.Nanosecond =\r
+ ExtendedFileEntry->AccessTime.HundredsOfMicroseconds;\r
+ }\r
+\r
+ FileInfo->CreateTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
+ FileInfo->CreateTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT;\r
+ FileInfo->LastAccessTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
+ FileInfo->LastAccessTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT;\r
+\r
+ CopyMem (\r
+ (VOID *)&FileInfo->ModificationTime,\r
+ (VOID *)&FileInfo->LastAccessTime,\r
+ sizeof (EFI_TIME)\r
+ );\r
\r
if (FileName != NULL) {\r
StrCpyS (FileInfo->FileName, StrLen (FileName) + 1, FileName);\r
if (Index > CharMax - 1) {\r
Index = CharMax - 1;\r
}\r
+\r
StringBak[Index] = L'\0';\r
\r
return EFI_SUCCESS;\r
ExtentAd = &LogicalVolDesc->IntegritySequenceExtent;\r
\r
if ((ExtentAd->ExtentLength == 0) ||\r
- (ExtentAd->ExtentLength < sizeof (UDF_LOGICAL_VOLUME_INTEGRITY))) {\r
+ (ExtentAd->ExtentLength < sizeof (UDF_LOGICAL_VOLUME_INTEGRITY)))\r
+ {\r
return EFI_VOLUME_CORRUPTED;\r
}\r
\r
// Read disk block\r
//\r
Status = DiskIo->ReadDisk (\r
- DiskIo,\r
- BlockIo->Media->MediaId,\r
- MultU64x32 (Lsn, LogicalBlockSize),\r
- ExtentAd->ExtentLength,\r
- LogicalVolInt\r
- );\r
+ DiskIo,\r
+ BlockIo->Media->MediaId,\r
+ MultU64x32 (Lsn, LogicalBlockSize),\r
+ ExtentAd->ExtentLength,\r
+ LogicalVolInt\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Out_Free;\r
}\r
\r
if ((LogicalVolInt->NumberOfPartitions > MAX_UINT32 / sizeof (UINT32) / 2) ||\r
(LogicalVolInt->NumberOfPartitions * sizeof (UINT32) * 2 >\r
- ExtentAd->ExtentLength - sizeof (UDF_LOGICAL_VOLUME_INTEGRITY))) {\r
+ ExtentAd->ExtentLength - sizeof (UDF_LOGICAL_VOLUME_INTEGRITY)))\r
+ {\r
Status = EFI_VOLUME_CORRUPTED;\r
goto Out_Free;\r
}\r
\r
- *VolumeSize = 0;\r
+ *VolumeSize = 0;\r
*FreeSpaceSize = 0;\r
\r
Length = LogicalVolInt->NumberOfPartitions;\r
if (LsnsNo == 0xFFFFFFFFUL) {\r
continue;\r
}\r
+\r
//\r
// Accumulate free space size\r
//\r
}\r
\r
Length = LogicalVolInt->NumberOfPartitions * sizeof (UINT32) * 2;\r
- for (; Index < Length; Index += sizeof (UINT32)) {\r
+ for ( ; Index < Length; Index += sizeof (UINT32)) {\r
LsnsNo = *(UINT32 *)((UINT8 *)LogicalVolInt->Data + Index);\r
//\r
// Check if size is not specified\r
if (LsnsNo == 0xFFFFFFFFUL) {\r
continue;\r
}\r
+\r
//\r
// Accumulate used volume space\r
//\r
EFI_STATUS Status;\r
UDF_READ_FILE_INFO ReadFileInfo;\r
\r
- ReadFileInfo.Flags = ReadFileSeekAndRead;\r
- ReadFileInfo.FilePosition = *FilePosition;\r
- ReadFileInfo.FileData = Buffer;\r
- ReadFileInfo.FileDataSize = *BufferSize;\r
- ReadFileInfo.FileSize = FileSize;\r
+ ReadFileInfo.Flags = ReadFileSeekAndRead;\r
+ ReadFileInfo.FilePosition = *FilePosition;\r
+ ReadFileInfo.FileData = Buffer;\r
+ ReadFileInfo.FileDataSize = *BufferSize;\r
+ ReadFileInfo.FileSize = FileSize;\r
\r
Status = ReadFile (\r
- BlockIo,\r
- DiskIo,\r
- Volume,\r
- &File->FileIdentifierDesc->Icb,\r
- File->FileEntry,\r
- &ReadFileInfo\r
- );\r
+ BlockIo,\r
+ DiskIo,\r
+ Volume,\r
+ &File->FileIdentifierDesc->Icb,\r
+ File->FileEntry,\r
+ &ReadFileInfo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- *BufferSize = ReadFileInfo.FileDataSize;\r
- *FilePosition = ReadFileInfo.FilePosition;\r
+ *BufferSize = ReadFileInfo.FileDataSize;\r
+ *FilePosition = ReadFileInfo.FilePosition;\r
\r
return EFI_SUCCESS;\r
}\r
// Open Device Path protocol on ControllerHandle\r
//\r
Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **)&DevicePath,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
+ ControllerHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **)&DevicePath,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
if (EFI_ERROR (Status)) {\r
return EFI_UNSUPPORTED;\r
}\r
// Get last Device Path node\r
//\r
LastDevicePathNode = NULL;\r
- DevicePathNode = DevicePath;\r
+ DevicePathNode = DevicePath;\r
while (!IsDevicePathEnd (DevicePathNode)) {\r
LastDevicePathNode = DevicePathNode;\r
- DevicePathNode = NextDevicePathNode (DevicePathNode);\r
+ DevicePathNode = NextDevicePathNode (DevicePathNode);\r
}\r
+\r
//\r
// Check if last Device Path node contains a Vendor-Defined Media Device Path\r
// of an UDF file system.\r
//\r
- if (LastDevicePathNode != NULL &&\r
- DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH &&\r
- DevicePathSubType (LastDevicePathNode) == MEDIA_VENDOR_DP) {\r
+ if ((LastDevicePathNode != NULL) &&\r
+ (DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH) &&\r
+ (DevicePathSubType (LastDevicePathNode) == MEDIA_VENDOR_DP))\r
+ {\r
VendorDefinedGuid = (EFI_GUID *)((UINTN)LastDevicePathNode +\r
OFFSET_OF (VENDOR_DEVICE_PATH, Guid));\r
if (CompareGuid (VendorDefinedGuid, &gUdfDevPathGuid)) {\r
// Close Device Path protocol on ControllerHandle\r
//\r
gBS->CloseProtocol (\r
- ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- ControllerHandle\r
- );\r
+ ControllerHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
\r
return Status;\r
}\r