gptstructs

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package gptstructs provides encoded definitions for GPT on-disk structures.

Index

Constants

View Source
const ENTRY_SIZE = 128

ENTRY_SIZE is the size of the Entry struct.

View Source
const HEADER_SIZE = 92

HEADER_SIZE is the size of the Header struct.

View Source
const HeaderSignature = 0x5452415020494645 // "EFI PART"

HeaderSignature is the signature of the GPT header.

View Source
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

func (s Entry) Get_attributes() uint64

Get_attributes returns attributes.

func (Entry) Get_ending_lba

func (s Entry) Get_ending_lba() uint64

Get_ending_lba returns ending_lba.

func (Entry) Get_partition_name

func (s Entry) Get_partition_name() []byte

Get_partition_name returns partition_name.

func (Entry) Get_partition_type_guid

func (s Entry) Get_partition_type_guid() []byte

Get_partition_type_guid returns type UUID.

func (Entry) Get_starting_lba

func (s Entry) Get_starting_lba() uint64

Get_starting_lba returns starting_lba.

func (Entry) Get_unique_partition_guid

func (s Entry) Get_unique_partition_guid() []byte

Get_unique_partition_guid returns partition UUID.

func (Entry) Put_attributes

func (s Entry) Put_attributes(v uint64)

Put_attributes sets attributes.

func (Entry) Put_ending_lba

func (s Entry) Put_ending_lba(v uint64)

Put_ending_lba sets ending_lba.

func (Entry) Put_partition_name

func (s Entry) Put_partition_name(v []byte)

Put_partition_name sets partition_name.

func (Entry) Put_partition_type_guid

func (s Entry) Put_partition_type_guid(v []byte)

Put_partition_type_guid sets type UUID.

func (Entry) Put_starting_lba

func (s Entry) Put_starting_lba(v uint64)

Put_starting_lba sets starting_lba.

func (Entry) Put_unique_partition_guid

func (s Entry) Put_unique_partition_guid(v []byte)

Put_unique_partition_guid sets partition UUID.

type Header []byte

Header is a byte slice representing the header.h C header.

func (Header) CalculateChecksum

func (h Header) CalculateChecksum() uint32

CalculateChecksum calculates the checksum of the header.

func (Header) Get_alternate_lba

func (s Header) Get_alternate_lba() uint64

Get_alternate_lba returns location of the other header copy.

func (Header) Get_disk_guid

func (s Header) Get_disk_guid() []byte

Get_disk_guid returns disk UUID.

func (Header) Get_first_usable_lba

func (s Header) Get_first_usable_lba() uint64

Get_first_usable_lba returns first usable LBA for partitions.

func (Header) Get_header_crc32

func (s Header) Get_header_crc32() uint32

Get_header_crc32 returns header_crc32.

func (Header) Get_header_size

func (s Header) Get_header_size() uint32

Get_header_size returns usually 92 bytes.

func (Header) Get_last_usable_lba

func (s Header) Get_last_usable_lba() uint64

Get_last_usable_lba returns last usable LBA for partitions.

func (Header) Get_my_lba

func (s Header) Get_my_lba() uint64

Get_my_lba returns location of this header copy.

func (Header) Get_num_partition_entries

func (s Header) Get_num_partition_entries() uint32

Get_num_partition_entries returns num_partition_entries.

func (Header) Get_partition_entries_lba

func (s Header) Get_partition_entries_lba() uint64

Get_partition_entries_lba returns always 2 in primary header copy.

func (Header) Get_partition_entry_array_crc32

func (s Header) Get_partition_entry_array_crc32() uint32

Get_partition_entry_array_crc32 returns partition_entry_array_crc32.

func (Header) Get_reserved1

func (s Header) Get_reserved1() uint32

Get_reserved1 returns reserved1.

func (Header) Get_revision

func (s Header) Get_revision() uint32

Get_revision returns revision.

func (Header) Get_signature

func (s Header) Get_signature() uint64

Get_signature returns "EFI PART".

func (Header) Get_sizeof_partition_entry

func (s Header) Get_sizeof_partition_entry() uint32

Get_sizeof_partition_entry returns sizeof_partition_entry.

func (Header) Put_alternate_lba

func (s Header) Put_alternate_lba(v uint64)

Put_alternate_lba sets location of the other header copy.

func (Header) Put_disk_guid

func (s Header) Put_disk_guid(v []byte)

Put_disk_guid sets disk UUID.

func (Header) Put_first_usable_lba

func (s Header) Put_first_usable_lba(v uint64)

Put_first_usable_lba sets first usable LBA for partitions.

func (Header) Put_header_crc32

func (s Header) Put_header_crc32(v uint32)

Put_header_crc32 sets header_crc32.

func (Header) Put_header_size

func (s Header) Put_header_size(v uint32)

Put_header_size sets usually 92 bytes.

func (Header) Put_last_usable_lba

func (s Header) Put_last_usable_lba(v uint64)

Put_last_usable_lba sets last usable LBA for partitions.

func (Header) Put_my_lba

func (s Header) Put_my_lba(v uint64)

Put_my_lba sets location of this header copy.

func (Header) Put_num_partition_entries

func (s Header) Put_num_partition_entries(v uint32)

Put_num_partition_entries sets num_partition_entries.

func (Header) Put_partition_entries_lba

func (s Header) Put_partition_entries_lba(v uint64)

Put_partition_entries_lba sets always 2 in primary header copy.

func (Header) Put_partition_entry_array_crc32

func (s Header) Put_partition_entry_array_crc32(v uint32)

Put_partition_entry_array_crc32 sets partition_entry_array_crc32.

func (Header) Put_reserved1

func (s Header) Put_reserved1(v uint32)

Put_reserved1 sets reserved1.

func (Header) Put_revision

func (s Header) Put_revision(v uint32)

Put_revision sets revision.

func (Header) Put_signature

func (s Header) Put_signature(v uint64)

Put_signature sets "EFI PART".

func (Header) Put_sizeof_partition_entry

func (s Header) Put_sizeof_partition_entry(v uint32)

Put_sizeof_partition_entry sets sizeof_partition_entry.

type HeaderReader

type HeaderReader interface {
	io.ReaderAt
	GetSectorSize() uint
}

HeaderReader is an interface for reading GPT headers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL