lba

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package lba provides a library for working with Logical Block Addresses.

Index

Constants

View Source
const (
	BLKIOMIN = 0x1278
	BLKIOOPT = 0x1279
)

These newer ioctl magic values are not available from unix yet.

View Source
const RecommendedAlignment = 1048576

RecommendedAlignment is recommended alignment for LBA.

Variables

This section is empty.

Functions

This section is empty.

Types

type LBA added in v0.1.1

type LBA struct {
	PhysicalBlockSize int64
	LogicalBlockSize  int64
	MinimalIOSize     int64
	OptimalIOSize     int64

	TotalSectors int64
	// contains filtered or unexported fields
}

LBA represents logical block addressing.

func NewLBA added in v0.1.1

func NewLBA(f *os.File) (*LBA, error)

NewLBA initializes and returns an `LBA`.

func (*LBA) AlignToPhysicalBlockSize added in v0.2.1

func (l *LBA) AlignToPhysicalBlockSize(lba uint64, roundUp bool) uint64

AlignToPhysicalBlockSize aligns LBA value in LogicalBlockSize multiples to be aligned to PhysicalBlockSize.

func (*LBA) ReadAt added in v0.1.1

func (l *LBA) ReadAt(lba, off, length int64) ([]byte, error)

ReadAt reads from a file in units of LBA.

func (*LBA) WriteAt added in v0.1.1

func (l *LBA) WriteAt(lba, off int64, b []byte) error

WriteAt writes to a file in units of LBA.

Jump to

Keyboard shortcuts

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