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 Mbr ¶
Mbr represents entier MBR. refs: https://en.wikipedia.org/wiki/Master_boot_record
type MbrEntry ¶
type MbrEntry struct { BootFlag byte FirstChs Chs Id byte LastChs Chs FirstLBA uint32 AllLBA uint32 }
MbrEntry represents the partition entry.
type REntry ¶ added in v0.0.2
type REntry struct { TypeGuid string UniqueGuid string FirstLBA uint64 LastLBA uint64 AttrFlags uint64 Name string }
REntry represents Entry for human readable format.
TypeGuid/UniqueGuid/Name are string type.
type RGpt ¶ added in v0.0.2
type RGpt struct { Mbr RMbr Header RHeader Entries map[uint]REntry BackupEntries map[uint]REntry BackupHeader RHeader }
RMbr represents RGpt for human readable format.
type RHeader ¶ added in v0.0.2
type RHeader 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 }
RHeader represents Header for human readable format.
DiskGuid is string type.