udf

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package udf writes UDF 1.02 (ECMA-167) file systems, the format Windows installation ISOs use so that files larger than the ISO9660 4 GiB limit fit. It is paired with package iso to master a bootable UDF + El Torito image.

The writer targets the subset of UDF that Windows accepts (validated by the strict reader in reader.go): a single non-partitioned logical volume, short allocation descriptors, and OSTA CS0 identifiers.

Index

Constants

View Source
const SectorSize = 2048

SectorSize is the UDF logical sector / block size used here (and by CD/DVD media): 2048 bytes.

Variables

This section is empty.

Functions

func Write

func Write(out io.WriterAt, srcDir, volumeID string) error

Write masters a UDF 1.02 file system holding the directory tree at srcDir into out, labelled volumeID.

Types

type Entry added in v0.6.2

type Entry struct {
	Name  string
	IsDir bool
	Size  int64
	// contains filtered or unexported fields
}

Entry is one directory entry.

type Location

type Location struct {
	Sector uint64
	Length int64
}

Location is the absolute sector and byte length of a written file's data.

type Options

type Options struct {
	VolumeID string
	// VRSStart is the first Volume Recognition Sequence sector. Zero means 16.
	// A bridge image that places ISO9660 descriptors at 16-18 sets this to 19.
	VRSStart uint32
}

Options configures a UDF write.

type Result

type Result struct {
	TotalSectors uint64
	Files        map[string]Location
}

Result reports the assembled image's total sector count and the location of every regular file, keyed by slash-separated path relative to the root.

func WriteTree

func WriteTree(out io.WriterAt, srcDir string, opts Options) (*Result, error)

WriteTree masters a UDF 1.02 file system and reports the layout. out is written via WriteAt; file data is streamed so large files are not buffered.

type Volume added in v0.6.2

type Volume struct {
	// contains filtered or unexported fields
}

Volume is a parsed + validated UDF volume. Open it with Read.

func Read added in v0.6.2

func Read(r io.ReaderAt) (*Volume, error)

Read parses and validates the UDF filesystem in r: the Anchor Volume Descriptor Pointer at sector 256, the Main Volume Descriptor Sequence (Partition + Logical Volume descriptors), and the File Set Descriptor's root directory ICB. It returns an error if any descriptor's tag checksum/CRC/location is wrong, the logical block size is not 2048, or a required structure is missing or unreachable — i.e. the same reasons a strict OS rejects the volume.

func (*Volume) ReadDir added in v0.6.2

func (v *Volume) ReadDir(parts []string) ([]Entry, error)

ReadDir returns the entries of the directory at the given slash-separated path (nil/empty = root), validating each File Entry and File Identifier Descriptor.

func (*Volume) ReadFile added in v0.6.2

func (v *Volume) ReadFile(parts []string) ([]byte, error)

ReadFile returns the full content of the file at the slash-separated path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL