squashfslow

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 15 Imported by: 1

README

Lower-Level Squashfs

This library is a lower level version of the main squashfs library that doesn't try to be easy to use and exposes a lot of information that is not necesary for must use cases.

I will try to keep the API stable, but it is not guarenteed.

Documentation

Index

Constants

View Source
const (
	ZlibCompression = uint16(iota + 1)
	LZMACompression
	LZOCompression
	XZCompression
	LZ4Compression
	ZSTDCompression
)

The types of compression supported by squashfs

Variables

View Source
var (
	ErrorMagic         = errors.New("magic incorrect. probably not reading squashfs archive or archive is corrupted")
	ErrorLog           = errors.New("block log is incorrect. possible corrupted archive")
	ErrorVersion       = errors.New("squashfs version of archive is not 4.0. may be corrupted")
	ErrorNotExportable = errors.New("archive does not have an export table")
)

Functions

This section is empty.

Types

type CreateFunction added in v1.4.0

type CreateFunction[T any] = func(io.Reader) (T, error)

type Directory

type Directory struct {
	FileBase
	Entries []directory.Entry
}

func (Directory) Open

func (d Directory) Open(r Reader, path string) (FileBase, error)

type FileBase

type FileBase struct {
	Inode inode.Inode
	Name  string
}

func (FileBase) GetFullReader

func (b FileBase) GetFullReader(r *Reader) (data.FullReader, error)

func (FileBase) GetRegFileReaders

func (b FileBase) GetRegFileReaders(r Reader) (data.Reader, data.FullReader, error)

Returns a regular file's readers. They are linked, so the data.Reader calls to the data.FullReader. Aka: closing the FullReader breaks the Reader

func (FileBase) Gid

func (b FileBase) Gid(r *Reader) (uint32, error)

func (FileBase) IsDir

func (b FileBase) IsDir() bool

func (FileBase) IsRegular

func (b FileBase) IsRegular() bool

func (FileBase) ToDir

func (b FileBase) ToDir(r Reader) (Directory, error)

func (FileBase) Uid

func (b FileBase) Uid(r *Reader) (uint32, error)

type InodeRef added in v1.4.0

type InodeRef = uint64

type Reader

type Reader struct {
	Root       Directory
	Superblock superblock
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.ReaderAt) (rdr Reader, err error)

func (Reader) BaseFromEntry

func (r Reader) BaseFromEntry(e directory.Entry) (FileBase, error)

func (Reader) BaseFromInode

func (r Reader) BaseFromInode(i inode.Inode, name string) FileBase

func (Reader) BaseFromRef

func (r Reader) BaseFromRef(ref uint64, name string) (FileBase, error)

func (*Reader) Id

func (r *Reader) Id(i uint16) (uint32, error)

Get a uid/gid at the given index. Lazily populates the reader's Id table as necessary.

func (Reader) Inode

func (r Reader) Inode(i uint32) (inode.Inode, error)

func (Reader) InodeFromEntry

func (r Reader) InodeFromEntry(e directory.Entry) (inode.Inode, error)

func (Reader) InodeFromRef

func (r Reader) InodeFromRef(ref InodeRef) (inode.Inode, error)

type Table added in v1.4.0

type Table[T any] struct {
	// contains filtered or unexported fields
}

func NewTable added in v1.4.0

func NewTable[T any](rdr *Reader, start uint64, totalItems uint32, createFunc CreateFunction[T]) *Table[T]

func (*Table[T]) Get added in v1.4.0

func (t *Table[T]) Get(requestedItemIndex uint32) (T, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL