blockdevice

package
v0.1.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MPL-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package blockdevice provides a library for working with block devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDevice

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

BlockDevice represents a block device.

func Open

func Open(devname string, setters ...Option) (*BlockDevice, error)

Open initializes and returns a block device. TODO(andrewrynhard): Use BLKGETSIZE ioctl to get the size. TODO(andrewrynhard): Use BLKPBSZGET ioctl to get the physical sector size. TODO(andrewrynhard): Use BLKSSZGET ioctl to get the logical sector size and pass them into gpt as options.

func (*BlockDevice) Close

func (bd *BlockDevice) Close() error

Close closes the block devices's open file.

func (*BlockDevice) Device

func (bd *BlockDevice) Device() *os.File

Device returns the backing file for the block device

func (*BlockDevice) PartitionTable

func (bd *BlockDevice) PartitionTable(read bool) (table.PartitionTable, error)

PartitionTable returns the block device partition table.

func (*BlockDevice) RereadPartitionTable

func (bd *BlockDevice) RereadPartitionTable() error

RereadPartitionTable invokes the BLKRRPART ioctl to have the kernel read the partition table.

func (*BlockDevice) Size

func (bd *BlockDevice) Size() (uint64, error)

Size returns the size of the block device in bytes.

type Option

type Option func(*Options)

Option is the functional option func.

func WithNewGPT

func WithNewGPT(o bool) Option

WithNewGPT opens the blockdevice with a new GPT.

type Options

type Options struct {
	CreateGPT bool
}

Options is the functional options struct.

func NewDefaultOptions

func NewDefaultOptions(setters ...Option) *Options

NewDefaultOptions initializes a Options struct with default values.

Directories

Path Synopsis
xfs
Package xfs provides an interface to xfsprogs.
Package xfs provides an interface to xfsprogs.
Package lba provides a library for working with Logical Block Addresses.
Package lba provides a library for working with Logical Block Addresses.
Package table provides a library for working with block device partition tables.
Package table provides a library for working with block device partition tables.
gpt
Package gpt provides a library for working with GPT partitions.
Package gpt provides a library for working with GPT partitions.
gpt/header
Package header provides a library for working with GPT headers.
Package header provides a library for working with GPT headers.
gpt/partition
Package partition provides a library for working with GPT partitions.
Package partition provides a library for working with GPT partitions.

Jump to

Keyboard shortcuts

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