gpt

package
v0.0.0-...-ef7891b Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GUID

type GUID struct {
	TimeLow          uint32
	TimeMid          uint16
	TimeHiAndVersion uint16
	Seq              uint64
}

GUID represents a GUID in binary format according to RFC4122 as in GPT Header

func (*GUID) AsUUID

func (guid *GUID) AsUUID() uuid.UUID

AsUUID takes a GUID structure and transforms it to a uuid.UUID

type GUIDPartitionTable

type GUIDPartitionTable struct {
	Header  Header
	Entries [128]PartitionEntry
}

GUIDPartitionTable represents a GPT on EFI systems

func ReadFrom

func ReadFrom(filename string) (*GUIDPartitionTable, error)

ReadFrom reads the GPT header from a file

func (*GUIDPartitionTable) String

func (table *GUIDPartitionTable) String() string
type Header struct {
	Signature   [8]byte
	Revision    uint32
	HeaderSize  uint32
	HeaderCRC32 uint32

	CurrentLBA                 uint64
	BackupLBA                  uint64
	FirstUsableLBA             uint64
	LastUsableLBA              uint64
	DiskGUID                   GUID
	StartLBA                   uint64
	NumberOfPartitionEntries   uint32
	SizeOfSinglePartitionEntry uint32
	PartitionArrayCRC32        uint32
	// contains filtered or unexported fields
}

Header represents the header of a GPT at LBA1

func (*Header) CalculateCRC32

func (header *Header) CalculateCRC32() uint32

CalculateCRC32 calculates the crc32 of the Header

func (*Header) CheckCRC32

func (header *Header) CheckCRC32() bool

CheckCRC32 calculates the actual CRC32 of the header and compares it against the declared CRC32

func (Header) String

func (header Header) String() string

type PartitionEntry

type PartitionEntry struct {
	PartitionType     GUID
	UniquePartitionID GUID
	FirstLBA          uint64
	LastLBA           uint64
	Flags             uint64
	PartitonName      [72]byte
}

PartitionEntry represents one entry in the GPT Partition Array

func (PartitionEntry) IsUnused

func (entry PartitionEntry) IsUnused() bool

IsUnused checks if a partition entry does not point to an existing partition

Jump to

Keyboard shortcuts

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