forked from microsoft/azure-vhd-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parentLocators.go
33 lines (28 loc) · 1.06 KB
/
parentLocators.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package 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.
//
type ParentLocators []*ParentLocator
// GetAbsoluteParentPath returns the absolute path to the parent differencing hard disk
//
func (p ParentLocators) GetAbsoluteParentPath() string {
return p.getParentPath(PlatformCodeW2Ku)
}
// GetRelativeParentPath returns the relative path to the parent differencing hard disk
//
func (p ParentLocators) GetRelativeParentPath() string {
return p.getParentPath(PlatformCodeW2Ru)
}
// getParentPath returns path to the parent differencing hard disk corresponding to the
// given platform code
//
func (p ParentLocators) getParentPath(code PlatformCode) string {
for _, l := range p {
if l.PlatformCode == code {
return l.PlatformSpecificFileLocator
}
}
return ""
}