vhdx

package
v0.0.0-...-a8420b5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Code = 0x1EDC6F41

	SupportSectorSize = 512

	BitmapAllocationGroup = "6677c22d-23f6-0042-9d64-115e9bfd4a08"
	MetadataRegion        = "06a27c8b-9047-9a4b-b8fe-575f050f886e"
	FileParameters        = "3767a1ca-36fa-434d-b3b6-33f0aa44e76b"
	VirtualDiskSize       = "2442a52f-1bcd-7648-b211-5dbed83bf4b8"
	VirtualDiskID         = "ab12cabe-e6b2-2345-93ef-c309e000c746"
	LogicalSectorSize     = "1dbf4181-6fa9-0947-ba47-f233a8faab5f"
	PhysicalSectorSize    = "c748a3cd-5d44-7144-9cc9-e9885251c556"
	ParentLocator         = "2d5fd3a8-0bb3-4d45-abf7-d3d84834ab0c"

	PAYLOAD_BLOCK_NOT_PRESENT       PayloadState = 0
	PAYLOAD_BLOCK_UNDEFINED         PayloadState = 1
	PAYLOAD_BLOCK_ZERO              PayloadState = 2
	PAYLOAD_BLOCK_UNMAPPED          PayloadState = 3
	PAYLOAD_BLOCK_FULLY_PRESENT     PayloadState = 6
	PAYLOAD_BLOCK_PARTIALLY_PRESENT PayloadState = 7

	VHDX_BAT_FILE_OFF_MASK     = 0xFFFFFFFFFF00000
	VHDX_MAX_SECTORS_PER_BLOCK = 1 << 23
)

Variables

This section is empty.

Functions

func Open

func Open(name string) (*io.SectionReader, error)

Types

type BAT

type BAT struct {
	State      PayloadState
	FileOffset uint64
}

type FileIdentifer

type FileIdentifer struct {
	Signature [8]byte
	Creator   [512]byte
}

type FileParameter

type FileParameter struct {
	BlockSize           uint32
	LeaveBlockAllocated bool
	HasParent           bool
}
type Header struct {
	Signature      [4]byte
	Checksum       [4]byte
	SequenceNumber uint64
	FileWriteGUID  uuid.UUID
	DataWriteGUID  uuid.UUID
	LogGUID        uuid.UUID
	LogVersion     uint16
	Version        uint16
	LogLength      uint32
	LogOffset      uint64
	// contains filtered or unexported fields
}

type HeaderSection

type HeaderSection struct {
	FileIdentifer FileIdentifer  // 64KB Align
	Headers       [2]Header      // 64KB Align
	RegionTables  [2]RegionTable // 64KB Align
}

type MetadataTable

type MetadataTable struct {
	Header     MetadataTableHeader
	Entries    []MetadataTableEntry
	SystemData SystemMetadata
}

MetadataTable is required 64 KB

type MetadataTableEntry

type MetadataTableEntry struct {
	ItemID     uuid.UUID
	Offset     uint32
	Length     uint32
	Permission Permission
	// contains filtered or unexported fields
}

type MetadataTableHeader

type MetadataTableHeader struct {
	Signature [8]byte

	EntryCount uint16
	// contains filtered or unexported fields
}

type PayloadState

type PayloadState int

type Permission

type Permission uint8

func (Permission) IsRequired

func (p Permission) IsRequired() bool

IsRequired required

func (Permission) IsUser

func (p Permission) IsUser() bool

IsUser required

func (Permission) IsVirtualDisk

func (p Permission) IsVirtualDisk() bool

IsVirtualDisk required

func (Permission) String

func (p Permission) String() string

type RegionTable

type RegionTable struct {
	RegionTableHeader  RegionTableHeader
	RegionTableEntries []RegionTableEntry
}

type RegionTableEntry

type RegionTableEntry struct {
	GUID       uuid.UUID
	FileOffset uint64
	Length     uint32
	Required   [4]byte
}

type RegionTableHeader

type RegionTableHeader struct {
	Signature  [4]byte
	Checksum   [4]byte
	EntryCount uint32
	Required   [4]byte
}

type SystemMetadata

type SystemMetadata struct {
	FileParameter      FileParameter
	VirtualDiskSize    uint64
	VirtualDiskID      uuid.UUID
	LogicalSectorSize  uint32
	PhysicalSectorSize uint32
}

type VHDX

type VHDX struct {
	HeaderSection         HeaderSection // 1MB Align
	MetadataTable         MetadataTable
	BlockAllocationTables []BAT
	// contains filtered or unexported fields
}

func (*VHDX) Close

func (v *VHDX) Close() error

func (*VHDX) NewState

func (v *VHDX) NewState() VHDXState

func (*VHDX) ReadAt

func (v *VHDX) ReadAt(p []byte, off int64) (n int, err error)

func (*VHDX) Reset

func (v *VHDX) Reset() error

func (*VHDX) Size

func (v *VHDX) Size() int64

func (*VHDX) TranslateOffset

func (v *VHDX) TranslateOffset(physicalOffset int64) (*VHDXStateInfo, error)

type VHDXState

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

type VHDXStateInfo

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

Jump to

Keyboard shortcuts

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