Skip to main content

Crate udf_core

Crate udf_core 

Source
Expand description

UDF (Universal Disk Format) — detection and file-entry traversal.

UDF bridge discs carry both ISO 9660 and UDF structures on the same sectors. The UDF recognition sequence starts at sector 16: each Volume Structure Descriptor is 2048 bytes with a 5-byte identifier at bytes 1-5.

Identifiers: “BEA01” (Extended Area Descriptor), “NSR02” or “NSR03” (OSTA CS0 UDF mark), “TEA01” (Terminating Extended Area Descriptor). NSR02/NSR03 presence is the definitive UDF indicator.

§Full UDF traversal

Descriptor chain: AVDP (LBA 256) → VDS → Partition Descriptor (partition start LBA) + Logical Volume Descriptor (FSD location) → File Set Descriptor (root dir FE LBA) → File Entry → File Identifier Descriptors.

All physical LBAs satisfy: phys_lba = partition_start + logical_block_num.

Re-exports§

pub use xattr::parse_extended_attributes;
pub use xattr::UdfEaKind;
pub use xattr::UdfExtendedAttribute;

Modules§

xattr
UDF extended attributes (ECMA-167 4/14.10).

Structs§

UdfFileEntry
A single entry returned by UDF directory traversal.
UdfState

Enums§

UdfPartitionKind
The kind of partition referenced by the UDF logical volume’s file set.

Constants§

MAX_BLOCK_SIZE
Largest logical block size we read into a stack sector buffer.
TAG_AVDP
TAG_EFE
TAG_FE
TAG_FE_ALT
Some UDF implementations (e.g. older genisoimage) write 261 for File Entry.
TAG_FID
TAG_FSD
TAG_LVD
TAG_PD
TAG_TERM

Functions§

decode_symlink_target
Decode a UDF symbolic link’s PATH_COMPONENT record chain (ECMA-167 4/14.16.2, OSTA UDF 2.01 §2.2.8) into its target path, following the Linux kernel’s udf_pc_to_char semantics (fs/udf/symlink.c):
descriptor_label
Human-readable label for a descriptor tag identifier, or None for an identifier this crate does not recognise (so the caller does not validate a non-descriptor sector).
detect_udf
True if the image has a UDF recognition sequence (NSR02 or NSR03).
ecma167_crc
The ECMA-167 descriptor CRC (3/7.2): CRC-CCITT with polynomial 0x1021, initial value 0x0000, no input/output reflection and no final XOR, computed over the descriptor body (the bytes after the 16-byte tag).
fe_modification_time
The Modification Time of a File Entry sector (is_efe selects the Extended File Entry layout, whose extra Object Size + Creation Time fields shift the timestamps): base FE modification time is at offset 84, EFE at offset 92.
fe_slack_nonzero
Count the non-zero bytes in a File Entry’s final-block slack — the unused tail of the last logical block after InformationLength, since a file occupies whole logical blocks.
fsd_recording_time
Read the File Set Descriptor’s recording time (4/14.1, offset 16) from the FSD at fsd_lba. Ok(None) when the sector is not an FSD or the time is unset.
parse_udf_state
Try to parse the AVDP → VDS → FSD chain, returning state needed for directory traversal. Returns None if the image lacks a valid UDF structure.
parse_udf_state_checked
Parse the AVDP → VDS → FSD bootstrap chain, distinguishing a real read failure from a structural negative.
read_dir_at_lba
Read all non-parent File Identifier Descriptors from the directory whose File Entry resides at dir_fe_lba, returning one UdfFileEntry per child.
read_fe_data
Read the data extent of the File Entry at fe_lba.
read_fe_extended_attributes
Read the extended attributes of the File Entry at fe_lba.
seek_read_checked
Seek to byte_pos and read exactly buf.len() bytes, propagating the real io::Error (a truncated image yields io::ErrorKind::UnexpectedEof).
tag_checksum
The ECMA-167 descriptor-tag checksum (3/7.2): the mod-256 sum of the 16 tag bytes excluding byte 4 (the checksum field itself).