Documentation ¶
Overview ¶
Package bootrecord describes the first sectors of a partition, which hold filesystem metadata.
Index ¶
- Constants
- type Bootrecord
- func (b *Bootrecord) ClusterInValidRange(cluster uint32) bool
- func (b *Bootrecord) ClusterLocationData(cluster uint32) int64
- func (b *Bootrecord) ClusterLocationFAT(indexFAT, cluster uint32) int64
- func (b *Bootrecord) ClusterLocationFATPrimary(cluster uint32) int64
- func (b *Bootrecord) ClusterSize() uint32
- func (b *Bootrecord) FATEntrySize() uint32
- func (b *Bootrecord) FsInfoOffset() (int64, error)
- func (b *Bootrecord) MirroringInfo() (active bool, numFATs, primary uint32)
- func (b *Bootrecord) NumUsableClusters() uint32
- func (b *Bootrecord) RootCluster() uint32
- func (b *Bootrecord) RootReservedInfo() (offsetStart int64, numRootEntriesMax int64)
- func (b *Bootrecord) Type() FATType
- func (b *Bootrecord) VolumeSize() int64
- type FATType
Constants ¶
const ( // NumReservedClusters describes how many cluster numbers are reserved (FAT[0] and FAT[1]). NumReservedClusters uint32 = 2 // BootrecordSize is the size of a bootrecord BootrecordSize = 512 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bootrecord ¶
type Bootrecord struct {
// contains filtered or unexported fields
}
Bootrecord describes the underlying boot record, independent of FAT type.
func New ¶
func New(d *thinio.Conductor) (*Bootrecord, error)
New returns a new Bootrecord described by the first 512 bytes of a partition. Returns an error if the first 512 bytes of the partition do not match a known (or supported) FAT version.
func (*Bootrecord) ClusterInValidRange ¶
func (b *Bootrecord) ClusterInValidRange(cluster uint32) bool
ClusterInValidRange checks that the cluster is in a valid range. It does not access the entry corresponding to the cluster.
func (*Bootrecord) ClusterLocationData ¶
func (b *Bootrecord) ClusterLocationData(cluster uint32) int64
ClusterLocationData returns the device offset for a cluster's data.
func (*Bootrecord) ClusterLocationFAT ¶
func (b *Bootrecord) ClusterLocationFAT(indexFAT, cluster uint32) int64
ClusterLocationFAT returns device offset for a particular cluster index in an arbitrary File Allocation Table.
func (*Bootrecord) ClusterLocationFATPrimary ¶
func (b *Bootrecord) ClusterLocationFATPrimary(cluster uint32) int64
ClusterLocationFATPrimary returns device offset for a particular cluster index in the primary File Allocation Table.
func (*Bootrecord) ClusterSize ¶
func (b *Bootrecord) ClusterSize() uint32
ClusterSize returns the size of a single cluster. The size of a single cluster should be a power of two multiple of the sector size.
func (*Bootrecord) FATEntrySize ¶
func (b *Bootrecord) FATEntrySize() uint32
FATEntrySize returns the size (in bytes) of a single entry in the FAT.
func (*Bootrecord) FsInfoOffset ¶
func (b *Bootrecord) FsInfoOffset() (int64, error)
FsInfoOffset returns the offset in the device of the FS Info structure, or an error if the value is invalid.
func (*Bootrecord) MirroringInfo ¶
func (b *Bootrecord) MirroringInfo() (active bool, numFATs, primary uint32)
MirroringInfo describes if mirroring is necessary.
If mirroring is active, returns "true", along with the number of FATs which need to be mirrored. If mirroring is disabled, returns "false", along with the primary FAT which should be used.
func (*Bootrecord) NumUsableClusters ¶
func (b *Bootrecord) NumUsableClusters() uint32
NumUsableClusters returns the number of non-reserved sectors.
func (*Bootrecord) RootCluster ¶
func (b *Bootrecord) RootCluster() uint32
RootCluster returns the cluster number of the root directory. Returns an error if the root directory is not found in a cluster (as is the case for FAT12 and FAT16).
func (*Bootrecord) RootReservedInfo ¶
func (b *Bootrecord) RootReservedInfo() (offsetStart int64, numRootEntriesMax int64)
RootReservedInfo provides information for the root directory on FAT12 and FAT16 filesystems.
func (*Bootrecord) Type ¶
func (b *Bootrecord) Type() FATType
Type returns the type of the underlying Bootrecord.
func (*Bootrecord) VolumeSize ¶
func (b *Bootrecord) VolumeSize() int64
VolumeSize returns the size of all sectors allocated to the FAT filesystem.