gpt

package
v0.1.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gpt 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 GPT

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

GPT represents the GUID partition table.

func NewGPT

func NewGPT(devname string, f *os.File, setters ...interface{}) *GPT

NewGPT initializes and returns a GUID partition table.

func (*GPT) Add

func (gpt *GPT) Add(size uint64, setters ...interface{}) (table.Partition, error)

Add adds a partition.

func (*GPT) Bytes

func (gpt *GPT) Bytes() []byte

Bytes returns the partition table as a byte slice.

func (*GPT) Delete

func (gpt *GPT) Delete(partition table.Partition) error

Delete deletes a partition.

func (*GPT) Header

func (gpt *GPT) Header() table.Header

Header returns the header.

func (*GPT) InformKernelOfAdd

func (gpt *GPT) InformKernelOfAdd(partition table.Partition) error

InformKernelOfAdd invokes the BLKPG_ADD_PARTITION ioctl.

func (*GPT) InformKernelOfDelete

func (gpt *GPT) InformKernelOfDelete(partition table.Partition) error

InformKernelOfDelete invokes the BLKPG_DEL_PARTITION ioctl.

func (*GPT) InformKernelOfResize

func (gpt *GPT) InformKernelOfResize(partition table.Partition) error

InformKernelOfResize invokes the BLKPG_RESIZE_PARTITION ioctl.

func (*GPT) New

func (gpt *GPT) New() (table.PartitionTable, error)

New creates a new partition table and writes it to disk.

func (*GPT) Partitions

func (gpt *GPT) Partitions() []table.Partition

Partitions returns the partitions.

func (*GPT) PhysicalBlockSize

func (gpt *GPT) PhysicalBlockSize() int

PhysicalBlockSize returns the physical block size.

func (*GPT) Read

func (gpt *GPT) Read() error

Read performs reads the partition table.

func (*GPT) Repair

func (gpt *GPT) Repair() error

Repair repairs the partition table.

func (*GPT) Resize

func (gpt *GPT) Resize(p table.Partition) error

Resize resizes a partition. TODO(andrewrynhard): Verify that we can indeed grow this partition safely.

func (*GPT) Type

func (gpt *GPT) Type() table.Type

Type returns the partition type.

func (*GPT) Write

func (gpt *GPT) Write() error

Write writes the partition table to disk.

type Option

type Option func(*Options)

Option is the functional option func.

func WithLogicalBlockSize

func WithLogicalBlockSize(o int) Option

WithLogicalBlockSize sets the logical block size.

func WithPhysicalBlockSize

func WithPhysicalBlockSize(o int) Option

WithPhysicalBlockSize sets the physical block size.

func WithPrimaryGPT

func WithPrimaryGPT(o bool) Option

WithPrimaryGPT sets the contents of offset 24 in the GPT header to the location of the primary header.

type Options

type Options struct {
	PrimaryGPT        bool
	PhysicalBlockSize int
	LogicalBlockSize  int
}

Options is the functional options struct.

func NewDefaultOptions

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

NewDefaultOptions initializes a Options struct with default values.

Directories

Path Synopsis
Package header provides a library for working with GPT headers.
Package header provides a library for working with GPT headers.
Package partition provides a library for working with GPT partitions.
Package partition provides a library for working with GPT partitions.

Jump to

Keyboard shortcuts

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