Version: v0.0.0-...-cd5610b Latest Latest

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 17 Imported by: 0




This section is empty.


View Source
var (
	ErrRead  = errors.New("underlying IO object does not support reading")
	ErrSeek  = errors.New("underlying IO object does not support seeking")
	ErrWrite = errors.New("underlying IO object does not support writing")

Partial IO errors, for when attempting to perform an operation that would be legal on a file but impossible on a read-only stream.


func GPTEntryName

func GPTEntryName(e *vimg.GPTEntry) string

GPTEntryName returns a normal string representation of the GPT entry. Without calling this function the data in the GPT entry is encoded in UTF16.

func InodeIsDirectory

func InodeIsDirectory(inode *ext.Inode) bool

InodeIsDirectory returns true if the permission bits in the inode represent a directory.

func InodeIsRegularFile

func InodeIsRegularFile(inode *ext.Inode) bool

InodeIsRegularFile returns true if the permission bits in the inode represent a regular file.

func InodeIsSymlink(inode *ext.Inode) bool

InodeIsSymlink returns true if the permission bits in the inode represent a symlink.

func InodePermissionsString

func InodePermissionsString(inode *ext.Inode) string

InodePermissionsString returns a string-representation of an inode's permissions modelled off the string you see with `ls -l`, e.g. `drwxr-x---`.

func InodeSize

func InodeSize(inode *ext.Inode) int64

InodeSize returns the size of the file respresented by the inode. It is safer to use this than to use the size fields directly because different versions of ext might have upper and lower bits stored separately that need combining.

func UTF16toString

func UTF16toString(data []byte) string


type DirectoryEntry

type DirectoryEntry struct {
	Inode int
	Type  uint8
	Name  string

type Dirent

type Dirent struct {
	Inode   uint32
	Size    uint16
	NameLen uint8
	Type    uint8

type IO

type IO struct {
	// contains filtered or unexported fields

IO provides an entry point into a virtual disk image, making it possible to navigate and read data from it. It has a complex but flexible implementation, allowing it to work from both seekable files and read-only streams.

func Open

func Open(path string) (*IO, error)

Open returns an image IO object from a file at path.

func (*IO) BGDT

func (iio *IO) BGDT(index int) ([]*ext.BlockGroupDescriptorTableEntry, error)

BGDT loads a block group descriptor table from block group 'index'.

func (*IO) BlockToLBA

func (iio *IO) BlockToLBA(block int) (int, error)

BlockToLBA converts a file-system block number into an absolute disk LBA.

func (*IO) Close

func (iio *IO) Close() error

Close closes the underlying IO object and cleans up any other resources in use.

func (*IO) GPTEntries

func (iio *IO) GPTEntries() ([]*vimg.GPTEntry, error)

GPTEntries returns a list of all GPT partition entries on the disk.

func (*IO) GPTEntry

func (iio *IO) GPTEntry(name string) (*vimg.GPTEntry, error)

GPTEntry returns the GPT entry for a specific partition on-disk.

func (*IO) GPTHeader

func (iio *IO) GPTHeader() (*vimg.GPTHeader, error)

GPTHeader returns the primary GPT header for the image.

func (*IO) ImageFormat

func (iio *IO) ImageFormat() (vdisk.Format, error)

ImageFormat returns the image's file format.

func (*IO) InodeReader

func (iio *IO) InodeReader(inode *ext.Inode) (io.Reader, error)

InodeReader reads all of the data stored for an inode.

func (*IO) KernelFile

func (iio *IO) KernelFile(name string) (io.Reader, error)

KernelFile returns the a reader for a kernel bundle file on the image.

func (*IO) KernelFiles

func (iio *IO) KernelFiles() ([]*KernelFile, error)

KernelFiles returns a list of every kernel bundle file on the image.

func (*IO) PartitionReader

func (iio *IO) PartitionReader(name string) (io.Reader, error)

PartitionReader returns a limited reader for the an entire disk partition. Valid arguments are vimg.RootPartitionName and vimg.OSPartitionName. This function can be used to easily extract the file-system from a Vorteil image.

func (*IO) Readdir

func (iio *IO) Readdir(inode *ext.Inode) ([]*DirectoryEntry, error)

Readdir returns a list of directory entries within a directory.

func (*IO) ResolveInode

func (iio *IO) ResolveInode(ino int) (*ext.Inode, error)

ResolveInode looks up an inode on the file-system.

func (*IO) ResolvePathToInodeNo

func (iio *IO) ResolvePathToInodeNo(path string) (int, error)

ResolvePathToInodeNo translates a filepath into an inode number if it can be found on the disk.

func (*IO) Superblock

func (iio *IO) Superblock(index int) (*ext.Superblock, error)

Superblock loads the ext superblock from block group 'index'.

type KernelFile

type KernelFile struct {
	Name        string
	Size        int
	ImageOffset int

KernelFile contains information about a kernel bundle file and its location on the image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL