Documentation ¶
Index ¶
- Constants
- Variables
- func Check(r io.Reader) (bool, error)
- func Open(rs io.ReadSeeker, cache Cache[string, []byte]) (*io.SectionReader, error)
- type Cache
- type DiskDescriptor
- type Entry
- type ExtentDescription
- type GrainDirectory
- type GrainTable
- type Header
- type Marker
- type SparseExtentHeader
- type StreamOptimizedImage
- type VMDK
Constants ¶
View Source
const ( // MARKER_EOS = uint32(0x00000000) MARKER_GT = uint32(0x00000001) MARKER_GD = uint32(0x00000002) // MARKER_FOOTER = uint32(0x00000003) MARKER_GRAIN = uint32(0xffffffff) // COWD = uint32(0x434f5744) KDMV = uint32(0x564d444b) )
View Source
const ( SectionDiskDescriptorFile = "disk descriptorfile" SectionExtentDescription = "extent description" SectionDiskDataBase = "the disk data base" SectionDDB = "ddb" Sector int64 = 0x200 )
View Source
const (
SPARSE = "SPARSE"
)
View Source
const (
StreamOptimized = "streamOptimized"
)
Variables ¶
View Source
var ( ErrReadSizeFormat = "failed to read size error: actual(%d), expected(%d)" ErrSeekOffsetFormat = "failed to seek offset error: actual(%d), expected(%d)" )
View Source
var ( ErrUnSupportedDividedImage = xerrors.New("divided images are not supported") ErrUnSupportedType = xerrors.New("type is not supported") ErrIsNotVMDK = xerrors.New("this file is not vmdk") )
View Source
var (
ErrDataNotPresent = xerrors.New("data not present")
)
Functions ¶
func Open ¶
func Open(rs io.ReadSeeker, cache Cache[string, []byte]) (*io.SectionReader, error)
Types ¶
type DiskDescriptor ¶
type DiskDescriptor struct { Version int CID string ParentCID string CreateType string Extents []ExtentDescription }
func ParseDiskDescriptor ¶
func ParseDiskDescriptor(rs io.ReadSeeker, header Header) (DiskDescriptor, error)
type ExtentDescription ¶
type GrainDirectory ¶
type GrainDirectory struct {
Entries []Entry
}
type GrainTable ¶
type GrainTable struct {
Entries []Entry
}
type Header ¶
type Header struct { Signature uint32 Version int32 Flag int32 Capacity int64 GrainSize int64 DescriptorOffset int64 DescriptorSize int64 NumGTEsPerGT int32 RgdOffset int64 GdOffset int64 OverHead int64 UncleanShutdown byte SingleEndLineChar byte NonEndLineChar byte DoubleEndLineChar1 byte DoubleEndLineChar2 byte CompressAlgorithm int16 Padding [433]byte }
Header specification https://www.vmware.com/app/vmdk/?src=vmdk
type SparseExtentHeader ¶
type SparseExtentHeader struct { MagicNumber uint32 Version uint32 Flags uint32 Capacity uint64 GrainSize uint64 DescriptorOffset uint64 DescriptorSize uint64 NumberGTEsPerGT uint32 RgdOffset uint64 GdOffset uint64 OverHead uint64 UncleanShutdown uint8 SingleEndLineChar byte NonEndLineChar byte DoubleEndLineChar1 byte DoubleEndLineChar2 byte CompressAlgorithm uint16 }
type StreamOptimizedImage ¶
type StreamOptimizedImage struct { VMDK SparseExtentHeader SparseExtentHeader GD GrainDirectory GTCache map[int64]GrainTable }
func NewStreamOptimizedImage ¶
func NewStreamOptimizedImage(v VMDK) (*StreamOptimizedImage, error)
func (*StreamOptimizedImage) ReadAt ¶
func (v *StreamOptimizedImage) ReadAt(p []byte, off int64) (n int, err error)
func (*StreamOptimizedImage) Size ¶
func (v *StreamOptimizedImage) Size() int64
func (*StreamOptimizedImage) TranslateOffset ¶
func (v *StreamOptimizedImage) TranslateOffset(off int64) (int64, int64, error)
TranslateOffset is translates the physical offset of a VMDK into a logical offset.
type VMDK ¶
type VMDK struct { Header Header DiskDescriptor DiskDescriptor // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.