UDF

From OSDev Wiki
Jump to navigation Jump to search
Filesystems
Virtual Filesystems

VFS

Disk Filesystems
CD/DVD Filesystems
Network Filesystems
Flash Filesystems

The Universal Disc Format or UDF is the filesystem used on DVDs and Blu-Ray discs. It is similar to the CDFS (ISO 9660) file system, but it includes many extended features, such as incremental updates, which allows files to be deleted or updated over time.

Volume Structure

Like the CDFS file system, the UDF file system uses a 2048 byte sector size, and it designates that the first 16 sectors can be used by the OS to store proprietary data or boot logic. It also, like CDFS, uses 2048 byte aligned descriptors, starting at sector 16, to record the UDF specific information to locate additional volumes, partitions and files located on the disc. It also supports the inclusion of descriptors from other file systems for compatibility with other media formats, operating systems and devices.

The descriptors located at sector 16 (0x10) all use the same general layout as the CDFS volume descriptor:

Offset Length (bytes) Field name Datatype Description
0 1 Type int8 Volume Descriptor type code (see below).
1 5 Identifier strA Designates the type of descriptor.
6 1 Version int8 Volume Descriptor Version (0x01).
7 2041 Data - Depends on the volume descriptor type.

The identifier field is used to determine the type of the descriptor:

Identifier Description
"CD001" Indicates that this volume contains an ISO 9660 file system.
"BEA01" Denotes the beginning of the extended descriptor section.
"NSR02" Indicates that this volume contains a UDF file system.
"NSR03" Indicates that this volume contains a UDF file system.
"BOOT2" Includes information concerning boot loader location and entry point address.
"TEA01" Denotes the end of the extended descriptor section.

The presence of an NSR02 or NSR03 descriptor denotes that there is a valid UDF file system located on this volume, and that there is an Anchor Volume Descriptor Pointer located in sector 256 (0x100), with backup copies located in the last sector of the volume and/or the sector located 256 sectors from the end of the volume.

Anchor Volume Descriptor Pointer

The Anchor Volume Descriptor Pointer is a descriptor that contains the location of the Main Volume Descriptor and the backup Reserve Volume Descriptor.

Offset Length (bytes) Field name Datatype Description
0 16 DescriptorTag struct Contains the descriptor type, version and checksum information for this descriptor.
16 8 MainVolumeDescriptorSequenceExtent struct Contains the sector and length of the main volume descriptor sequence.
24 8 ReserveVolumeDescriptorSequenceExtent struct Contains the sector and length of the backup volume descriptor sequence.
32 480 Reserved - Reserved for future use.

Descriptor Tag

The descriptor tag structure is used by all UDF descriptors to designate the descriptor type and to verify data integrity.

Offset Length (bytes) Field name Datatype Description
0 2 TagIdentifier uint16 Contains the descriptor type.
2 2 DescriptorVersion uint16 Contains the version of the descriptor tag.
4 1 TagChecksum uint8 Used to verify the data within the Descriptor Tag structure.
5 1 Reserved uint8 Reserved for future use.
6 2 TagSerialNumber uint16 Unique serial number for this volume
8 2 DescriptorCRC uint16 Used to verify the data with the Descriptor Tag structure.
10 2 DescriptorCRCLength uint16 Used to verify the data with the Descriptor Tag structure.
12 4 TagLocation uint32 Contains the sequence number of this descriptor.

The TagIdentifier field will have one of the following values:

Identifier (Hex) Description
0x0001 Primary Volume Descriptor
0x0002 Anchor Volume Descriptor Pointer
0x0003 Volume Descriptor Pointer
0x0004 Implementation Use Volume Descriptor
0x0005 Partition Descriptor
0x0006 Logical Volume Descriptor
0x0007 Unallocated Space Descriptor
0x0008 Terminating Descriptor
0x0009 Logical Volume Integrity Descriptor
0x0100 File Set Descriptor
0x0101 File Identifier Descriptor
0x0102 Allocation Extent Descriptor
0x0103 Indirect Entry
0x0104 Terminal Entry
0x0105 File Entry
0x0106 Extended Attribute Header Descriptor
0x0107 Unallocated Space Entry
0x0108 Space Bitmap Descriptor
0x0109 Partition Integrity Entry
0x010a Extended File Entry

Extent Structure

The extent structure is used to locate data on the current volume. It contains the sector index (relative to the beginning of the volume), and the length of the data.

Offset Length (bytes) Field name Datatype Description
0 4 Length uint32 Contains the length, in bytes, of the data pointed to by this extent.
4 4 Location uint32 Contains the sector index of the data, relative to the beginning of the volume.

Volume Descriptor Sequence

The Main (and Reserve) Volume Sequence can be found by reading the extent information located in the Anchor Volume Descriptor Pointer record above. Starting at the sector specified in the Location field of the extent structure, several Volume Descriptors will be found. Each of these descriptors will provide additional information about this volume. The Terminating Descriptor (0x0008) marks the end of the Volume Descriptor Sequence.

Note: Only Volume Descriptors (0x0001 to 0x0009) are allowed in the Volume Descriptor Sequence.

Note: The UDF Specifications state that the minimum extent size for the Volume Descriptor Sequence is 16 sectors, so there may be empty descriptor blocks after the Terminating Descriptor block, which can be ignored.

Logical Volume Descriptor

The Logical Volume Descriptor (0x0006) contains information concerning the Logical Volume, including a pointer to the File Set Descriptor.

Offset Length (bytes) Field name Datatype Description
0 16 Tag struct The volume tag for this descriptor.
16 4 Volume Sequence Number uint32 The sequence number of this Logical Volume.
20 64 Descriptor Character Set struct The character set used in this descriptor.
84 128 Logical Volume Identifier Compressed Unicode The name of the logical volume.
212 4 Logical Block Size uint32 The block size of the logical volume.
216 32 Domain Identifier struct The domain identifier for this volume.
248 16 Logical Volume Contents Use byte[] Area reserved for content use.
264 4 Map Table Length uint32 The length of the map table in bytes.
268 4 Number Of Partition Maps uint32 The number of partition map records in this descriptor.
272 32 Implementation Identifier struct The implementation identifier for this volume.
304 128 Implementation Use byte[] Area reserved for implementation use.
432 8 Integrity Sequence Extent struct The extent of the integrity sequence, if any.
440 * Partition Maps struct[] The map of partitions on this logical volume.


External Links