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) (bd *BlockDevice, err 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.
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. |