nbd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2016 License: Apache-2.0, MIT Imports: 10 Imported by: 0

README

nbd

Golang Linux Network Block Device as a local block device in user space.

Documentation

Overview

Package nbd uses the Linux NBD layer to emulate a block device in user space

Index

Constants

View Source
const (
	// Defined in <linux/fs.h>:
	BLKROSET = 4701
)

Variables

This section is empty.

Functions

func FindDevice

func FindDevice() (string, error)

Types

type Device

type Device interface {
	ReadAt(b []byte, off int64) (n int, err error)
	WriteAt(b []byte, off int64) (n int, err error)
	Sync() error
	Trim(off, len int64) error
}

Device interface is a subset of os.File.

type NBD

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

func Create

func Create(device Device, size int64, blocksize int64) *NBD

func (*NBD) Close

func (nbd *NBD) Close() error

func (*NBD) Disconnect added in v0.1.0

func (nbd *NBD) Disconnect() error

func (*NBD) IsConnected

func (nbd *NBD) IsConnected() bool

return true if connected

func (*NBD) OpenDevice added in v0.1.0

func (nbd *NBD) OpenDevice(dev string) (string, error)

func (*NBD) Serve

func (nbd *NBD) Serve() error

func (*NBD) SetBlockSize added in v0.1.0

func (nbd *NBD) SetBlockSize(blocksize int64) error

func (*NBD) SetSize added in v0.1.0

func (nbd *NBD) SetSize(size int64) error

func (*NBD) Size

func (nbd *NBD) Size() int64

Jump to

Keyboard shortcuts

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