gpt

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Signature  = "EFI PART"
	SectorSize = 0x200
)
View Source
const (
	HFSPlus            = "48465300-0000-11AA-AA11-00306543ECAC"
	Apple_APFS         = "7C3457EF-0000-11AA-AA11-00306543ECAC"
	Apple_UFS          = "55465300-0000-11AA-AA11-00306543ECAC"
	ZFS                = "6A898CC3-1DD2-11B2-99A6-080020736631"
	Apple_RAID         = "52414944-0000-11AA-AA11-00306543ECAC"
	Apple_RAID_offline = "52414944-5F4F-11AA-AA11-00306543ECAC"
	Apple_Recovery_HD  = "426F6F74-0000-11AA-AA11-00306543ECAC"
	Apple_Label        = "4C616265-6C00-11AA-AA11-00306543ECAC"
	AppleTV_Recovery   = "5265636F-7665-11AA-AA11-00306543ECAC"
	HFSPlus_FileVault  = "53746F72-6167-11AA-AA11-00306543ECAC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GUIDPartitionTable

type GUIDPartitionTable struct {
	Header     Header
	Partitions []Partition
}

GUIDPartitionTable is a GPT table object

func NewGUIDPartitionTable

func NewGUIDPartitionTable(r io.Reader) (*GUIDPartitionTable, error)

NewGUIDPartitionTable reads a GPT from the given io.Reader

func (GUIDPartitionTable) CalulatePartitionsCRC

func (g GUIDPartitionTable) CalulatePartitionsCRC() uint32

CalulatePartitionsCRC calculates the partition tables's CRC32 hash

type Header struct {
	Signature       magic
	Revision        uint32
	HeaderSize      uint32
	CRC32           uint32
	Reserved        uint32
	HeaderStartLBA  uint64
	BackupLBA       uint64
	FirstUsableLBA  uint64
	LastUsableLBA   uint64
	DiskGUID        guid
	EntriesStart    uint64
	EntriesCount    uint32
	EntriesSize     uint32
	PartitionsCRC32 uint32
	Padding         [420]byte
}

Header is a GPT header object

func (Header) CalulateCRC

func (h Header) CalulateCRC() uint32

CalulateCRC calculates the header's CRC32 hash

func (Header) String

func (h Header) String() string

func (Header) Verify

func (h Header) Verify() error

Verify verifies the header

type Partition

type Partition struct {
	Type               guid
	ID                 guid
	StartingLBA        uint64
	EndingLBA          uint64
	Attributes         uint64
	PartitionNameUTF16 [72]uint8
}

Partition is a GPT partition object

func (Partition) IsEmpty

func (p Partition) IsEmpty() bool

IsEmpty returns if the partiton is empty

func (Partition) LookupType

func (p Partition) LookupType() string

LookupType returns the string name for a given partition type if known otherwise it will return the GUID

func (Partition) Name

func (p Partition) Name() string

Name returns the partiton's name

func (Partition) String

func (p Partition) String() string

Jump to

Keyboard shortcuts

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