TianoCore EDK2 master
Loading...
Searching...
No Matches
Udf.c File Reference
#include "Partition.h"

Go to the source code of this file.

Data Structures

struct  UDF_DEVICE_PATH
 

Macros

#define MAX_CORRECTION_BLOCKS_NUM   512u
 
#define EFI_UDF_DEVICE_PATH_GUID
 

Functions

EFI_STATUS FindAnchorVolumeDescriptorPointer (IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint, OUT EFI_LBA *LastRecordedBlock)
 
EFI_STATUS FindUdfVolumeIdentifiers (IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo)
 
BOOLEAN IsLogicalVolumeDescriptorSupported (UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc)
 
EFI_STATUS FindLogicalVolumeLocation (IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint, IN EFI_LBA LastRecordedBlock, OUT UINT64 *MainVdsStartBlock, OUT UINT64 *MainVdsEndBlock)
 
EFI_STATUS FindUdfFileSystem (IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT EFI_LBA *StartingLBA, OUT EFI_LBA *EndingLBA)
 
EFI_STATUS PartitionInstallUdfChildHandles (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 

Variables

EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID
 
UDF_DEVICE_PATH gUdfDevicePath
 

Detailed Description

Scan for an UDF file system on a formatted media.

Caution: This file requires additional review when modified. This driver will have external input - CD/DVD media. This external input must be validated carefully to avoid security issue like buffer overflow, integer overflow.

FindUdfFileSystem() routine will consume the media properties and do basic validation.

Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc. Copyright (C) 2014-2017 Paulo Alcantara pcacj.nosp@m.r@zy.nosp@m.tor.c.nosp@m.om Copyright (c) 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Udf.c.

Macro Definition Documentation

◆ EFI_UDF_DEVICE_PATH_GUID

#define EFI_UDF_DEVICE_PATH_GUID
Value:
{ 0xC5BD4D42, 0x1A76, 0x4996, \
{ 0x89, 0x56, 0x73, 0xCD, 0xA3, 0x26, 0xCD, 0x0A } \
}

Definition at line 26 of file Udf.c.

◆ MAX_CORRECTION_BLOCKS_NUM

#define MAX_CORRECTION_BLOCKS_NUM   512u

Definition at line 21 of file Udf.c.

Function Documentation

◆ FindAnchorVolumeDescriptorPointer()

EFI_STATUS FindAnchorVolumeDescriptorPointer ( IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_DISK_IO_PROTOCOL DiskIo,
OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER AnchorPoint,
OUT EFI_LBA LastRecordedBlock 
)

Find the anchor volume descriptor pointer.

Parameters
[in]BlockIoBlockIo interface.
[in]DiskIoDiskIo interface.
[out]AnchorPointAnchor volume descriptor pointer.
[out]LastRecordedBlockLast recorded block.
Return values
EFI_SUCCESSAnchor volume descriptor pointer found.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
otherAnchor volume descriptor pointer not found.

Definition at line 70 of file Udf.c.

◆ FindLogicalVolumeLocation()

EFI_STATUS FindLogicalVolumeLocation ( IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_DISK_IO_PROTOCOL DiskIo,
IN UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER AnchorPoint,
IN EFI_LBA  LastRecordedBlock,
OUT UINT64 *  MainVdsStartBlock,
OUT UINT64 *  MainVdsEndBlock 
)

Find UDF logical volume location and whether it is supported by current EDK2 UDF file system implementation.

Parameters
[in]BlockIoBlockIo interface.
[in]DiskIoDiskIo interface.
[in]AnchorPointAnchor volume descriptor pointer.
[in]LastRecordedBlockLast recorded block in media.
[out]MainVdsStartBlockMain VDS starting block number.
[out]MainVdsEndBlockMain VDS ending block number.
Return values
EFI_SUCCESSUDF logical volume was found.
EFI_VOLUME_CORRUPTEDUDF file system structures are corrupted.
EFI_UNSUPPORTEDUDF logical volume is not supported.
otherFailed to perform disk I/O.

Definition at line 492 of file Udf.c.

◆ FindUdfFileSystem()

EFI_STATUS FindUdfFileSystem ( IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_DISK_IO_PROTOCOL DiskIo,
OUT EFI_LBA StartingLBA,
OUT EFI_LBA EndingLBA 
)

Find a supported UDF file system in block device.

Attention
This is boundary function that may receive untrusted input.
The input is from Partition.

The CD/DVD media is the external input, so this routine will do basic validation for the media.

Parameters
[in]BlockIoBlockIo interface.
[in]DiskIoDiskIo interface.
[out]StartingLBAUDF file system starting LBA.
[out]EndingLBAUDF file system starting LBA.
Return values
EFI_SUCCESSUDF file system was found.
otherUDF file system was not found.

Definition at line 673 of file Udf.c.

◆ FindUdfVolumeIdentifiers()

EFI_STATUS FindUdfVolumeIdentifiers ( IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_DISK_IO_PROTOCOL DiskIo 
)

Find UDF volume identifiers in a Volume Recognition Sequence.

Parameters
[in]BlockIoBlockIo interface.
[in]DiskIoDiskIo interface.
Return values
EFI_SUCCESSUDF volume identifiers were found.
EFI_NOT_FOUNDUDF volume identifiers were not found.
otherFailed to perform disk I/O.

Definition at line 294 of file Udf.c.

◆ IsLogicalVolumeDescriptorSupported()

BOOLEAN IsLogicalVolumeDescriptorSupported ( UDF_LOGICAL_VOLUME_DESCRIPTOR LogicalVolDesc)

Check if Logical Volume Descriptor is supported by current EDK2 UDF file system implementation.

Parameters
[in]LogicalVolDescLogical Volume Descriptor pointer.
Return values
TRUELogical Volume Descriptor is supported.
FALSELogical Volume Descriptor is not supported.

Definition at line 432 of file Udf.c.

◆ PartitionInstallUdfChildHandles()

EFI_STATUS PartitionInstallUdfChildHandles ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Handle,
IN EFI_DISK_IO_PROTOCOL DiskIo,
IN EFI_DISK_IO2_PROTOCOL DiskIo2,
IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_BLOCK_IO2_PROTOCOL BlockIo2,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath 
)

Install child handles if the Handle supports UDF/ECMA-167 volume format.

Parameters
[in]ThisCalling context.
[in]HandleParent Handle.
[in]DiskIoParent DiskIo interface.
[in]DiskIo2Parent DiskIo2 interface.
[in]BlockIoParent BlockIo interface.
[in]BlockIo2Parent BlockIo2 interface.
[in]DevicePathParent Device Path
Return values
EFI_SUCCESSChild handle(s) was added.
EFI_MEDIA_CHANGEDMedia changed Detected.
otherno child handle was added.

Definition at line 738 of file Udf.c.

Variable Documentation

◆ gUdfDevicePath

UDF_DEVICE_PATH gUdfDevicePath
Initial value:
= {
{
{ MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
{ sizeof (VENDOR_DEVICE_PATH), 0 }
},
EFI_UDF_DEVICE_PATH_GUID
},
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
{ sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
}
}
#define MEDIA_VENDOR_DP
Media vendor device path subtype.
Definition: DevicePath.h:1093

Definition at line 44 of file Udf.c.

◆ gUdfDevPathGuid

EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID

Definition at line 39 of file Udf.c.