Documentation ¶
Overview ¶
Package gptstructs provides encoded definitions for GPT on-disk structures.
Index ¶
- Constants
- func ReadHeader(r HeaderReader, lba, lastLBA uint64) (*Header, []Entry, error)
- type Entry
- func (s Entry) Get_attributes() uint64
- func (s Entry) Get_ending_lba() uint64
- func (s Entry) Get_partition_name() []byte
- func (s Entry) Get_partition_type_guid() []byte
- func (s Entry) Get_starting_lba() uint64
- func (s Entry) Get_unique_partition_guid() []byte
- func (s Entry) Put_attributes(v uint64)
- func (s Entry) Put_ending_lba(v uint64)
- func (s Entry) Put_partition_name(v []byte)
- func (s Entry) Put_partition_type_guid(v []byte)
- func (s Entry) Put_starting_lba(v uint64)
- func (s Entry) Put_unique_partition_guid(v []byte)
- type Header
- func (h Header) CalculateChecksum() uint32
- func (s Header) Get_alternate_lba() uint64
- func (s Header) Get_disk_guid() []byte
- func (s Header) Get_first_usable_lba() uint64
- func (s Header) Get_header_crc32() uint32
- func (s Header) Get_header_size() uint32
- func (s Header) Get_last_usable_lba() uint64
- func (s Header) Get_my_lba() uint64
- func (s Header) Get_num_partition_entries() uint32
- func (s Header) Get_partition_entries_lba() uint64
- func (s Header) Get_partition_entry_array_crc32() uint32
- func (s Header) Get_reserved1() uint32
- func (s Header) Get_revision() uint32
- func (s Header) Get_signature() uint64
- func (s Header) Get_sizeof_partition_entry() uint32
- func (s Header) Put_alternate_lba(v uint64)
- func (s Header) Put_disk_guid(v []byte)
- func (s Header) Put_first_usable_lba(v uint64)
- func (s Header) Put_header_crc32(v uint32)
- func (s Header) Put_header_size(v uint32)
- func (s Header) Put_last_usable_lba(v uint64)
- func (s Header) Put_my_lba(v uint64)
- func (s Header) Put_num_partition_entries(v uint32)
- func (s Header) Put_partition_entries_lba(v uint64)
- func (s Header) Put_partition_entry_array_crc32(v uint32)
- func (s Header) Put_reserved1(v uint32)
- func (s Header) Put_revision(v uint32)
- func (s Header) Put_signature(v uint64)
- func (s Header) Put_sizeof_partition_entry(v uint32)
- type HeaderReader
Constants ¶
const ENTRY_SIZE = 128
ENTRY_SIZE is the size of the Entry struct.
const HEADER_SIZE = 92
HEADER_SIZE is the size of the Header struct.
const HeaderSignature = 0x5452415020494645 // "EFI PART"
HeaderSignature is the signature of the GPT header.
const NumEntries = 128
NumEntries is the number of entries in the GPT.
Variables ¶
This section is empty.
Functions ¶
func ReadHeader ¶
func ReadHeader(r HeaderReader, lba, lastLBA uint64) (*Header, []Entry, error)
ReadHeader reads the GPT header and partition entries.
It does sanity checks on the header and partition entries.
Types ¶
type Entry ¶
type Entry []byte
Entry is a byte slice representing the entry.h C header.
func (Entry) Get_attributes ¶
Get_attributes returns attributes.
func (Entry) Get_ending_lba ¶
Get_ending_lba returns ending_lba.
func (Entry) Get_partition_name ¶
Get_partition_name returns partition_name.
func (Entry) Get_partition_type_guid ¶
Get_partition_type_guid returns type UUID.
func (Entry) Get_starting_lba ¶
Get_starting_lba returns starting_lba.
func (Entry) Get_unique_partition_guid ¶
Get_unique_partition_guid returns partition UUID.
func (Entry) Put_attributes ¶
Put_attributes sets attributes.
func (Entry) Put_ending_lba ¶
Put_ending_lba sets ending_lba.
func (Entry) Put_partition_name ¶
Put_partition_name sets partition_name.
func (Entry) Put_partition_type_guid ¶
Put_partition_type_guid sets type UUID.
func (Entry) Put_starting_lba ¶
Put_starting_lba sets starting_lba.
func (Entry) Put_unique_partition_guid ¶
Put_unique_partition_guid sets partition UUID.
type Header ¶
type Header []byte
Header is a byte slice representing the header.h C header.
func (Header) CalculateChecksum ¶
CalculateChecksum calculates the checksum of the header.
func (Header) Get_alternate_lba ¶
Get_alternate_lba returns location of the other header copy.
func (Header) Get_disk_guid ¶
Get_disk_guid returns disk UUID.
func (Header) Get_first_usable_lba ¶
Get_first_usable_lba returns first usable LBA for partitions.
func (Header) Get_header_crc32 ¶
Get_header_crc32 returns header_crc32.
func (Header) Get_header_size ¶
Get_header_size returns usually 92 bytes.
func (Header) Get_last_usable_lba ¶
Get_last_usable_lba returns last usable LBA for partitions.
func (Header) Get_my_lba ¶
Get_my_lba returns location of this header copy.
func (Header) Get_num_partition_entries ¶
Get_num_partition_entries returns num_partition_entries.
func (Header) Get_partition_entries_lba ¶
Get_partition_entries_lba returns always 2 in primary header copy.
func (Header) Get_partition_entry_array_crc32 ¶
Get_partition_entry_array_crc32 returns partition_entry_array_crc32.
func (Header) Get_reserved1 ¶
Get_reserved1 returns reserved1.
func (Header) Get_signature ¶
Get_signature returns "EFI PART".
func (Header) Get_sizeof_partition_entry ¶
Get_sizeof_partition_entry returns sizeof_partition_entry.
func (Header) Put_alternate_lba ¶
Put_alternate_lba sets location of the other header copy.
func (Header) Put_first_usable_lba ¶
Put_first_usable_lba sets first usable LBA for partitions.
func (Header) Put_header_crc32 ¶
Put_header_crc32 sets header_crc32.
func (Header) Put_header_size ¶
Put_header_size sets usually 92 bytes.
func (Header) Put_last_usable_lba ¶
Put_last_usable_lba sets last usable LBA for partitions.
func (Header) Put_my_lba ¶
Put_my_lba sets location of this header copy.
func (Header) Put_num_partition_entries ¶
Put_num_partition_entries sets num_partition_entries.
func (Header) Put_partition_entries_lba ¶
Put_partition_entries_lba sets always 2 in primary header copy.
func (Header) Put_partition_entry_array_crc32 ¶
Put_partition_entry_array_crc32 sets partition_entry_array_crc32.
func (Header) Put_signature ¶
Put_signature sets "EFI PART".
func (Header) Put_sizeof_partition_entry ¶
Put_sizeof_partition_entry sets sizeof_partition_entry.
type HeaderReader ¶
HeaderReader is an interface for reading GPT headers.