mbr

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package mbr provides an io/fs implementation of the Master Boot Record (MBR) partition table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chs

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

func (*Chs) B2

func (k *Chs) B2() (value uint8)

func (*Chs) B3

func (k *Chs) B3() (value uint8)

func (*Chs) Cylinder

func (k *Chs) Cylinder() (value int64)

func (*Chs) Decode

func (k *Chs) Decode(reader io.ReadSeeker, ancestors ...interface{}) (err error)

func (*Chs) Head

func (k *Chs) Head() (value uint8)

func (*Chs) Parent

func (k *Chs) Parent() *PartitionEntry

func (*Chs) Root

func (k *Chs) Root() *MbrPartitionTable

func (*Chs) Sector

func (k *Chs) Sector() (value int64)

type FS

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

FS implements a read-only file system for Master Boot Records (MBR).

func New

func New(decoder io.ReadSeeker) (*FS, error)

New creates a new mbr FS.

func (*FS) Open

func (fsys *FS) Open(name string) (fs.File, error)

Open opens a file for reading.

type MbrPartitionTable

type MbrPartitionTable struct {
	// contains filtered or unexported fields
}
MBR (Master Boot Record) partition table is a traditional way of

MS-DOS to partition larger hard disc drives into distinct partitions.

This table is stored in the end of the boot sector (first sector) of the drive, after the bootstrap code. Original DOS 2.0 specification allowed only 4 partitions per disc, but DOS 3.2 introduced concept of "extended partitions", which work as nested extra "boot records" which are pointed to by original ("primary") partitions in MBR.

func (*MbrPartitionTable) BootSignature

func (k *MbrPartitionTable) BootSignature() (value []byte)

func (*MbrPartitionTable) BootstrapCode

func (k *MbrPartitionTable) BootstrapCode() (value []byte)

func (*MbrPartitionTable) Decode

func (k *MbrPartitionTable) Decode(reader io.ReadSeeker, ancestors ...interface{}) (err error)

func (*MbrPartitionTable) Parent

func (k *MbrPartitionTable) Parent() *MbrPartitionTable

func (*MbrPartitionTable) Partitions

func (k *MbrPartitionTable) Partitions() (value [4]PartitionEntry)

func (*MbrPartitionTable) Root

type Partition

type Partition struct {
	*io.SectionReader
	// contains filtered or unexported fields
}

Partition implements fs.File

func NewPartition

func NewPartition(name int, partition *PartitionEntry) *Partition

NewPartition creates a new Partition object for parsing MBR partitions.

func (*Partition) Close

func (p *Partition) Close() error

Close does not do anything for MBR partitions.

func (*Partition) Info

func (p *Partition) Info() (fs.FileInfo, error)

func (*Partition) IsDir

func (p *Partition) IsDir() bool

IsDir returns false for partition.

func (*Partition) ModTime

func (p *Partition) ModTime() time.Time

ModTime returns the zero time (0001-01-01 00:00) for partitions.

func (*Partition) Mode

func (p *Partition) Mode() fs.FileMode

Mode returns 0 for partitions.

func (*Partition) Name

func (p *Partition) Name() string

Name returns the name of a partition that consists of 'pX' where X is the number of the partition.

func (*Partition) Size

func (p *Partition) Size() int64

Size returns the partition size.

func (*Partition) Stat

func (p *Partition) Stat() (fs.FileInfo, error)

Stat return an fs.FileInfo object that describes a file.

func (*Partition) Sys

func (p *Partition) Sys() interface{}

Sys returns the PartitionEntry.

func (*Partition) Type

func (p *Partition) Type() fs.FileMode

type PartitionEntry

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

func (*PartitionEntry) ChsEnd

func (k *PartitionEntry) ChsEnd() (value *Chs)

func (*PartitionEntry) ChsStart

func (k *PartitionEntry) ChsStart() (value *Chs)

func (*PartitionEntry) Decode

func (k *PartitionEntry) Decode(reader io.ReadSeeker, ancestors ...interface{}) (err error)

func (*PartitionEntry) LbaStart

func (k *PartitionEntry) LbaStart() (value uint32)

func (*PartitionEntry) NumSectors

func (k *PartitionEntry) NumSectors() (value uint32)

func (*PartitionEntry) Parent

func (k *PartitionEntry) Parent() *MbrPartitionTable

func (*PartitionEntry) PartitionType

func (k *PartitionEntry) PartitionType() (value uint8)

func (*PartitionEntry) Root

func (k *PartitionEntry) Root() *MbrPartitionTable

func (*PartitionEntry) Status

func (k *PartitionEntry) Status() (value uint8)

type Root

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

Root is a pseudo root directory for a Master Boot Record.

func (*Root) Close

func (r *Root) Close() error

Close does not do anything for MBR pseudo roots.

func (*Root) IsDir

func (r *Root) IsDir() bool

IsDir returns true for MBR pseudo roots.

func (*Root) ModTime

func (r *Root) ModTime() time.Time

ModTime returns the zero time (0001-01-01 00:00) for MBR pseudo roots.

func (*Root) Mode

func (r *Root) Mode() fs.FileMode

Mode returns fs.ModeDir for MBR pseudo roots.

func (*Root) Name

func (r *Root) Name() string

Name always returns / for MBR roots.

func (*Root) Read

func (r *Root) Read([]byte) (int, error)

func (*Root) ReadDir

func (r *Root) ReadDir(n int) ([]fs.DirEntry, error)

ReadDir lists all partitions in the MBR.

func (*Root) Size

func (r *Root) Size() int64

Size returns 0 for MBR pseudo roots.

func (*Root) Stat

func (r *Root) Stat() (fs.FileInfo, error)

Stat returns the MBR pseudo roots itself as fs.FileMode.

func (*Root) Sys

func (r *Root) Sys() interface{}

Sys returns nil for MBR pseudo roots.

Jump to

Keyboard shortcuts

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