erofs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpGPTVMDKDescriptor added in v0.2.0

func DumpGPTVMDKDescriptor(w io.Writer, cid uint32, layout Layout, headerPath, padFile string) error

DumpGPTVMDKDescriptor writes a VMDK descriptor whose virtual disk is a GPT-partitioned image with one partition per layout.Partitions entry.

headerPath should reference a 34-sector blob produced by Layout.WriteHeader covering LBAs 0..33 (protective MBR, primary GPT header, primary entry array).

When padFile is empty, padding regions are emitted as "RW <count> ZERO" extents. Otherwise padFile must be a zero-filled file of at least max padding-region size; padding regions are emitted as FLAT extents reading from offset 0 of padFile.

func DumpGPTVMDKDescriptorToFile added in v0.2.0

func DumpGPTVMDKDescriptorToFile(vmdkPath string, cid uint32, devices []string) error

DumpGPTVMDKDescriptorToFile generates a GPT-partitioned VMDK at vmdkPath that references the supplied erofs layer files as separate partitions on a single virtual disk. A header blob and (when ZERO extents are not in use) a shared padding file are written next to vmdkPath; no secondary GPT is written since the disk is synthetic and read-only.

The vmdk filename's extension is replaced with "_header.bin" and "_pad.bin" suffixes to derive the auxiliary filenames; e.g. for "/x/merged_fs_gpt.vmdk" the auxiliary files are "/x/merged_fs_gpt_header.bin" and (if applicable) "/x/merged_fs_gpt_pad.bin".

func DumpVMDKDescriptor

func DumpVMDKDescriptor(w io.Writer, cid uint32, devices []string) error

DumpVMDKDescriptor writes a monolithicFlat VMDK descriptor to w. Extent path strings are written verbatim from devices.

func DumpVMDKDescriptorToFile

func DumpVMDKDescriptorToFile(vmdkdesc string, cid uint32, devices []string) error

Types

type Layout added in v0.2.0

type Layout struct {
	SectorSize   uint64
	AlignSectors uint64
	TotalSectors uint64
	DiskGUID     [16]byte
	Partitions   []Partition
}

Layout describes the GPT layout for a list of erofs layer files.

func ComputeLayout added in v0.2.0

func ComputeLayout(layerPaths []string) (Layout, error)

ComputeLayout builds a GPT Layout for the supplied erofs layer files. The first path becomes partition 1, the second becomes partition 2, and so on. Layer file sizes are read via os.Stat.

func (Layout) FirstUsableLBA added in v0.2.0

func (l Layout) FirstUsableLBA() uint64

FirstUsableLBA returns the first LBA available for partition data.

func (Layout) LastUsableLBA added in v0.2.0

func (l Layout) LastUsableLBA() uint64

LastUsableLBA returns the last LBA available for partition data.

func (Layout) WriteHeader added in v0.2.0

func (l Layout) WriteHeader(w io.Writer) error

WriteHeader writes the protective MBR + primary GPT header + primary partition entry array, totalling gptReservedSectors (34) sectors. The secondary GPT is omitted: this disk is synthetic and read-only, so backup recovery is not needed.

type Partition added in v0.2.0

type Partition struct {
	GUID      [16]byte
	TypeGUID  [16]byte
	FirstLBA  uint64
	LastLBA   uint64
	Name      string
	Source    string
	SizeBytes uint64
}

Partition describes a single GPT partition slot for an erofs layer.

func (Partition) SectorCount added in v0.2.0

func (p Partition) SectorCount() uint64

SectorCount returns the number of 512-byte sectors covered by the partition.

Jump to

Keyboard shortcuts

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