Documentation ¶
Overview ¶
Package fat contains the actual File Allocation Table used by the FAT filesystem.
Methods which modify the FAT itself are NOT thread-safe (Allocate / Set / Close), and must be write-locked.
Methods which read from the FAT are thread-safe (Get) among themselves, and can be read-locked.
Index ¶
- Variables
- type FAT
- func (f *FAT) Allocate() (uint32, error)
- func (f *FAT) Close() error
- func (f *FAT) EOFValue() uint32
- func (f *FAT) FreeCount() (int64, error)
- func (f *FAT) FreeValue() uint32
- func (f *FAT) Get(cluster uint32) (uint32, error)
- func (f *FAT) IsEOF(e uint32) bool
- func (f *FAT) IsFree(e uint32) bool
- func (f *FAT) Set(value uint32, cluster uint32) error
- func (f *FAT) SetHardError() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHardIO indicates there was an unrecoverable error. ErrHardIO = errors.New("FAT: Hard Error I/O bit set. Run 'fsck <device> fat' on the partition containing this filesystem") // ErrDirtyFAT indicates the FAT was not unmounted properly. ErrDirtyFAT = errors.New("FAT: Dirty volume bit set. Run 'fsck <device> fat' on the partition containing this filesystem") // ErrNotOpen indicates the FAT cannot be accessed because it is not open. ErrNotOpen = errors.New("FAT: FAT not open") // ErrInvalidCluster indicates the provided cluster is invalid. ErrInvalidCluster = errors.New("FAT: Attempting to access FAT with invalid cluster") // ErrNoSpace indicates there is no remaining space in the FAT. ErrNoSpace = fs.ErrNoSpace )
Functions ¶
This section is empty.
Types ¶
type FAT ¶
type FAT struct {
// contains filtered or unexported fields
}
FAT holds the File Allocation Table.
func Open ¶
func Open(d *thinio.Conductor, br *bootrecord.Bootrecord, readonly bool) (*FAT, error)
Open opens a new File Allocation Table. This FAT will NOT be thread-safe; thread safety will need to be implemented by the layer above the FAT.
If the filesystem is writeable, also marks the dirty bit as "dirty".
func (*FAT) Allocate ¶
Allocate returns the next known free cluster, starting from cluster "start". If a cluster is found, it is set to an EOF value (instead of free).
If start is invalid, it is ignored. If no entries remain, an error is returned.
func (*FAT) Close ¶
Close closes a File Allocation Table.
If the filesystem was writeable, this marks the dirty bit as "clean".
func (*FAT) EOFValue ¶
EOFValue returns the FAT value that means "end of file". Notably, there are multiple values that mean EOF to FAT.
func (*FAT) Get ¶
Get gets the value of a cluster entry. Can only be used to access clusters which are not reserved. Returns an error if accessing out-of-bounds cluster.
func (*FAT) Set ¶
Set sets the value of a cluster entry.
Returns an error if accessing an out-of-bounds cluster, or setting a cluster to point to itself.
func (*FAT) SetHardError ¶
SetHardError marks that the volume has encountered a disk I/O error.