parser

package
v0.0.0-...-e373986 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SPARSE_MAGICNUMBER = 0x564d444b
	SECTOR_SIZE        = 512
)

Variables

View Source
var (
	StartExtentRegex = regexp.MustCompile("^# Extent description")
	ExtentRegex      = regexp.MustCompile(`(RW|R) (\d+) ([A-Z]+) "([^"]+)"`)
)

Functions

func ParseArray_uint32

func ParseArray_uint32(profile *VMDKProfile, reader io.ReaderAt, offset int64, count int) []uint32

func ParseUint16

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

func ParseUint32

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

func ParseUint64

func ParseUint64(reader io.ReaderAt, offset int64) uint64

Types

type Extent

type Extent interface {
	io.ReaderAt

	VirtualOffset() int64
	TotalSize() int64
	Stats() ExtentStat
	Close()
	Debug()
}

type ExtentStat

type ExtentStat struct {
	Type          string `json:"type"`
	VirtualOffset int64  `json:"VirtualOffset"`
	Size          int64  `json:"Size"`
	Filename      string `json:"Filename"`
}

type Misc

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

func (*Misc) DebugString

func (self *Misc) DebugString() string

func (*Misc) Size

func (self *Misc) Size() int

type NullExtent

type NullExtent struct {
	SparseExtent
}

func (*NullExtent) ReadAt

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

func (*NullExtent) Stats

func (self *NullExtent) Stats() ExtentStat

type SparseExtent

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

func GetSpaseExtent

func GetSpaseExtent(reader io.ReaderAt) (*SparseExtent, error)

func (*SparseExtent) Close

func (self *SparseExtent) Close()

func (*SparseExtent) Debug

func (self *SparseExtent) Debug()

func (*SparseExtent) ReadAt

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

func (*SparseExtent) Stats

func (self *SparseExtent) Stats() ExtentStat

func (*SparseExtent) TotalSize

func (self *SparseExtent) TotalSize() int64

func (*SparseExtent) VirtualOffset

func (self *SparseExtent) VirtualOffset() int64

type SparseExtentHeader

type SparseExtentHeader struct {
	Reader  io.ReaderAt
	Offset  int64
	Profile *VMDKProfile
}

func (*SparseExtentHeader) DebugString

func (self *SparseExtentHeader) DebugString() string

func (*SparseExtentHeader) Size

func (self *SparseExtentHeader) Size() int

type VMDKContext

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

func GetVMDKContext

func GetVMDKContext(
	reader io.ReaderAt, size int,
	opener func(filename string) (
		reader io.ReaderAt, closer func(), err error),
) (*VMDKContext, error)

func (*VMDKContext) Close

func (self *VMDKContext) Close()

func (*VMDKContext) Debug

func (self *VMDKContext) Debug()

func (*VMDKContext) ReadAt

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

func (*VMDKContext) Size

func (self *VMDKContext) Size() int64

func (*VMDKContext) Stats

func (self *VMDKContext) Stats() VMDKStats

type VMDKProfile

type VMDKProfile struct {
	Off_Misc_a                               int64
	Off_SparseExtentHeader_magicNumber       int64
	Off_SparseExtentHeader_version           int64
	Off_SparseExtentHeader_flags             int64
	Off_SparseExtentHeader_capacity          int64
	Off_SparseExtentHeader_grainSize         int64
	Off_SparseExtentHeader_descriptorOffset  int64
	Off_SparseExtentHeader_descriptorSize    int64
	Off_SparseExtentHeader_numGTEsPerGT      int64
	Off_SparseExtentHeader_rgdOffset         int64
	Off_SparseExtentHeader_gdOffset          int64
	Off_SparseExtentHeader_overHead          int64
	Off_SparseExtentHeader_compressAlgorithm int64
}

func NewVMDKProfile

func NewVMDKProfile() *VMDKProfile

func (*VMDKProfile) Misc

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

func (*VMDKProfile) SparseExtentHeader

func (self *VMDKProfile) SparseExtentHeader(reader io.ReaderAt, offset int64) *SparseExtentHeader

type VMDKStats

type VMDKStats struct {
	TotalSize int64        `json:"TotalSize"`
	Extents   []ExtentStat `json:"Extents"`
}

Jump to

Keyboard shortcuts

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