github.com/Microsoft/azure-vhd-utils@v0.0.0-20230613175315-7c30a3748a1b/vhdcore/header/header.go (about) 1 package header 2 3 import ( 4 "time" 5 6 "github.com/Microsoft/azure-vhd-utils/vhdcore" 7 "github.com/Microsoft/azure-vhd-utils/vhdcore/common" 8 "github.com/Microsoft/azure-vhd-utils/vhdcore/header/parentlocator" 9 ) 10 11 // Header represents the header of the vhd, size of the header is 1024 bytes. 12 // The header structure is present only for expanding disks (i.e. dynamic and 13 // differencing disks.) In case of dynamic and differential vhds the footer is 14 // replicated at the beginning of the disk as well, the header structure follows 15 // this replicated footer, the field 'HeaderOffset' in the footer contains absolute 16 // offset to the header structure. 17 // 18 type Header struct { 19 // Offset = 0, Size = 8 20 Cookie *vhdcore.Cookie 21 // Offset = 8, Size = 8 22 DataOffset int64 23 // Offset = 16, Size = 8 24 TableOffset int64 25 // Offset = 24, Size = 4 26 HeaderVersion VhdHeaderVersion 27 // Offset = 28, Size = 4 28 MaxTableEntries uint32 29 // Offset = 32, Size = 4 30 BlockSize uint32 31 // Offset = 36, Size = 4 32 CheckSum uint32 33 // Offset = 40, Size = 16 34 ParentUniqueID *common.UUID 35 // Offset = 56, Size = 4 36 ParentTimeStamp *time.Time 37 // Offset = 60, Size = 4 38 Reserved uint32 39 // Offset = 64, Size = 512 40 // This field contains a Unicode string (UTF-16) of the parent hard disk filename. 41 // This will be absolute path to the parent disk of differencing disk. 42 // If this field is set, then the ParentLocators collection will also contain 43 // an entry with the same path, the PlatformCode of that field will be PlatformCodeW2Ku. 44 ParentPath string 45 // Offset = 576, Count = 8 46 // Collection of entries store an absolute byte offset in the file where the 47 // parent locator for a differencing hard disk is stored. 48 // This field is used only for differencing disks and will be set to zero for 49 // dynamic disks. 50 ParentLocators parentlocator.ParentLocators 51 // Offset = 0, Size = 1024 52 // The entire header as raw bytes 53 RawData []byte 54 }