header

package
v0.5.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package header provides a library for working with GPT headers.

Index

Constants

View Source
const (
	// HeaderSize is the GUID partition table header size in bytes.
	HeaderSize = 92
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Signature                string    // 0
	Revision                 uint32    // 8
	Size                     uint32    // 12
	CRC                      uint32    // 16
	Reserved                 uint32    // 20
	CurrentLBA               uint64    // 24
	BackupLBA                uint64    // 32
	FirstUsableLBA           uint64    // 40
	LastUsableLBA            uint64    // 48
	GUUID                    uuid.UUID // 56
	PartitionEntriesStartLBA uint64    // 72
	NumberOfPartitionEntries uint32    // 80
	PartitionEntrySize       uint32    // 84
	PartitionsArrayCRC       uint32    // 88
	TrailingBytes            []byte    // 92

	*lba.LogicalBlockAddresser
	// contains filtered or unexported fields
}

Header represents a GUID partition table.

func NewHeader

func NewHeader(data []byte, lba *lba.LogicalBlockAddresser) *Header

NewHeader inializes and returns a GUID partition table header.

func (*Header) ArrayBytes

func (hdr *Header) ArrayBytes() []byte

ArrayBytes returns the GUID partition table partitions entries array as a byte slice.

func (*Header) Bytes

func (hdr *Header) Bytes() []byte

Bytes implements the table.Header interface.

func (*Header) Fields

func (hdr *Header) Fields() []*serde.Field

Fields impements the serde.Serde interface. nolint: gocyclo

type Option

type Option func(*Options)

Option is the functional option func.

func WithHeaderArrayBytes

func WithHeaderArrayBytes(o []byte) Option

WithHeaderArrayBytes sets the partition type.

func WithHeaderPrimary

func WithHeaderPrimary(o bool) Option

WithHeaderPrimary sets the primary option.

func WithHeaderTable

func WithHeaderTable(o []byte) Option

WithHeaderTable sets the partition type.

type Options

type Options struct {
	Primary bool
	Table   []byte
	Array   []byte
}

Options is the functional options struct.

func NewDefaultOptions

func NewDefaultOptions(setters ...interface{}) *Options

NewDefaultOptions initializes a Options struct with default values.

Jump to

Keyboard shortcuts

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