Documentation ¶
Index ¶
Constants ¶
const HeaderSignature = 0x5452415020494645
The signature of GPT Header. "EFI PART".
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chs ¶
type Chs struct {
Body [3]byte
}
Chs represents Cylinder head sector ref: https://en.wikipedia.org/wiki/Cylinder-head-sector
type Entry ¶
type Entry struct { TypeGuid Guid UniqueGuid Guid FirstLBA uint64 LastLBA uint64 AttrFlags uint64 Name [36]uint16 }
Entry represents a partition entries of GPT. ref: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries_(LBA_2%E2%80%9333)
func ReadEntry ¶
ReadEntry reads GPT Entry from r. It returns GPT Entry pointer or error if error occured.
type Gpt ¶
GPT represents MBR, GPT header and each partition entries. It also contains backup header and entries.
type Guid ¶
type Guid [16]byte
var EspGuid *Guid
var ZeroGuid *Guid
ZeroGuid 00000000-0000-0000-0000-00000000000
func NewGuidFromBytes ¶
NewGuidFromBytes returns guid from b.
func NewGuidFromString ¶
NewGuidFromString returns guid grom s. Format is 00112233-4455-6677-8899-aabbccddeeff
type Header ¶
type Header struct { Signature uint64 Revision uint32 Size uint32 Crc32OfHeader uint32 Reserved uint32 CurrentLBA uint64 BackupLBA uint64 FirstUsableLBA uint64 LastUsableLBA uint64 DiskGuid Guid StartingLBA uint64 NumOfEntries uint32 SizeOfEntry uint32 Crc32OfEntries uint32 Reserved2 [420]byte }
Header reprensents the partition table header of GPT. ref: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_(LBA_1)
func ReadHeader ¶
ReadHeader reads GPT Header from r. This function treats sector size is 512 byte. It returns GPT Header pointer or error if error occured.
type JsonEntry ¶
type JsonEntry struct { TypeGuid string UniqueGuid string FirstLBA uint64 LastLBA uint64 AttrFlags uint64 Name string }
JsonEntry represents Entry for json.
TypeGuid/UniqueGuid/Name are string type.
func NewJsonEntry ¶
type JsonGpt ¶
type JsonGpt struct { Mbr JsonMbr Header JsonHeader Entries map[uint]JsonEntry BackupEntries map[uint]JsonEntry BackupHeader JsonHeader }
JsonMbr represents JsonGpt for json.
func NewJsonGpt ¶
type JsonHeader ¶
type JsonHeader struct { Signature uint64 Revision uint32 Size uint32 Crc32OfHeader uint32 Reserved uint32 CurrentLBA uint64 BackupLBA uint64 FirstUsableLBA uint64 LastUsableLBA uint64 DiskGuid string StartingLBA uint64 NumOfEntries uint32 SizeOfEntry uint32 Crc32OfEntries uint32 }
JsonHeader represents Header for json.
DiskGuid is string type.
func NewJsonHeader ¶
func NewJsonHeader(h Header) *JsonHeader
type JsonMbr ¶
type JsonMbr struct { Entries [4]JsonMbrEntry Signature uint16 }
JsonMbr represents Mbr for json.
func NewJsonMbr ¶
type JsonMbrEntry ¶
type JsonMbrEntry struct { BootFlag byte FirstChs JsonChs Id byte LastChs JsonChs FirstLBA uint32 AllLBA uint32 }
JsonMbrEntry represents MbrEntry for json.
func NewJsonMbrEntry ¶
func NewJsonMbrEntry(m MbrEntry) *JsonMbrEntry
type Mbr ¶
Mbr represents entier MBR. refs: https://en.wikipedia.org/wiki/Master_boot_record