Documentation
¶
Index ¶
Constants ¶
const MaxLabelLen = 11
MaxLabelLen is the maximum number of UTF-16 code units storable in the exFAT Volume Label entry (per the exFAT specification §7.3).
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(path string, sizeBytes int64, cfg FormatConfig) (filesystem.Filesystem, error)
Format creates a new exFAT filesystem in the file at path. The file is created (or truncated) and formatted. sizeBytes must be a multiple of the cluster size (4096) and large enough to hold the metadata region plus at least one data cluster.
On success the newly formatted filesystem is opened and returned; the caller must Close it when done.
func Open ¶
func Open(imagePath string, partIndex int) (filesystem.Filesystem, error)
Open opens imagePath, optionally selecting a partition, and parses the exFAT boot sector.
Types ¶
type FormatConfig ¶
type FormatConfig struct {
// Label is the volume label (stored as a volume-label directory entry;
// not in the boot sector for exFAT). Trimmed to 11 characters.
Label string
// VolumeSerialNumber is the 32-bit serial number. A random value is generated when zero.
VolumeSerialNumber uint32
}
FormatConfig holds optional parameters for Format. All fields are optional; sensible defaults are used when left at their zero value.
type Info ¶
type Info struct {
PartitionStartSector uint64
VolumeLength uint64
FATOffset uint32
FATLength uint32
ClusterHeapOffset uint32
ClusterCount uint32
RootDirectoryCluster uint32
VolumeSerialNumber uint32
FileSystemRevision uint16
VolumeFlags uint16
BytesPerSectorShift uint8
SectorsPerClusterShift uint8
NumberOfFATs uint8
DriveSelect uint8
PercentInUse uint8
}
Info holds the fields decoded from the exFAT main boot sector.
func (Info) BytesPerSector ¶
BytesPerSector returns the logical sector size in bytes.
func (Info) ClusterHeapOffsetBytes ¶
ClusterHeapOffsetBytes returns the absolute byte offset of the cluster heap.
func (Info) ClusterSize ¶
ClusterSize returns the allocation cluster size in bytes.
func (Info) FATOffsetBytes ¶
FATOffsetBytes returns the absolute byte offset of the first FAT.
func (Info) RootDirOffset ¶
RootDirOffset returns the absolute byte offset of the root directory cluster.
func (Info) SectorsPerCluster ¶
SectorsPerCluster returns the cluster size expressed in sectors.
