Documentation ¶
Index ¶
Constants ¶
const VhdDefaultBlockSize int64 = 512 * 1024
VhdDefaultBlockSize is the default block size of the VHD.
VhdFooterChecksumOffset is the bye offset of checksum field in the VHD footer.
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.
VhdFooterSize is the size of the VHD footer in bytes.
const VhdHeaderCookie = "cxsparse"
VhdHeaderCookie is the header cookie which is always cxsparse
const VhdNoDataInt uint32 = 0xFFFFFFFF
VhdNoDataInt is the value in the BAT indicating a block is empty.
const VhdNoDataLong int64 = ^int64(0)
VhdNoDataLong is the value in the BAT indicating a block is empty.
const VhdPageSize int64 = 512
VhdPageSize is the size of the VHD page size.
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 ¶
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 ¶
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 ¶
CreateCopy creates a copy of this instance
func (*Cookie) Equal ¶
Equal returns true if this and other points to the same instance or contents of field values of two are same.
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 ¶
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 ¶
NewVhdTimeStampFromSeconds creates new VhdTimeStamp, creation time is calculated by adding given total seconds with the vhd base time.
func (*TimeStamp) ToDateTime ¶
ToDateTime returns the time.Time representation of this instance.