azure-vhd-utils-for-go: github.com/Microsoft/azure-vhd-utils-for-go/vhdcore/header Index | Files | Directories

package header

import "github.com/Microsoft/azure-vhd-utils-for-go/vhdcore/header"

Index

Package Files

factory.go header.go parseError.go vhdHeaderVersion.go

Constants

const VhdHeaderVersionNone = 0

VhdHeaderVersionNone indicates an invalid VHD specification version

func NewParseError Uses

func NewParseError(headerField string, err error) error

NewParseError returns a new ParseError instance. The parameter headerField represents the field in the header that failed to parse The parameter err is the underlying error for parse failure.

type Factory Uses

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

Factory type is used to create VhdHeader instance by reading vhd header section.

func NewFactory Uses

func NewFactory(vhdReader *reader.VhdReader, headerOffset int64) *Factory

NewFactory creates a new instance of Factory, which can be used to create a VhdHeader instance by reading the header section using vhdReader.

func (*Factory) Create Uses

func (f *Factory) Create() (*Header, error)

Create creates a Header instance by reading the header section of a expandable disk. This function return error if any error occurs while reading or parsing the header fields.

type Header struct {
    // Offset =  0, Size = 8
    Cookie *vhdcore.Cookie
    // Offset =  8, Size = 8
    DataOffset int64
    // Offset = 16, Size = 8
    TableOffset int64
    // Offset = 24, Size = 4
    HeaderVersion VhdHeaderVersion
    // Offset = 28, Size = 4
    MaxTableEntries uint32
    // Offset = 32, Size = 4
    BlockSize uint32
    // Offset = 36, Size = 4
    CheckSum uint32
    // Offset = 40, Size = 16
    ParentUniqueID *common.UUID
    // Offset = 56, Size = 4
    ParentTimeStamp *time.Time
    // Offset = 60, Size = 4
    Reserved uint32
    // Offset = 64, Size = 512
    // This field contains a Unicode string (UTF-16) of the parent hard disk filename.
    // This will be absolute path to the parent disk of differencing disk.
    // If this field is set, then the ParentLocators collection will also contain
    // an entry with the same path, the PlatformCode of that field will be PlatformCodeW2Ku.
    ParentPath string
    // Offset = 576, Count = 8
    // Collection of entries store an absolute byte offset in the file where the
    // parent locator for a differencing hard disk is stored.
    // This field is used only for differencing disks and will be set to zero for
    // dynamic disks.
    ParentLocators parentlocator.ParentLocators
    // Offset = 0, Size = 1024
    // The entire header as raw bytes
    RawData []byte
}

Header represents the header of the vhd, size of the header is 1024 bytes. The header structure is present only for expanding disks (i.e. dynamic and differencing disks.) In case of dynamic and differential vhds the footer is replicated at the beginning of the disk as well, the header structure follows this replicated footer, the field 'HeaderOffset' in the footer contains absolute offset to the header structure.

type ParseError Uses

type ParseError struct {
    HeaderField string
    // contains filtered or unexported fields
}

ParseError is the error type representing disk header parse error.

func (*ParseError) Error Uses

func (e *ParseError) Error() string

Error returns the string representation of the ParseError instance.

func (*ParseError) GetInnerErr Uses

func (e *ParseError) GetInnerErr() error

GetInnerErr returns the inner error, this method satisfies InnerErr interface

type VhdHeaderVersion Uses

type VhdHeaderVersion uint32

VhdHeaderVersion represents the major/minor version of the specification used in creating the vhd. The version is stored in the vhd header in big-endian format.

const VhdHeaderSupportedVersion VhdHeaderVersion = 0x00010000

VhdHeaderSupportedVersion indicates the current VHD specification version

func (VhdHeaderVersion) IsSupported Uses

func (v VhdHeaderVersion) IsSupported() bool

IsSupported returns true if this instance represents a supported VHD specification version.

Directories

PathSynopsis
parentlocator

Package header imports 7 packages (graph) and is imported by 6 packages. Updated 2020-01-31. Refresh now. Tools for package owners.