gpt

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 gpt provides an io/fs implementation of the GUID partition table (GPT).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 gpt FS.

func (*FS) Open

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

Open returns a File for the given location.

type GptPartitionTable

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

func (*GptPartitionTable) Backup

func (k *GptPartitionTable) Backup() (value *PartitionHeader)

func (*GptPartitionTable) Decode

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

func (*GptPartitionTable) Parent

func (k *GptPartitionTable) Parent() *GptPartitionTable

func (*GptPartitionTable) Primary

func (k *GptPartitionTable) Primary() (value *PartitionHeader)

func (*GptPartitionTable) Root

func (*GptPartitionTable) SectorSize

func (k *GptPartitionTable) SectorSize() (value int64)

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 GPT partitions.

func (*Partition) Close

func (p *Partition) Close() error

Close does not do anything for GPT partitions.

func (*Partition) Info

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

func (*Partition) IsDir

func (*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) Attributes

func (k *PartitionEntry) Attributes() (value uint64)

func (*PartitionEntry) Decode

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

func (*PartitionEntry) FirstLba

func (k *PartitionEntry) FirstLba() (value uint64)

func (*PartitionEntry) Guid

func (k *PartitionEntry) Guid() (value []byte)

func (*PartitionEntry) LastLba

func (k *PartitionEntry) LastLba() (value uint64)

func (*PartitionEntry) Name

func (k *PartitionEntry) Name() (value []byte)

func (*PartitionEntry) Parent

func (k *PartitionEntry) Parent() *PartitionHeader

func (*PartitionEntry) Root

func (k *PartitionEntry) Root() *GptPartitionTable

func (*PartitionEntry) TypeGuid

func (k *PartitionEntry) TypeGuid() (value []byte)

type PartitionHeader

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

func (*PartitionHeader) BackupLba

func (k *PartitionHeader) BackupLba() (value uint64)

func (*PartitionHeader) Crc32Array

func (k *PartitionHeader) Crc32Array() (value uint32)

func (*PartitionHeader) Crc32Header

func (k *PartitionHeader) Crc32Header() (value uint32)

func (*PartitionHeader) CurrentLba

func (k *PartitionHeader) CurrentLba() (value uint64)

func (*PartitionHeader) Decode

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

func (*PartitionHeader) DiskGuid

func (k *PartitionHeader) DiskGuid() (value []byte)

func (*PartitionHeader) Entries

func (k *PartitionHeader) Entries() (value []PartitionEntry)

func (*PartitionHeader) EntriesCount

func (k *PartitionHeader) EntriesCount() (value uint32)

func (*PartitionHeader) EntriesSize

func (k *PartitionHeader) EntriesSize() (value uint32)

func (*PartitionHeader) EntriesStart

func (k *PartitionHeader) EntriesStart() (value uint64)

func (*PartitionHeader) FirstUsableLba

func (k *PartitionHeader) FirstUsableLba() (value uint64)

func (*PartitionHeader) HeaderSize

func (k *PartitionHeader) HeaderSize() (value uint32)

func (*PartitionHeader) LastUsableLba

func (k *PartitionHeader) LastUsableLba() (value uint64)

func (*PartitionHeader) Parent

func (k *PartitionHeader) Parent() *GptPartitionTable

func (*PartitionHeader) Reserved

func (k *PartitionHeader) Reserved() (value uint32)

func (*PartitionHeader) Revision

func (k *PartitionHeader) Revision() (value uint32)

func (*PartitionHeader) Root

func (*PartitionHeader) Signature

func (k *PartitionHeader) Signature() (value []byte)

type Root

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

Root is a pseudo root directory containing the partitions.

func (*Root) Close

func (r *Root) Close() error

Close does not do anything for GPT pseudo roots.

func (*Root) IsDir

func (r *Root) IsDir() bool

IsDir returns true for GPT pseudo roots.

func (*Root) ModTime

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

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

func (*Root) Mode

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

Mode returns fs.ModeDir for GPT pseudo roots.

func (*Root) Name

func (r *Root) Name() string

Name always returns '/' for GPT 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 GPT.

func (*Root) Size

func (r *Root) Size() int64

Size returns 0 for GPT pseudo roots.

func (*Root) Stat

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

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

func (*Root) Sys

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

Sys returns nil for GPT pseudo roots.

Jump to

Keyboard shortcuts

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