Documentation
¶
Index ¶
- func AllocateAndIncrementBlock(block *uint32, size uint32) uint32
- func NewPrimaryVolumeDescriptor(...) (*spec.PrimaryVolumeDescriptor, error)
- func RelocateTree(root *Directory, block *uint32)
- type BlockWriter
- type Directory
- func (d *Directory) Add(f RelocatableFileSection)
- func (d *Directory) Entries() []spec.FileSection
- func (d *Directory) Location() uint32
- func (d *Directory) Parent() *Directory
- func (d *Directory) ParentRecord() spec.DirectoryRecord
- func (d *Directory) PointerRecord() spec.DirectoryRecord
- func (d *Directory) Relocate(newLocation uint32)
- func (d *Directory) SelfRecord() spec.DirectoryRecord
- func (d *Directory) Walk(depthFirst bool) iter.Seq[RelocatableFileSection]
- func (d *Directory) WriteTo(w io.Writer) (int64, error)
- type File
- type PathTable
- type RelocatableFileSection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPrimaryVolumeDescriptor ¶
func NewPrimaryVolumeDescriptor( systemIdentifier, volumeIdentifier, volumeSetIdentifier, publisherIdentifier, dataPreparerIdentifier, applicationIdentifier string, volumeSpaceSize uint32, pathTableSize uint32, pathTableLLocationBlockNumber uint32, pathTableLOptionalLocationBlockNumber uint32, pathTableMLocationBlockNumber uint32, pathTableMOptionalLocationBlockNumber uint32, rootDirectory *Directory, ) (*spec.PrimaryVolumeDescriptor, error)
func RelocateTree ¶
Types ¶
type BlockWriter ¶
type BlockWriter struct {
// contains filtered or unexported fields
}
func NewBlockWriter ¶
func NewBlockWriter(wrapped io.Writer) *BlockWriter
func (*BlockWriter) BytesWritten ¶
func (w *BlockWriter) BytesWritten() int64
func (*BlockWriter) WriteBlock ¶
func (w *BlockWriter) WriteBlock(number uint32, contents io.WriterTo) error
func (*BlockWriter) WriteBlockFunc ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
func NewEmptyDirectory ¶
func (*Directory) Add ¶
func (d *Directory) Add(f RelocatableFileSection)
Add adds a file section as a direct descendant of a directory.
IMPORTANT: since file sections and identifiers themselves are not directly comparable, it is up to the caller to ensure entries are inserted in a spec-compliant sorting order. To ensure this, use spec.CompareDirectoryEntries before invoking Add.
func (*Directory) Entries ¶
func (d *Directory) Entries() []spec.FileSection
func (*Directory) ParentRecord ¶
func (d *Directory) ParentRecord() spec.DirectoryRecord
func (*Directory) PointerRecord ¶
func (d *Directory) PointerRecord() spec.DirectoryRecord
func (*Directory) SelfRecord ¶
func (d *Directory) SelfRecord() spec.DirectoryRecord
func (*Directory) Walk ¶
func (d *Directory) Walk(depthFirst bool) iter.Seq[RelocatableFileSection]
Walk returns all directory descendants, including itself, in either breadth-first or depth-first order. In breadth- first mode, Walk should obey the ordering constraints implied by spec.CompareDirectoryEntries.
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) PointerRecord ¶
func (f *File) PointerRecord() spec.DirectoryRecord
type PathTable ¶
type PathTable struct {
// contains filtered or unexported fields
}
func NewPathTable ¶
func (*PathTable) LPathTable ¶
func (p *PathTable) LPathTable() spec.LPathTable
func (*PathTable) MPathTable ¶
func (p *PathTable) MPathTable() spec.MPathTable
type RelocatableFileSection ¶
type RelocatableFileSection interface { spec.FileSection Location() uint32 Relocate(newLocation uint32) // contains filtered or unexported methods }
RelocatableFileSection is an extension of spec.FileSection that allows for relocating the file section (which is generally the same thing as a file or directory).
This delegates locating files/directories on a disk to the caller, which allows for some separation of concerns and is generally neater than trying to tell a directory 'start on this block and allocate as you please'. In addition, it solves the problem of path table generation, since a path table size depends on the size of the directory tree, and should come before a directory on disk (this produces a chicken- and-egg problem).