mbr

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Index

Constants

View Source
const (
	TABLE_TYPE_AIX
	TABLE_TYPE_AMIGA
	TABLE_TYPE_BSD
	TABLE_TYPE_DVH
	TABLE_TYPE_GPT
	TABLE_TYPE_LOOP
	TABLE_TYPE_MAC
	TABLE_TYPE_MSDOS
	TABLE_TYPE_PC98
	TABLE_TYPE_SUN
)

Variables

This section is empty.

Functions

func Write added in v0.13.0

func Write(filename string, tableType TableType, partitions []Partition) error

Write will write a partition table of the specified table type with the specified partitions.

func WriteDefault

func WriteDefault(filename string, tableType TableType) error

WriteDefault will write a default partition table for the specified partition table type. DOS: a single ext2 Linux partition is created. GPT: a UEFI partition followed by an ext2 partition are created. Other partition types have unspecified behaviour.

Types

type Mbr

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

func Decode

func Decode(file *os.File) (*Mbr, error)

func (*Mbr) GetNumPartitions

func (mbr *Mbr) GetNumPartitions() uint

func (*Mbr) GetPartitionOffset

func (mbr *Mbr) GetPartitionOffset(index uint) uint64

func (*Mbr) GetPartitionSize

func (mbr *Mbr) GetPartitionSize(index uint) uint64

func (*Mbr) SetPartitionOffset added in v0.3.2

func (mbr *Mbr) SetPartitionOffset(index uint, offset uint64) error

func (*Mbr) SetPartitionSize added in v0.3.2

func (mbr *Mbr) SetPartitionSize(index uint, size uint64) error

func (*Mbr) Write added in v0.3.2

func (mbr *Mbr) Write(filename string) error

type Partition added in v0.13.0

type Partition struct {
	Size types.Bytes // Zero: use all remaining space.
	Type string
}

type TableType

type TableType uint

func (*TableType) Set

func (tt *TableType) Set(value string) error

func (TableType) String

func (tt TableType) String() string

Jump to

Keyboard shortcuts

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