block

package module
v0.0.0-...-37c9a22 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: MIT Imports: 6 Imported by: 0

README

block Build Status GoDoc Go Report Card

Package block enables programmatic access to block devices. MIT Licensed.

Documentation

Overview

Package block enables programmatic access to block devices.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotBlockDevice is returned when a device name passed to New is
	// not a block device.
	ErrNotBlockDevice = errors.New("not a block device")

	// ErrNotImplemented is returned when block device functionality is not
	// implemented on the current platform.
	ErrNotImplemented = errors.New("not implemented")
)

Functions

This section is empty.

Types

type Device

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

A Device represents a block device. It can be used to query information about the device, seek the device, or read and write data.

func New

func New(device string, flags int) (*Device, error)

New attempts to open a block device with the specified flags, and verifies that device is a block device.

If device is not a block device, ErrNotBlockDevice is returned.

func (Device) Close

func (d Device) Close() error

Close closes the file descriptor for a block device.

func (Device) Identify

func (d Device) Identify() ([512]byte, error)

Identify queries a block device for its IDE identification info.

func (Device) Read

func (d Device) Read(b []byte) (int, error)

Read implements io.Reader for a block device.

func (Device) ReadAt

func (d Device) ReadAt(b []byte, off int64) (int, error)

ReadAt implements io.ReaderAt for a block device.

func (Device) Seek

func (d Device) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker for a block device.

func (Device) Size

func (d Device) Size() (uint64, error)

Size queries a block device for its total size in bytes.

func (Device) Write

func (d Device) Write(b []byte) (int, error)

Write implements io.Writer for a block device.

func (Device) WriteAt

func (d Device) WriteAt(b []byte, off int64) (int, error)

WriteAt implements io.WriterAt for a block device.

Directories

Path Synopsis
cmd
blockctl
Command blockctl retrieves information about block devices.
Command blockctl retrieves information about block devices.

Jump to

Keyboard shortcuts

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