buse

package
v0.0.0-...-68da7f5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NBD_SET_SOCK        = (0xab<<8 | 0)
	NBD_SET_BLKSIZE     = (0xab<<8 | 1)
	NBD_SET_SIZE        = (0xab<<8 | 2)
	NBD_DO_IT           = (0xab<<8 | 3)
	NBD_CLEAR_SOCK      = (0xab<<8 | 4)
	NBD_CLEAR_QUE       = (0xab<<8 | 5)
	NBD_PRINT_DEBUG     = (0xab<<8 | 6)
	NBD_SET_SIZE_BLOCKS = (0xab<<8 | 7)
	NBD_DISCONNECT      = (0xab<<8 | 8)
	NBD_SET_TIMEOUT     = (0xab<<8 | 9)
	NBD_SET_FLAGS       = (0xab<<8 | 10)
)
View Source
const (
	NBD_CMD_READ  = 0
	NBD_CMD_WRITE = 1
	NBD_CMD_DISC  = 2
	NBD_CMD_FLUSH = 3
	NBD_CMD_TRIM  = 4
)
View Source
const (
	NBD_FLAG_HAS_FLAGS  = (1 << 0)
	NBD_FLAG_READ_ONLY  = (1 << 1)
	NBD_FLAG_SEND_FLUSH = (1 << 2)
	NBD_FLAG_SEND_TRIM  = (1 << 5)
)
View Source
const (
	NBD_REQUEST_MAGIC = 0x25609513
	NBD_REPLY_MAGIC   = 0x67446698
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuseDevice

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

func CreateDevice

func CreateDevice(device string, size uint, buseDriver BuseInterface) (*BuseDevice, error)

func (*BuseDevice) Connect

func (bd *BuseDevice) Connect() error

Connect connects a BuseDevice to an actual device file and starts handling requests. It does not return until it's done serving requests.

func (*BuseDevice) Disconnect

func (bd *BuseDevice) Disconnect()

Disconnect disconnects the BuseDevice

type BuseInterface

type BuseInterface interface {
	ReadAt(p []byte, off uint) error
	WriteAt(p []byte, off uint) error
	Disconnect()
	Flush() error
	Trim(off uint, length uint) error
}

Jump to

Keyboard shortcuts

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