squashfs

package
v0.0.0-...-4f60042 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UncompressedInodes    = 0x0001
	UncompressedData      = 0x0002
	Check                 = 0x0004
	UncompressedFragments = 0x0008
	NoFragments           = 0x0010
	AlwaysFragments       = 0x0020
	Duplicates            = 0x0040
	Exportable            = 0x0080
	UncompressedXAttrs    = 0x0100
	NoXAttrs              = 0x0200
	CompressorOptions     = 0x0400
	UncompressedIds       = 0x0800
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicDirectory

type BasicDirectory struct {
	BlockStart        uint32
	HardLinkCount     uint32
	FileSize          uint16
	BlockOffset       uint16
	ParentInodeNumber uint32
}

type BasicFile

type BasicFile struct {
	BlocksStart        uint32
	FragmentBlockIndex uint32
	BlockOffset        uint32
	FileSize           uint32
	BlockSizes         []uint32
}
type BasicSymlink struct {
	HardLinkCount uint32
	TargetSize    uint32
	TargetPath    string
}

type DirInfo

type DirInfo struct {
	// contains filtered or unexported fields
}

func (DirInfo) IsDir

func (d DirInfo) IsDir() bool

func (DirInfo) ModTime

func (d DirInfo) ModTime() time.Time

func (DirInfo) Mode

func (d DirInfo) Mode() fs.FileMode

func (DirInfo) Name

func (d DirInfo) Name() string

func (DirInfo) Size

func (d DirInfo) Size() int64

func (DirInfo) Sys

func (d DirInfo) Sys() any

type Directory

type Directory struct {
	// contains filtered or unexported fields
}

func (Directory) Close

func (d Directory) Close() error

func (Directory) Read

func (d Directory) Read(p []byte) (int, error)

func (Directory) Stat

func (d Directory) Stat() (fs.FileInfo, error)

type DirectoryEntry

type DirectoryEntry struct {
	Offset      uint16
	InodeOffset int16
	InodeNumber uint32
	Start       uint32

	NameSize uint16
	// contains filtered or unexported fields
}

func (DirectoryEntry) Info

func (d DirectoryEntry) Info() (fs.FileInfo, error)

func (DirectoryEntry) IsDir

func (d DirectoryEntry) IsDir() bool

func (DirectoryEntry) Name

func (d DirectoryEntry) Name() string

func (DirectoryEntry) Type

func (d DirectoryEntry) Type() fs.FileMode

type DirectoryHeader

type DirectoryHeader struct {
	Count       uint32
	Start       uint32
	InodeNumber uint32
}

type DirectoryIndex

type DirectoryIndex struct {
	Index    uint32
	Start    uint32
	NameSize uint32
	Name     string
}

type ExtendedDirectory

type ExtendedDirectory struct {
	HardLinkCount     uint32
	FileSize          uint32
	BlockStart        uint32
	ParentInodeNumber uint32
	IndexCount        uint16
	BlockOffset       uint16
	XattrIdx          uint32
	Index             []DirectoryIndex
}

type ExtendedFile

type ExtendedFile struct {
	BlocksStart        uint64
	FileSize           uint64
	Sparse             uint64
	HardLinkCount      uint32
	FragmentBlockIndex uint32
	BlockOffset        uint32
	XattrIdx           uint32
	BlockSizes         []uint32
}
type ExtendedSymlink struct {
	HardLinkCount uint32
	TargetSize    uint32
	TargetPath    string
	XattrIdx      uint32
}

type File

type File struct {
	// contains filtered or unexported fields
}

func (File) Close

func (f File) Close() error

func (*File) Read

func (f *File) Read(buf []byte) (int, error)

func (File) Stat

func (f File) Stat() (fs.FileInfo, error)

type FileInfo

type FileInfo struct {
	// contains filtered or unexported fields
}

func (FileInfo) Gid

func (f FileInfo) Gid() uint16

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) SymlinkTarget

func (f FileInfo) SymlinkTarget() string

func (FileInfo) Sys

func (f FileInfo) Sys() any

func (FileInfo) Uid

func (f FileInfo) Uid() uint16

type FragmentBlockEntry

type FragmentBlockEntry struct {
	Start  uint64
	Size   uint32
	Unused uint32
}

type InodeHeader

type InodeHeader struct {
	InodeType    uint16
	Permissions  uint16
	UidIdx       uint16
	GidIdx       uint16
	ModifiedTime uint32
	InodeNumber  uint32
}

type SqfsFile

type SqfsFile interface {
	// contains filtered or unexported methods
}

prefixed with i, because the fields are named the same and we only have this interface to dedupe some code between extended and basic file, i don't want to have to always to through getters/setters

type SquashFS

type SquashFS struct {
	// contains filtered or unexported fields
}

func New

func New(reader *io.SectionReader) (*SquashFS, error)

func (*SquashFS) Open

func (s *SquashFS) Open(name string) (fs.File, error)

func (*SquashFS) ReadDir

func (s *SquashFS) ReadDir(name string) ([]fs.DirEntry, error)

type SquashInfo

type SquashInfo interface {
	Uid() uint16
	Gid() uint16
	SymlinkTarget() string
}

the default file info struct doesn't contain uid/gid, or info about symlinks and possibly other things. However Sys() let's us return anything. So I suppose callers will have to call Sys() and then dynamically check if it implements the SquashInfo interface.

type Superblock

type Superblock struct {
	Magic               uint32
	InodeCount          uint32
	ModificationTime    uint32
	BlockSize           uint32
	FragmentEntryCount  uint32
	CompressionId       uint16
	BlockLog            uint16
	Flags               uint16
	IdCount             uint16
	VersionMajor        uint16
	VersionMinor        uint16
	RootInodeRef        uint64
	BytesUsed           uint64
	IdTableStart        uint64
	XattrIdTableStart   uint64
	InodeTableStart     uint64
	DirectoryTableStart uint64
	FragmentTableStart  uint64
	ExportTableStart    uint64
}

Jump to

Keyboard shortcuts

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