vhdcore

package
v0.0.0-...-7c30a37 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

View Source
const VhdDefaultBlockSize int64 = 512 * 1024

VhdDefaultBlockSize is the default block size of the VHD.

View Source
const VhdFooterChecksumOffset int = 64

VhdFooterChecksumOffset is the bye offset of checksum field in the VHD footer.

View Source
const VhdFooterCookie = "conectix"

VhdFooterCookie is the cookie value stored in VHD footer Microsoft uses the “conectix” string to identify a hard disk image created by Microsoft Virtual Server, Virtual PC, and predecessor products. The cookie is stored as an eight-character ASCII string with the “c” in the first byte, the “o” in the second byte, and so on.

View Source
const VhdFooterSize int64 = 512

VhdFooterSize is the size of the VHD footer in bytes.

View Source
const VhdHeaderCookie = "cxsparse"

VhdHeaderCookie is the header cookie which is always cxsparse

View Source
const VhdNoDataInt uint32 = 0xFFFFFFFF

VhdNoDataInt is the value in the BAT indicating a block is empty.

View Source
const VhdNoDataLong int64 = ^int64(0)

VhdNoDataLong is the value in the BAT indicating a block is empty.

View Source
const VhdPageSize int64 = 512

VhdPageSize is the size of the VHD page size.

View Source
const VhdSectorLength int64 = 512

VhdSectorLength is the sector length which is always 512 bytes, as per VHD specification.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cookie struct {
	Data []byte
	// contains filtered or unexported fields
}

Cookie represents the Vhd header or Vhd footer cookie. Footer Cookie are used to uniquely identify the original creator of the hard disk image. The values are case-sensitive. Header Cookie holds the value "cxsparse".

func CreateFooterCookie

func CreateFooterCookie() *Cookie

CreateFooterCookie creates a VhdCookie representing vhd footer cookie

func CreateHeaderCookie

func CreateHeaderCookie() *Cookie

CreateHeaderCookie creates a VhdCookie representing vhd header cookie

func CreateNewVhdCookie

func CreateNewVhdCookie(isHeader bool, data []byte) *Cookie

CreateNewVhdCookie creates a new VhdCookie, the new instance's Data will be simply reference to the byte slice data (i.e. this function will not create a copy)

func (*Cookie) CreateCopy

func (c *Cookie) CreateCopy() *Cookie

CreateCopy creates a copy of this instance

func (*Cookie) Equal

func (c *Cookie) Equal(other *Cookie) bool

Equal returns true if this and other points to the same instance or contents of field values of two are same.

func (*Cookie) IsValid

func (c *Cookie) IsValid() bool

IsValid checks whether this this instance's internal cookie string is valid.

func (*Cookie) String

func (c *Cookie) String() string

String returns the string representation of this range, this satisfies stringer interface.

type TimeStamp

type TimeStamp struct {
	TotalSeconds uint32
}

TimeStamp represents the the creation time of a hard disk image. This is the number of seconds since vhd base time which is January 1, 2000 12:00:00 AM in UTC/GMT. The disk creation time is stored in the vhd footer in big-endian format.

func NewVhdTimeStamp

func NewVhdTimeStamp(dateTime *time.Time) *TimeStamp

NewVhdTimeStamp creates new VhdTimeStamp with creation time as dateTime. This function will panic if the given datetime is before the vhd base time.

func NewVhdTimeStampFromSeconds

func NewVhdTimeStampFromSeconds(totalSeconds uint32) *TimeStamp

NewVhdTimeStampFromSeconds creates new VhdTimeStamp, creation time is calculated by adding given total seconds with the vhd base time.

func (*TimeStamp) ToDateTime

func (v *TimeStamp) ToDateTime() time.Time

ToDateTime returns the time.Time representation of this instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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