parser

package
v0.0.0-...-9262430 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROOT_INODE = int64(2)
)

Variables

This section is empty.

Functions

func Debug

func Debug(arg interface{})

func DebugStruct

func DebugStruct()

func DlvBreak

func DlvBreak()

func GetComponents

func GetComponents(path string) []string

func ParseString

func ParseString(reader io.ReaderAt, offset int64, length int64) string

func ParseTerminatedString

func ParseTerminatedString(reader io.ReaderAt, offset int64) string

func ParseUint16

func ParseUint16(reader io.ReaderAt, offset int64) uint16

func ParseUint32

func ParseUint32(reader io.ReaderAt, offset int64) uint32

func ParseUint8

func ParseUint8(reader io.ReaderAt, offset int64) byte

Types

type BlockGroup

type BlockGroup struct {
	Reader  io.ReaderAt
	Profile *EXT4Profile

	GroupDescriptors []*GroupDescriptor

	BlockSize      int64
	InodesPerGroup int64
	InodeSize      int64
}

func NewBlockGroup

func NewBlockGroup(ctx *EXT4Context, r io.ReaderAt) (*BlockGroup, error)

func (*BlockGroup) GetDescriptor

func (self *BlockGroup) GetDescriptor(inode int64) (*GroupDescriptor, error)

func (*BlockGroup) GroupNumber

func (self *BlockGroup) GroupNumber(inode int64) int64

Which block group we need to look at

func (*BlockGroup) OpenInode

func (self *BlockGroup) OpenInode(inode int64) (*Inode, error)

func (*BlockGroup) RelativeIndodeNumber

func (self *BlockGroup) RelativeIndodeNumber(inode int64) int64

The relative inode number in the block group

type DirEntry

type DirEntry struct {
	Inode    int64
	Name     string
	FileMode fs.FileMode
}

type EXT4Context

type EXT4Context struct {
	Reader  io.ReaderAt
	Profile *EXT4Profile

	Header *Header

	Is64Bit bool

	BlockCount                int64
	FirstDataBlockOffset      int64
	GroupDescriptorTableCount int64
	GroupDescriptorCount      int64
	BlockSize                 int64
	GroupsPerFlex             uint32
	InodesPerGroup            int64
	InodeSize                 int64

	BlockGroup *BlockGroup
}

func GetEXT4Context

func GetEXT4Context(reader io.ReaderAt) (*EXT4Context, error)

func (*EXT4Context) DebugString

func (self *EXT4Context) DebugString() string

func (*EXT4Context) OpenInode

func (self *EXT4Context) OpenInode(inode int64, components []string) (*Inode, error)

func (*EXT4Context) OpenInodeWithPath

func (self *EXT4Context) OpenInodeWithPath(components []string) (*Inode, error)

type EXT4Profile

type EXT4Profile struct {
	Off_Ext4DirEntry_Inode              int64
	Off_Ext4DirEntry_RecLen             int64
	Off_Ext4DirEntry_NameLen            int64
	Off_Ext4DirEntry_FileTypeInt        int64
	Off_Ext4DirEntry_FileType           int64
	Off_Ext4DirEntry_Name               int64
	Off_ExtentEntry_FirstLogicalBlock   int64
	Off_ExtentEntry_Length              int64
	Off_ExtentEntry_StartHi             int64
	Off_ExtentEntry_StartLo             int64
	Off_ExtentHeader_Magic              int64
	Off_ExtentHeader_EntryCount         int64
	Off_ExtentHeader_Max                int64
	Off_ExtentHeader_Depth              int64
	Off_ExtentHeader_Generation         int64
	Off_ExtentHeader__EntryArray        int64
	Off_ExtentHeader__IndexEntryArray   int64
	Off_ExtentIndex_FirstLogicalBlock   int64
	Off_ExtentIndex_LeafLo              int64
	Off_ExtentIndex_LeafHi              int64
	Off_GroupDescriptor32_BlockBitmapLo int64
	Off_GroupDescriptor32_InodeBitmapLo int64
	Off_GroupDescriptor32_InodeTableLo  int64
	Off_GroupDescriptor64_BlockBitmapLo int64
	Off_GroupDescriptor64_InodeBitmapLo int64
	Off_GroupDescriptor64_InodeTableLo  int64
	Off_GroupDescriptor64_BlockBitmapHi int64
	Off_GroupDescriptor64_InodeBitmapHi int64
	Off_GroupDescriptor64_InodeTableHi  int64
	Off_Header_Superblock               int64
	Off_Inode__Mode                     int64
	Off_Inode__Uid                      int64
	Off_Inode__UidHi                    int64
	Off_Inode__SizeLo                   int64
	Off_Inode__SizeHi                   int64
	Off_Inode__BlockPointers            int64
	Off_Inode__Atime                    int64
	Off_Inode__AtimeExtra               int64
	Off_Inode__Ctime                    int64
	Off_Inode__CtimeExtra               int64
	Off_Inode__Mtime                    int64
	Off_Inode__MtimeExtra               int64
	Off_Inode__CRtime                   int64
	Off_Inode__CRtimeExtra              int64
	Off_Inode__Dtime                    int64
	Off_Inode__Gid                      int64
	Off_Inode__GidHi                    int64
	Off_Inode__LinksCount               int64
	Off_Inode__BlocksLo                 int64
	Off_Inode__Flags                    int64
	Off_Misc_GD32                       int64
	Off_Misc_GD64                       int64
	Off_Superblock_InodeCount           int64
	Off_Superblock_BlockCountLo         int64
	Off_Superblock_BlockCountHi         int64
	Off_Superblock_FirstDataBlock       int64
	Off_Superblock_FeatureIncompat      int64
	Off_Superblock_FeatureCompat        int64
	Off_Superblock_BlockPerGroup        int64
	Off_Superblock_InodePerGroup        int64
	Off_Superblock_InodeSize            int64
	Off_Superblock_LogBlockSize         int64
	Off_Superblock_LogGroupPerFlex      int64
	Off_Superblock_Magic                int64
}

func NewEXT4Profile

func NewEXT4Profile() *EXT4Profile

func (*EXT4Profile) Ext4DirEntry

func (self *EXT4Profile) Ext4DirEntry(reader io.ReaderAt, offset int64) *Ext4DirEntry

func (*EXT4Profile) ExtentEntry

func (self *EXT4Profile) ExtentEntry(reader io.ReaderAt, offset int64) *ExtentEntry

func (*EXT4Profile) ExtentHeader

func (self *EXT4Profile) ExtentHeader(reader io.ReaderAt, offset int64) *ExtentHeader

func (*EXT4Profile) ExtentIndex

func (self *EXT4Profile) ExtentIndex(reader io.ReaderAt, offset int64) *ExtentIndex

func (*EXT4Profile) GroupDescriptor32

func (self *EXT4Profile) GroupDescriptor32(reader io.ReaderAt, offset int64) *GroupDescriptor32

func (*EXT4Profile) GroupDescriptor64

func (self *EXT4Profile) GroupDescriptor64(reader io.ReaderAt, offset int64) *GroupDescriptor64

func (*EXT4Profile) Header

func (self *EXT4Profile) Header(reader io.ReaderAt, offset int64) *Header

func (*EXT4Profile) Inode_

func (self *EXT4Profile) Inode_(reader io.ReaderAt, offset int64) *Inode_

func (*EXT4Profile) Misc

func (self *EXT4Profile) Misc(reader io.ReaderAt, offset int64) *Misc

func (*EXT4Profile) Superblock

func (self *EXT4Profile) Superblock(reader io.ReaderAt, offset int64) *Superblock

type Enumeration

type Enumeration struct {
	Value uint64
	Name  string
}

func (Enumeration) DebugString

func (self Enumeration) DebugString() string

type EvictCallback

type EvictCallback func(key int, value interface{})

EvictCallback is used to get a callback when a cache entry is evicted

type Ext4DirEntry

type Ext4DirEntry struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*Ext4DirEntry) DebugString

func (self *Ext4DirEntry) DebugString() string

func (*Ext4DirEntry) FileType

func (self *Ext4DirEntry) FileType() *Enumeration

func (*Ext4DirEntry) FileTypeInt

func (self *Ext4DirEntry) FileTypeInt() byte

func (*Ext4DirEntry) Inode

func (self *Ext4DirEntry) Inode() uint32

func (*Ext4DirEntry) Name

func (self *Ext4DirEntry) Name() string

func (*Ext4DirEntry) NameLen

func (self *Ext4DirEntry) NameLen() byte

func (*Ext4DirEntry) RecLen

func (self *Ext4DirEntry) RecLen() uint16

func (*Ext4DirEntry) Size

func (self *Ext4DirEntry) Size() int

type ExtentEntry

type ExtentEntry struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func ParseArray_ExtentEntry

func ParseArray_ExtentEntry(profile *EXT4Profile, reader io.ReaderAt, offset int64, count int) []*ExtentEntry

func (*ExtentEntry) DebugString

func (self *ExtentEntry) DebugString() string

func (*ExtentEntry) FirstLogicalBlock

func (self *ExtentEntry) FirstLogicalBlock() uint32

func (*ExtentEntry) Length

func (self *ExtentEntry) Length() uint16

func (*ExtentEntry) Size

func (self *ExtentEntry) Size() int

func (*ExtentEntry) StartHi

func (self *ExtentEntry) StartHi() uint16

func (*ExtentEntry) StartLo

func (self *ExtentEntry) StartLo() uint32

type ExtentHeader

type ExtentHeader struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*ExtentHeader) DebugString

func (self *ExtentHeader) DebugString() string

func (*ExtentHeader) Depth

func (self *ExtentHeader) Depth() uint16

func (*ExtentHeader) EntryCount

func (self *ExtentHeader) EntryCount() uint16

func (*ExtentHeader) Generation

func (self *ExtentHeader) Generation() uint32

func (*ExtentHeader) IndexEntries

func (self *ExtentHeader) IndexEntries() []*ExtentIndex

func (*ExtentHeader) LeafEntries

func (self *ExtentHeader) LeafEntries() []*ExtentEntry

func (*ExtentHeader) Magic

func (self *ExtentHeader) Magic() uint16

func (*ExtentHeader) Max

func (self *ExtentHeader) Max() uint16

func (*ExtentHeader) Size

func (self *ExtentHeader) Size() int

type ExtentIndex

type ExtentIndex struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func ParseArray_ExtentIndex

func ParseArray_ExtentIndex(profile *EXT4Profile, reader io.ReaderAt, offset int64, count int) []*ExtentIndex

func (*ExtentIndex) DebugString

func (self *ExtentIndex) DebugString() string

func (*ExtentIndex) FirstLogicalBlock

func (self *ExtentIndex) FirstLogicalBlock() uint32

func (*ExtentIndex) LeafHi

func (self *ExtentIndex) LeafHi() uint16

func (*ExtentIndex) LeafLo

func (self *ExtentIndex) LeafLo() uint32

func (*ExtentIndex) Size

func (self *ExtentIndex) Size() int

type ExtentReader

type ExtentReader struct {
	Reader io.ReaderAt
	Size   int64

	Runs []Run
}

func (*ExtentReader) ReadAt

func (self *ExtentReader) ReadAt(buf []byte, offset int64) (int, error)

type FileInfo

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

func (*FileInfo) Atime

func (self *FileInfo) Atime() time.Time

func (*FileInfo) Btime

func (self *FileInfo) Btime() time.Time

func (*FileInfo) Components

func (self *FileInfo) Components() []string

func (*FileInfo) Ctime

func (self *FileInfo) Ctime() time.Time

func (*FileInfo) Dict

func (self *FileInfo) Dict() *ordereddict.Dict

func (*FileInfo) Flags

func (self *FileInfo) Flags() []string

func (*FileInfo) FullPath

func (self *FileInfo) FullPath() string

func (*FileInfo) Gid

func (self *FileInfo) Gid() int64

func (*FileInfo) Inode

func (self *FileInfo) Inode() int64

func (*FileInfo) MarshalJSON

func (self *FileInfo) MarshalJSON() ([]byte, error)

func (*FileInfo) ModTime

func (self *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (self *FileInfo) Mode() fs.FileMode

func (*FileInfo) Mtime

func (self *FileInfo) Mtime() time.Time

func (*FileInfo) Name

func (self *FileInfo) Name() string

func (*FileInfo) Size

func (self *FileInfo) Size() int64

func (*FileInfo) Uid

func (self *FileInfo) Uid() int64

type Flags

type Flags struct {
	Value uint64
	Names map[string]bool
}

func (Flags) DebugString

func (self Flags) DebugString() string

func (Flags) IsSet

func (self Flags) IsSet(flag string) bool

func (Flags) Values

func (self Flags) Values() []string

type Flusher

type Flusher interface {
	Flush()
}

Invalidate the disk cache

type FreeList

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

Keep pages in a free list to avoid allocations.

func (*FreeList) Get

func (self *FreeList) Get() []byte

func (*FreeList) Put

func (self *FreeList) Put(in []byte)

type GroupDescriptor

type GroupDescriptor struct {
	BlockBitmap int64
	InodeBitmap int64
	InodeTable  int64
}

func NewGroupDescriptor32

func NewGroupDescriptor32(gd *GroupDescriptor32) *GroupDescriptor

func NewGroupDescriptor64

func NewGroupDescriptor64(gd *GroupDescriptor64) *GroupDescriptor

type GroupDescriptor32

type GroupDescriptor32 struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func ParseArray_GroupDescriptor32

func ParseArray_GroupDescriptor32(profile *EXT4Profile, reader io.ReaderAt, offset int64, count int) []*GroupDescriptor32

func (*GroupDescriptor32) BlockBitmapLo

func (self *GroupDescriptor32) BlockBitmapLo() uint32

func (*GroupDescriptor32) DebugString

func (self *GroupDescriptor32) DebugString() string

func (*GroupDescriptor32) InodeBitmapLo

func (self *GroupDescriptor32) InodeBitmapLo() uint32

func (*GroupDescriptor32) InodeTableLo

func (self *GroupDescriptor32) InodeTableLo() uint32

func (*GroupDescriptor32) Size

func (self *GroupDescriptor32) Size() int

type GroupDescriptor32_

type GroupDescriptor32_ struct {
	BlockBitmapLo     uint32 `struc:"uint32,little"`
	InodeBitmapLo     uint32 `struc:"uint32,little"`
	InodeTableLo      uint32 `struc:"uint32,little"`
	FreeBlocksCountLo uint16 `struc:"uint16,little"`
	FreeInodesCountLo uint16 `struc:"uint16,little"`
	UsedDirsCountLo   uint16 `struc:"uint16,little"`
	Flags             uint16 `struc:"uint16,little"`
	ExcludeBitmapLo   uint32 `struc:"uint32,little"`
	BlockBitmapCsumLo uint16 `struc:"uint16,little"`
	InodeBitmapCsumLo uint16 `struc:"uint16,little"`
	ItableUnusedLo    uint16 `struc:"uint16,little"`
	Checksum          uint16 `struc:"uint16,little"`
}

GroupDescriptor32 is 32 byte

type GroupDescriptor64

type GroupDescriptor64 struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func ParseArray_GroupDescriptor64

func ParseArray_GroupDescriptor64(profile *EXT4Profile, reader io.ReaderAt, offset int64, count int) []*GroupDescriptor64

func (*GroupDescriptor64) BlockBitmapHi

func (self *GroupDescriptor64) BlockBitmapHi() uint32

func (*GroupDescriptor64) BlockBitmapLo

func (self *GroupDescriptor64) BlockBitmapLo() uint32

func (*GroupDescriptor64) DebugString

func (self *GroupDescriptor64) DebugString() string

func (*GroupDescriptor64) InodeBitmapHi

func (self *GroupDescriptor64) InodeBitmapHi() uint32

func (*GroupDescriptor64) InodeBitmapLo

func (self *GroupDescriptor64) InodeBitmapLo() uint32

func (*GroupDescriptor64) InodeTableHi

func (self *GroupDescriptor64) InodeTableHi() uint32

func (*GroupDescriptor64) InodeTableLo

func (self *GroupDescriptor64) InodeTableLo() uint32

func (*GroupDescriptor64) Size

func (self *GroupDescriptor64) Size() int

type GroupDescriptor64_

type GroupDescriptor64_ struct {
	GroupDescriptor32_
	BlockBitmapHi     uint32 `struc:"uint32,little"`
	InodeBitmapHi     uint32 `struc:"uint32,little"`
	InodeTableHi      uint32 `struc:"uint32,little"`
	FreeBlocksCountHi uint16 `struc:"uint16,little"`
	FreeInodesCountHi uint16 `struc:"uint16,little"`
	UsedDirsCountHi   uint16 `struc:"uint16,little"`
	ItableUnusedHi    uint16 `struc:"uint16,little"`
	ExcludeBitmapHi   uint32 `struc:"uint32,little"`
	BlockBitmapCsumHi uint16 `struc:"uint16,little"`
	InodeBitmapCsumHi uint16 `struc:"uint16,little"`
	Reserved          uint32 `struc:"uint32,little"`
}

GroupDescriptor is 64 byte

type Header struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*Header) DebugString

func (self *Header) DebugString() string

func (*Header) Size

func (self *Header) Size() int

func (*Header) Superblock

func (self *Header) Superblock() *Superblock

type Inode

type Inode struct {
	*Inode_
	// contains filtered or unexported fields
}

func (*Inode) DataSize

func (self *Inode) DataSize() int64

func (*Inode) Debug

func (self *Inode) Debug(ctx *EXT4Context)

func (*Inode) Dir

func (self *Inode) Dir(ctx *EXT4Context) ([]*FileInfo, error)

List the directory

func (*Inode) GetReader

func (self *Inode) GetReader(ctx *EXT4Context) (io.ReaderAt, error)

Walk the extents tree and collect the runs

func (*Inode) Inode

func (self *Inode) Inode() int64

func (*Inode) Runs

func (self *Inode) Runs(ctx *EXT4Context) []Run

func (*Inode) Stat

func (self *Inode) Stat() *FileInfo

type InodeData

type InodeData struct {
	IMode       uint16 /* File mode */
	IUid        uint16 /* Low 16 bits of Owner Uid */
	ISizeLo     uint32 /* Size in bytes */
	IAtime      uint32 /* Access time */
	ICtime      uint32 /* Inode Change time */
	IMtime      uint32 /* Modification time */
	IDtime      uint32 /* Deletion Time */
	IGid        uint16 /* Low 16 bits of Group Id */
	ILinksCount uint16 /* Links count */
	IBlocksLo   uint32 /* Blocks count */
	IFlags      uint32 /* File flags */

	// union {
	//     struct {
	//         __le32  l_i_version;
	//     } linux1;
	//     struct {
	//         __u32  h_i_translator;
	//     } hurd1;
	//     struct {
	//         __u32  m_i_reserved1;
	//     } masix1;
	// } osd1;             /* OS dependent 1 */
	Osd1 [4]byte

	/*
		IBlock is a general buffer for our data, which can have various
		interpretations. `Ext4NBlocks` comes from the kernel where it is a count in
		terms of uint32's, which is then cast as a struct. However, it works better
		for us as an array of bytes.
	*/
	IBlock [15 * 4]byte

	IGeneration uint32 /* File version (for NFS) */
	IFileAclLo  uint32 /* File ACL */
	ISizeHigh   uint32
	IObsoFaddr  uint32 /* Obsoleted fragment address */

	// union {
	//     struct {
	//         __le16  l_i_blocks_high; /* were l_i_reserved1 */
	//         __le16  l_i_file_acl_high;
	//         __le16  l_i_uid_high;   /* these 2 fields */
	//         __le16  l_i_gid_high;   /* were reserved2[0] */
	//         __le16  l_i_checksum_lo;/* crc32c(uuid+inum+inode) LE */
	//         __le16  l_i_reserved;
	//     } linux2;
	//     struct {
	//         __le16  h_i_reserved1;   Obsoleted fragment number/size which are removed in ext4
	//         __u16   h_i_mode_high;
	//         __u16   h_i_uid_high;
	//         __u16   h_i_gid_high;
	//         __u32   h_i_author;
	//     } hurd2;
	//     struct {
	//         __le16  h_i_reserved1;  /* Obsoleted fragment number/size which are removed in ext4 */
	//         __le16  m_i_file_acl_high;
	//         __u32   m_i_reserved2[2];
	//     } masix2;
	// } osd2;             /* OS dependent 2 */
	Osd2 [12]byte

	IExtraIsize  uint16
	IChecksumHi  uint16 /* crc32c(uuid+inum+inode) BE */
	ICtimeExtra  uint32 /* extra Change time      (nsec << 2 | epoch) */
	IMtimeExtra  uint32 /* extra Modification time(nsec << 2 | epoch) */
	IAtimeExtra  uint32 /* extra Access time      (nsec << 2 | epoch) */
	ICrtime      uint32 /* File Creation time */
	ICrtimeExtra uint32 /* extra FileCreationtime (nsec << 2 | epoch) */
	IVersionHi   uint32 /* high 32 bits for 64-bit version */
	IProjid      uint32 /* Project ID */
}

type Inode_

type Inode_ struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*Inode_) Atime

func (self *Inode_) Atime() uint32

func (*Inode_) AtimeExtra

func (self *Inode_) AtimeExtra() uint32

func (*Inode_) BlockPointers

func (self *Inode_) BlockPointers() string

func (*Inode_) BlocksLo

func (self *Inode_) BlocksLo() uint32

func (*Inode_) CRtime

func (self *Inode_) CRtime() uint32

func (*Inode_) CRtimeExtra

func (self *Inode_) CRtimeExtra() uint32

func (*Inode_) Ctime

func (self *Inode_) Ctime() uint32

func (*Inode_) CtimeExtra

func (self *Inode_) CtimeExtra() uint32

func (*Inode_) DebugString

func (self *Inode_) DebugString() string

func (*Inode_) Dtime

func (self *Inode_) Dtime() uint32

func (*Inode_) Flags

func (self *Inode_) Flags() *Flags

func (*Inode_) Gid

func (self *Inode_) Gid() uint16

func (*Inode_) GidHi

func (self *Inode_) GidHi() uint16

func (*Inode_) LinksCount

func (self *Inode_) LinksCount() uint32

func (*Inode_) Mode

func (self *Inode_) Mode() uint16

func (*Inode_) Mtime

func (self *Inode_) Mtime() uint32

func (*Inode_) MtimeExtra

func (self *Inode_) MtimeExtra() uint32

func (*Inode_) Size

func (self *Inode_) Size() int

func (*Inode_) SizeHi

func (self *Inode_) SizeHi() uint32

func (*Inode_) SizeLo

func (self *Inode_) SizeLo() uint32

func (*Inode_) Uid

func (self *Inode_) Uid() uint16

func (*Inode_) UidHi

func (self *Inode_) UidHi() uint16

type LRU

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

LRU implements a thread safe fixed size LRU cache

func NewLRU

func NewLRU(size int, onEvict EvictCallback, name string) (*LRU, error)

NewLRU constructs an LRU of the given size

func (*LRU) Add

func (self *LRU) Add(key int, value interface{}) (evicted bool)

Add adds a value to the cache. Returns true if an eviction occurred.

func (*LRU) Contains

func (self *LRU) Contains(key int) (ok bool)

Contains checks if a key is in the cache, without updating the recent-ness or deleting it for being stale.

func (*LRU) DebugString

func (self *LRU) DebugString() string

func (*LRU) Get

func (self *LRU) Get(key int) (value interface{}, ok bool)

Get looks up a key's value from the cache.

func (*LRU) GetOldest

func (self *LRU) GetOldest() (key int, value interface{}, ok bool)

GetOldest returns the oldest entry

func (*LRU) Keys

func (self *LRU) Keys() []int

Keys returns a slice of the keys in the cache, from oldest to newest.

func (*LRU) Len

func (self *LRU) Len() int

Len returns the number of items in the cache.

func (*LRU) Peek

func (self *LRU) Peek(key int) (value interface{}, ok bool)

Peek returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.

func (*LRU) Purge

func (self *LRU) Purge()

Purge is used to completely clear the cache.

func (*LRU) Remove

func (self *LRU) Remove(key int) (present bool)

Remove removes the provided key from the cache, returning if the key was contained.

func (*LRU) RemoveOldest

func (self *LRU) RemoveOldest() (key int, value interface{}, ok bool)

RemoveOldest removes the oldest item from the cache.

func (*LRU) Touch

func (self *LRU) Touch(key int)

type Misc

type Misc struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*Misc) DebugString

func (self *Misc) DebugString() string

func (*Misc) GD32

func (self *Misc) GD32() []*GroupDescriptor32

func (*Misc) GD64

func (self *Misc) GD64() []*GroupDescriptor64

func (*Misc) Size

func (self *Misc) Size() int

type PagedReader

type PagedReader struct {
	Hits int64
	Miss int64
	// contains filtered or unexported fields
}

func NewPagedReader

func NewPagedReader(reader io.ReaderAt, pagesize int64, cache_size int) (*PagedReader, error)

func (*PagedReader) Flush

func (self *PagedReader) Flush()

func (*PagedReader) ReadAt

func (self *PagedReader) ReadAt(buf []byte, offset int64) (int, error)

func (*PagedReader) SetSize

func (self *PagedReader) SetSize(size int64)

type Run

type Run struct {
	FileOffset int64
	DiskOffset int64
	Length     int64
}

type Superblock

type Superblock struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *EXT4Profile
}

func (*Superblock) BlockCountHi

func (self *Superblock) BlockCountHi() uint32

func (*Superblock) BlockCountLo

func (self *Superblock) BlockCountLo() uint32

func (*Superblock) BlockPerGroup

func (self *Superblock) BlockPerGroup() uint32

func (*Superblock) DebugString

func (self *Superblock) DebugString() string

func (*Superblock) FeatureCompat

func (self *Superblock) FeatureCompat() uint32

func (*Superblock) FeatureIncompat

func (self *Superblock) FeatureIncompat() *Flags

func (*Superblock) FirstDataBlock

func (self *Superblock) FirstDataBlock() uint32

func (*Superblock) InodeCount

func (self *Superblock) InodeCount() uint32

func (*Superblock) InodePerGroup

func (self *Superblock) InodePerGroup() uint32

func (*Superblock) InodeSize

func (self *Superblock) InodeSize() uint16

func (*Superblock) LogBlockSize

func (self *Superblock) LogBlockSize() uint32

func (*Superblock) LogGroupPerFlex

func (self *Superblock) LogGroupPerFlex() byte

func (*Superblock) Magic

func (self *Superblock) Magic() uint16

func (*Superblock) Size

func (self *Superblock) Size() int

type SuperblockStruct

type SuperblockStruct struct {
	InodeCount           uint32     `struc:"uint32,little"`
	BlockCountLo         uint32     `struc:"uint32,little"`
	RBlockCountLo        uint32     `struc:"uint32,little"`
	FreeBlockCountLo     uint32     `struc:"uint32,little"`
	FreeInodeCount       uint32     `struc:"uint32,little"`
	FirstDataBlock       uint32     `struc:"uint32,little"`
	LogBlockSize         uint32     `struc:"uint32,little"`
	LogClusterSize       uint32     `struc:"uint32,little"`
	BlockPerGroup        uint32     `struc:"uint32,little"`
	ClusterPerGroup      uint32     `struc:"uint32,little"` // 10
	InodePerGroup        uint32     `struc:"uint32,little"`
	Mtime                uint32     `struc:"uint32,little"`
	Wtime                uint32     `struc:"uint32,little"`
	MntCount             uint16     `struc:"uint16,little"`
	MaxMntCount          uint16     `struc:"uint16,little"`
	Magic                uint16     `struc:"uint16,little"`
	State                uint16     `struc:"uint16,little"`
	Errors               uint16     `struc:"uint16,little"`
	MinorRevLevel        uint16     `struc:"uint16,little"`
	Lastcheck            uint32     `struc:"uint32,little"`
	Checkinterval        uint32     `struc:"uint32,little"`
	CreatorOs            uint32     `struc:"uint32,little"`
	RevLevel             uint32     `struc:"uint32,little"` // 20
	DefResuid            uint16     `struc:"uint16,little"`
	DefResgid            uint16     `struc:"uint16,little"`
	FirstIno             uint32     `struc:"uint32,little"`
	InodeSize            uint16     `struc:"uint16,little"`
	BlockGroupNr         uint16     `struc:"uint16,little"`
	FeatureCompat        uint32     `struc:"uint32,little"`
	FeatureIncompat      uint32     `struc:"uint32,little"`
	FeatureRoCompat      uint32     `struc:"uint32,little"`
	UUID                 [16]byte   `struc:"[16]byte"` // 30
	VolumeName           [16]byte   `struc:"[16]byte"`
	LastMounted          [64]byte   `struc:"[64]byte"` // 42
	AlgorithmUsageBitmap uint32     `struc:"uint32,little"`
	PreallocBlocks       byte       `struc:"byte"`
	PreallocDirBlocks    byte       `struc:"byte"`
	ReservedGdtBlocks    uint16     `struc:"uint16,little"`
	JournalUUID          [16]byte   `struc:"[16]byte"`
	JournalInum          uint32     `struc:"uint32,little"`
	JournalDev           uint32     `struc:"uint32,little"` // 50
	LastOrphan           uint32     `struc:"uint32,little"`
	HashSeed             [4]uint32  `struc:"[4]uint32,little"`
	DefHashVersion       byte       `struc:"byte"`
	JnlBackupType        byte       `struc:"byte"`
	DescSize             uint16     `struc:"uint16,little"`
	DefaultMountOpts     uint32     `struc:"uint32,little"`
	FirstMetaBg          uint32     `struc:"uint32,little"`
	MkfTime              uint32     `struc:"uint32,little"` // 59
	JnlBlocks            [17]uint32 `struc:"[17]uint32,little"`
	BlockCountHi         uint32     `struc:"uint32,little"`
	RBlockCountHi        uint32     `struc:"uint32,little"`
	FreeBlockCountHi     uint32     `struc:"uint32,little"`
	MinExtraIsize        uint16     `struc:"uint16,little"`
	WantExtraIsize       uint16     `struc:"uint16,little"` // 80
	Flags                uint32     `struc:"uint32,little"`
	RaidStride           uint16     `struc:"uint16,little"`
	MmpUpdateInterval    uint16     `struc:"uint16,little"`
	MmpBlock             uint64     `struc:"uint64,little"`
	RaidStripeWidth      uint32     `struc:"uint32,little"` // 85
	LogGroupPerFlex      byte       `struc:"byte"`
	ChecksumType         byte       `struc:"byte"`
	EncryptionLevel      byte       `struc:"byte"`
	ReservedPad          byte       `struc:"byte"`
	KbyteWritten         uint64     `struc:"uint64,little"`
	SnapshotInum         uint32     `struc:"uint32,little"`
	SnapshotID           uint32     `struc:"uint32,little"` // 90
	SnapshotRBlockCount  uint64     `struc:"uint64,little"`
	SnapshotList         uint32     `struc:"uint32,little"`
	ErrorCount           uint32     `struc:"uint32,little"`
	FirstErrorTime       uint32     `struc:"uint32,little"`
	FirstErrorIno        uint32     `struc:"uint32,little"`
	FirstErrorBlock      uint64     `struc:"uint64,little"` // 98
	FirstErrorFunc       [32]byte   `struc:"[32]pad"`
	FirstErrorLine       uint32     `struc:"uint32,little"`
	LastErrorTime        uint32     `struc:"uint32,little"` // 108
	LastErrorIno         uint32     `struc:"uint32,little"`
	LastErrorLine        uint32     `struc:"uint32,little"`
	LastErrorBlock       uint64     `struc:"uint64,little"` // 112
	LastErrorFunc        [32]byte   `struc:"[32]pad"`
	MountOpts            [64]byte   `struc:"[64]pad"` // 136
	UsrQuotaInum         uint32     `struc:"uint32,little"`
	GrpQuotaInum         uint32     `struc:"uint32,little"`
	OverheadClusters     uint32     `struc:"uint32,little"`
	BackupBgs            [2]uint32  `struc:"[2]uint32,little"`
	EncryptAlgos         [4]byte    `struc:"[4]pad"`
	EncryptPwSalt        [16]byte   `struc:"[16]pad"` // 146
	LpfIno               uint32     `struc:"uint32,little"`
	PrjQuotaInum         uint32     `struc:"uint32,little"`
	ChecksumSeed         uint32     `struc:"uint32,little"`
	Reserved             [98]uint32 `struc:"[98]uint32,little"`
	Checksum             uint32     `struc:"uint32,little"`
}

Jump to

Keyboard shortcuts

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