mbr

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGPTProtectiveMBR = errors.New("GPT protective MBR found")

ErrGPTProtectiveMBR denotes GPT protected MBR found error.

Functions

This section is empty.

Types

type AAPHeader

type AAPHeader struct {
	BootstrapCode    [428]byte
	AAPSignature     uint16       // 2 bytes.
	AAPPhysicalDrive uint8        // 1 byte.
	FirstCHS         CHS          // 3 bytes.
	AAPPartitionType uint8        // 1 byte.
	LastCHS          CHS          // 3 bytes.
	FirstLBA         uint32       // 4 bytes.
	NumSectors       uint32       // 4 bytes.
	PartitionEntries [4]PartEntry // 4 x 16 bytes.
	BootSignature    uint16       // 2 bytes.
}

AAPHeader denotes Advanced Active Partitions MBR header.

type CHS

type CHS struct {
	Cylinder uint8 // 1 byte.
	Head     uint8 // 1 byte.
	Sector   uint8 // 1 byte.
}

CHS denotes Cylinder-Head-Sector address.

type ClassicHeader

type ClassicHeader struct {
	BootstrapCode    [446]byte
	PartitionEntries [4]PartEntry // 4 x 16 bytes.
	BootSignature    uint16       // 2 bytes.
}

ClassicHeader denotes classical generic MBR header.

type MBR

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

MBR is interface compatible partition table information.

func Probe

func Probe(readSeeker io.ReadSeeker) (mbr *MBR, err error)

Probe reads and returns MBR style partition table.

func (*MBR) Partitions

func (mbr *MBR) Partitions() map[int]*parttable.Partition

Partitions returns list of partitions.

func (*MBR) Type

func (mbr *MBR) Type() string

Type returns "msdos"

func (*MBR) UUID

func (mbr *MBR) UUID() string

UUID returns partition table UUID.

type MSDOSHeader

type MSDOSHeader struct {
	BootstrapCode    [380]byte
	MSDOSSignature   uint16       // 2 bytes.
	PartitionEntries [8]PartEntry // 8 x 16 bytes.
	BootSignature    uint16       // 2 bytes.
}

MSDOSHeader denotes MSDOS MBR header.

type ModernStandardHeader

type ModernStandardHeader struct {
	BootstrapCode         [218]byte
	Empty                 uint16 // 2 bytes.
	OriginalPhysicalDrive uint8  // 1 byte.
	Seconds               uint8  // 1 byte.
	Minutes               uint8  // 1 byte.
	Hours                 uint8  // 1 byte.
	SecondBootstrapCode   [216]byte
	DiskSignature         uint32       // 4 bytes.
	CopyProtectedStatus   uint16       // 2 bytes.
	PartitionEntries      [4]PartEntry // 4 x 16 bytes.
	BootSignature         uint16       // 2 bytes.
}

ModernStandardHeader denotes modern standard MBR header.

type PartEntry

type PartEntry struct {
	Status        uint8  // 1 byte
	FirstCHS      CHS    // 3 bytes.
	PartitionType uint8  // 1 byte.
	LastCHS       CHS    // 3 bytes.
	FirstLBA      uint32 // 4 bytes.
	NumSectors    uint32 // 4 bytes.
}

PartEntry denotes partition entry.

Jump to

Keyboard shortcuts

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