lba

package
v0.1.1-0...-42241d0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is an in-memory buffer for writing to byte slices in units of LBA.

func NewBuffer

func NewBuffer(lba *LBA, b []byte) *Buffer

NewBuffer intializes and returns a `Buffer`.

func (*Buffer) Bytes

func (buf *Buffer) Bytes() []byte

Bytes returns the buffer bytes.

func (*Buffer) Read

func (buf *Buffer) Read(off, length int64) (b []byte, err error)

Read reads from a `Buffer`.

func (*Buffer) Write

func (buf *Buffer) Write(b []byte, off int64) (err error)

Write writes to a `Buffer`.

type LBA

type LBA struct {
	PhysicalBlockSize int64
	LogicalBlockSize  int64
	TotalSectors      int64
	// contains filtered or unexported fields
}

LBA represents logical block addressing.

func NewLBA

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

NewLBA initializes and returns an `LBA`.

func (*LBA) ReadAt

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

ReadAt reads from a file in units of LBA.

func (*LBA) WriteAt

func (l *LBA) WriteAt(lba, off int64, b []byte) (err 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