partition

package
v0.0.0-...-4842e19 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchemaMBR identifies a Master Boot Record partitioning schema, or an
	// MBR like role
	SchemaMBR = "mbr"
	// SchemaGPT identifies a GUID Partition Table partitioning schema
	SchemaGPT = "gpt"
)

Variables

This section is empty.

Functions

func GeneratePartitionTable

func GeneratePartitionTable(volume *gadget.Volume, sectorSize uint64, imgSize uint64, isSeeded bool) (partition.Table, int, error)

GeneratePartitionTable prepares the partition table for structures in a volume and returns it with the partition number of the root partition.

func PartitionTableSizeFromVolume

func PartitionTableSizeFromVolume(volume *gadget.Volume, sectorSize uint64, imgSize uint64) uint64

PartitionTableSizeFromVolume returns the total size in bytes of the partition table

Types

type GPTTable

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

func (*GPTTable) AddPartition

func (t *GPTTable) AddPartition(structurePair *gadget.OnDiskAndGadgetStructurePair, structureType string) error

func (*GPTTable) GetConcreteTable

func (t *GPTTable) GetConcreteTable() partition.Table

func (*GPTTable) PartitionTableSize

func (t *GPTTable) PartitionTableSize() uint64

PartitionTableSize returns the total size in bytes of the partition table

type MBRTable

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

func (*MBRTable) AddPartition

func (t *MBRTable) AddPartition(structurePair *gadget.OnDiskAndGadgetStructurePair, structureType string) error

func (*MBRTable) GetConcreteTable

func (t *MBRTable) GetConcreteTable() partition.Table

func (*MBRTable) PartitionTableSize

func (t *MBRTable) PartitionTableSize() uint64

PartitionTableSize returns the total size in bytes of the partition table

type Table

type Table interface {
	AddPartition(structurePair *gadget.OnDiskAndGadgetStructurePair, structureType string) error
	GetConcreteTable() partition.Table
	PartitionTableSize() uint64
}

Table is a light wrapper around partition.Table to properly add partitions Some work is sadly duplicated because the go-diskfs lib does not expose the needed data (first/last LBA)

Jump to

Keyboard shortcuts

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