Documentation
¶
Overview ¶
Package efs reads the SGI EFS filesystem: 512-byte basic blocks, 128-byte inodes grouped in cylinder groups, extent-mapped files. Read only — this package serves install media, it never writes.
Index ¶
Constants ¶
const ( SuperMagic = 0x00072959 SuperMagicGrown = 0x0007295a )
SuperMagic is the classic EFS superblock magic. SuperMagicGrown marks a grown filesystem; both are accepted.
const RootIno uint32 = 2
RootIno is the inode number of the filesystem root directory.
Variables ¶
var ErrNotFound = errors.New("efs: not found")
ErrNotFound reports that a path component does not name an entry. It is distinct from an I/O or corruption error reading the filesystem, so a caller can map a genuine absence to fs.ErrNotExist while surfacing a real read failure as itself rather than a misleading "not found".
Functions ¶
This section is empty.
Types ¶
type Extent ¶
type Extent struct {
Block uint32 // first basic block, filesystem-relative
Len uint32 // run length in blocks
Offset uint32 // logical block offset within the file
}
Extent is one contiguous run of basic blocks. Offset is the logical block position within the file; a gap between extents is a hole that reads as zeros.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is an open EFS filesystem over a block image.
func Open ¶
Open reads and validates the superblock of the EFS filesystem starting at baseBlock (in 512-byte blocks) within r.
func (*FS) FSys ¶ added in v0.2.0
FSys returns an io/fs.FS view of the filesystem: path-addressed and read only. It also satisfies fs.ReadDirFS, fs.StatFS and fs.ReadLinkFS. Symlinks are left unfollowed, exactly as Lookup leaves them, so a caller resolves them through ReadLink; opened regular files also satisfy io.ReaderAt, so a server random-accesses a product file without buffering it.
func (*FS) Lookup ¶
Lookup resolves a slash-separated path from the root. Symlinks in the path are not followed; install media use them rarely and the callers serve them as links.
func (*FS) ReadAt ¶
ReadAt reads from the file at byte offset off into p, returning io.EOF past the end as io.ReaderAt requires. Holes between extents read as zeros.
type Inode ¶
type Inode struct {
Num uint32
Mode uint16
Nlink int16
UID uint16
GID uint16
Size int32
Atime uint32
Mtime uint32
Ctime uint32
Gen int32
Extents []Extent // sorted by Offset
}
Inode is a parsed EFS inode.
type Stat ¶ added in v0.2.0
Stat is the FileInfo.Sys() value for every entry an EFS fs view returns: the owner, link count, and full mode io/fs.FileInfo cannot carry on its own. Mode is the raw inode mode, including the setuid, setgid, and sticky bits that FileInfo.Mode() masks away, so a caller that serves those bits can recover them.