fat

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package fat implements a FAT32 create engine behind image.Filesystem.

FAT is a DOS filesystem: it has no owners, permissions, symlinks or hard links, so those tree attributes are dropped when writing (symlinks are an error). Its primary use in fsforge is EFI System Partitions and boot/data volumes. Long names are stored with VFAT LFN entries plus a generated 8.3 short name; the layout is deterministic for reproducible images.

Only FAT32 is implemented (the variant that matters for ESPs); FAT12/16 can be added later behind the same engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FAT

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

FAT is the FAT12/16/32 create engine, implementing image.Filesystem. The FAT width is chosen from the volume size unless forced with WithFATBits. It writes ESP/boot/data volumes (long file names with generated 8.3 aliases) whose images pass fsck.fat. Being a DOS-lineage format it has no owners, permissions or links. Open is not yet supported (mutation rebuilds).

func New

func New(deps image.Deps, opts ...Option) *FAT

New returns a FAT engine wired with deps.

func (*FAT) Format

func (e *FAT) Format(dev device.Device, p image.Params) (image.Image, error)

Format prepares a fresh FAT volume sized to fill dev, choosing FAT12/16/32 from the volume size (or the width forced via WithFATBits). p.Label sets the volume label, defaulting to "NO NAME". It fails if dev is too small for the selected FAT width.

func (*FAT) Open

func (e *FAT) Open(device.Device) (image.Image, error)

Open is not supported yet; FAT mutation will rebuild like squashfs.

type Option

type Option func(*FAT)

Option configures a FAT engine; pass options to New.

func WithFATBits

func WithFATBits(bits int) Option

WithFATBits forces the FAT type (12, 16 or 32) instead of auto-selecting by size. Useful for ESPs, which conventionally use FAT32 (or FAT16).

Jump to

Keyboard shortcuts

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