partition

package
v0.0.0-...-088a001 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package partition provides a library for working with GPT partitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is the functional option func.

func WithPartitionName

func WithPartitionName(o string) Option

WithPartitionName sets the partition name.

func WithPartitionType

func WithPartitionType(o [16]byte) Option

WithPartitionType sets the partition type.

type Options

type Options struct {
	Type uuid.UUID
	Name string
}

Options is the functional options struct.

func NewDefaultOptions

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

NewDefaultOptions initializes a Options struct with default values.

type Partition

type Partition struct {
	Type          uuid.UUID // 0
	ID            uuid.UUID // 16
	FirstLBA      uint64    // 32
	LastLBA       uint64    // 40
	Flags         uint64    // 48
	Name          string    // 56
	TrailingBytes []byte    // 128

	Number int32
	// contains filtered or unexported fields
}

Partition represents a partition entry in a GUID partition table.

func NewPartition

func NewPartition(data []byte) *Partition

NewPartition initializes and returns a new partition.

func (*Partition) Bytes

func (prt *Partition) Bytes() []byte

Bytes returns the partition as a byte slice.

func (*Partition) Fields

func (prt *Partition) Fields() []*serde.Field

Fields implements the serder.Serde interface.

func (*Partition) Length

func (prt *Partition) Length() int64

Length returns the partition's length in LBA.

func (*Partition) No

func (prt *Partition) No() int32

No returns the partition's number.

func (*Partition) Start

func (prt *Partition) Start() int64

Start returns the partition's starting LBA..

Jump to

Keyboard shortcuts

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