gpt

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UUID2String

func UUID2String(uuid [16]byte) string

UUID2String converts UUID to string.

Types

type Entry

type Entry struct {
	TypeGUID      [16]byte
	GUID          [16]byte
	FirstLBA      uint64 // 8 bytes.
	LastLBA       uint64 // 8 bytes.
	AttributeFlag uint64 // 8 bytes.
	Name          [72]byte
}

Entry contains partition entries (LBA 2-33) as per specification in https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries_(LBA_2%E2%80%9333)

type GPT

type GPT struct {
	// contains filtered or unexported fields
}

GPT is interface compatible partition table information.

func Probe

func Probe(reader io.Reader) (*GPT, error)

Probe reads and returns GPT partition table.

func (*GPT) Partitions

func (gpt *GPT) Partitions() map[int]*parttable.Partition

Partitions returns list of partitions.

func (*GPT) Type

func (gpt *GPT) Type() string

Type returns "gpt"

func (*GPT) UUID

func (gpt *GPT) UUID() string

UUID returns partition table UUID.

type Header struct {
	Signature  [8]byte
	Revision   [4]byte
	HeaderSize uint32 // 4 bytes.
	CRC32      uint32 // 4 bytes.

	CurrentLBA             uint64 // 8 bytes.
	BackupLBA              uint64 // 8 bytes.
	FirstUsableLBA         uint64 // 8 bytes.
	LastUsableLBA          uint64 // 8 bytes.
	DiskGUID               [16]byte
	PartitionEntryStartLBA uint64 // 8 bytes.
	NumPartitionEntries    uint32 // 4 bytes.
	PartitionEntrySize     uint32 // 4 bytes.
	PartitionArrayCRC32    uint32 // 4 bytes.
	// contains filtered or unexported fields
}

Header contains GPT header in LBA 1 as per specification in https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_(LBA_1)

type Table

type Table struct {
	Header  Header
	Entries []Entry
}

Table denotes GPT partition table.

func Read

func Read(reader io.Reader) (*Table, error)

Read reads GPT partition table from given reader.

Jump to

Keyboard shortcuts

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