github.com/Microsoft/azure-vhd-utils@v0.0.0-20230613175315-7c30a3748a1b/vhdcore/header/parentlocator/parentLocators.go (about) 1 package parentlocator 2 3 // ParentLocators type represents the parent locator collection (parent-hard-disk-locator-info 4 // collection). The collection entries store an absolute byte offset in the file where the parent 5 // locator for a differencing hard disk is stored. This field is used only for differencing disks 6 // and should be set to zero for dynamic disks. 7 // 8 type ParentLocators []*ParentLocator 9 10 // GetAbsoluteParentPath returns the absolute path to the parent differencing hard disk 11 // 12 func (p ParentLocators) GetAbsoluteParentPath() string { 13 return p.getParentPath(PlatformCodeW2Ku) 14 } 15 16 // GetRelativeParentPath returns the relative path to the parent differencing hard disk 17 // 18 func (p ParentLocators) GetRelativeParentPath() string { 19 return p.getParentPath(PlatformCodeW2Ru) 20 } 21 22 // getParentPath returns path to the parent differencing hard disk corresponding to the 23 // given platform code 24 // 25 func (p ParentLocators) getParentPath(code PlatformCode) string { 26 for _, l := range p { 27 if l.PlatformCode == code { 28 return l.PlatformSpecificFileLocator 29 } 30 } 31 32 return "" 33 }