Documentation ¶
Index ¶
Constants ¶
const ( // PlatformCodeNone indicates a nil value for platform code. // PlatformCodeNone PlatformCode = 0x0 // PlatformCodeWi2R [deprecated] // PlatformCodeWi2R = 0x57693272 // PlatformCodeWi2K [deprecated] // PlatformCodeWi2K = 0x5769326B // PlatformCodeW2Ru indicate that the file locator is stored in unicode (UTF-16) format on Windows // relative to the differencing disk pathname. // PlatformCodeW2Ru = 0x57327275 // PlatformCodeW2Ku indicate that the file locator is stored in unicode (UTF-16) format as absolute // pathname on Windows. // PlatformCodeW2Ku = 0x57326B75 // PlatformCodeMac indicates that file locator is a Mac OS alias stored as a blob. // PlatformCodeMac = 0x4D616320 // PlatformCodeMacX indicates that file locator is a file URL with UTF-8 encoding conforming to RFC 2396. // PlatformCodeMacX = 0x4D616358 )
Variables ¶
This section is empty.
Functions ¶
func NewParseError ¶
NewParseError returns a new ParseError instance. The parameter headerField represents the field in the header parent locator that failed to parse The parameter err is the underlying error for parse failure.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory type is used to create ParentLocator instance by reading one entry in vhd header's parent-hard-disk-locator-info collection section.
func NewFactory ¶
NewFactory creates a new instance of Factory, which can be used to create ParentLocator instance by reading one entry from the vhd header's parent-hard-disk-locator-info collection, locatorOffset is the offset of the entry to read, vhdReader is the reader to be used to read the entry.
func (*Factory) Create ¶
func (f *Factory) Create() (*ParentLocator, error)
Create creates a ParentLocator instance by reading one entry in vhd header's parent-hard-disk-locator-info collection section of the disk. This function return error if any error occurs while reading or parsing the parent locators table fields.
type ParentLocator ¶
type ParentLocator struct { // Offset = 0, Size = 4 // This field stores the code representing the platform-specific format used for // the file locator. Stored in big-endian format. PlatformCode PlatformCode // Offset = 4, Size = 4 // This field stores the number of 512-byte sectors needed to store the parent // hard disk locator. Stored in big-endian format. PlatformDataSpace int32 // Offset = 8, Size = 4 // This field stores the actual length of the parent hard disk locator in bytes. // Stored in big-endian format. PlatformDataLength int32 // Offset = 12, Size = 4 // This field must be set to zero. // Stored in big-endian format. Reserved int32 // Offset = 16, Size = 8 // This field stores the absolute file offset in bytes where the platform specific // file locator data is stored. Stored in big-endian format. PlatformDataOffset int64 // This is not a field that get stored or retrieved from disk's ParentLocator entry. // We use this field to store the resolved file locator path. PlatformSpecificFileLocator string }
ParentLocator represents an entry in Parent locator table. Each entry represents details (parent-hard-disk-locator-info) of file locator which is used to locate the parent disk file of differencing hard disk.
func (*ParentLocator) SetPlatformSpecificFileLocator ¶
func (l *ParentLocator) SetPlatformSpecificFileLocator(fileLocator []byte)
SetPlatformSpecificFileLocator retrieves the file locator value and store that in the property PlatformSpecificFileLocator
type ParentLocators ¶
type ParentLocators []*ParentLocator
ParentLocators type represents the parent locator collection (parent-hard-disk-locator-info collection). The collection 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 should be set to zero for dynamic disks.
func (ParentLocators) GetAbsoluteParentPath ¶
func (p ParentLocators) GetAbsoluteParentPath() string
GetAbsoluteParentPath returns the absolute path to the parent differencing hard disk
func (ParentLocators) GetRelativeParentPath ¶
func (p ParentLocators) GetRelativeParentPath() string
GetRelativeParentPath returns the relative path to the parent differencing hard disk
type ParseError ¶
type ParseError struct { LocatorField string // contains filtered or unexported fields }
ParseError is the error type representing disk header parent locator parse error.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error returns the string representation of the ParseError instance.
func (*ParseError) GetInnerErr ¶
func (e *ParseError) GetInnerErr() error
GetInnerErr returns the inner error, this method satisfies InnerErr interface
type PlatformCode ¶
type PlatformCode int32
The PlatformCode describes which platform-specific format is used for the file locator This is the type of PlatformCode field in ParentLocator type.
func (PlatformCode) String ¶
func (p PlatformCode) String() string
String returns the string representation of the PlatformCode. If the int platform code value does not match with the predefined PlatformCodes then this function convert the int to string and return