Documentation
¶
Index ¶
- Constants
- Variables
- type BlockDevice
- type BlockDeviceFlusher
- type BlockDeviceOptions
- type BlockDeviceTrimer
- type NbdServer
- func NewServer(dev string, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
- func NewServerFromFd(devFd int, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
- func NewServerWithNetlink(index int, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
- type NetlinkConn
- func (c *NetlinkConn) Connect() error
- func (c *NetlinkConn) Disconnect() error
- func (c *NetlinkConn) SetBlockSize(size uint64)
- func (c *NetlinkConn) SetFd(fd int)
- func (c *NetlinkConn) SetReadonly(ro bool)
- func (c *NetlinkConn) SetSize(size uint64)
- func (c *NetlinkConn) SetSupportsFlush(flush bool)
- func (c *NetlinkConn) SetSupportsTrim(trim bool)
- type Reply
- type ReplyPool
- type Request
- type RequestPool
Constants ¶
View Source
const ( DefaultBlockSize = 512 DefaultConcurrentOps = 1 // Maximum number of concurrent operations // (block device queue depth: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/block/nbd.c?h=v5.15#n1692) MaxConcurrentOps = 128 )
Variables ¶
View Source
var (
ErrUnsupported = errors.New("nbd: unsupported operation")
)
Functions ¶
This section is empty.
Types ¶
type BlockDeviceFlusher ¶
type BlockDeviceFlusher interface {
Flush() error
}
type BlockDeviceOptions ¶
type BlockDeviceOptions struct {
// BlockSize is the size of each block on the block device, in bytes.
// Must be between 512 and the system page size (usually 4096 on x86).
// If 0, the default value of DefaultBlockSize will be used.
BlockSize int
// ConcurrentOps is the number of operations (read, write, trim, flush)
// which can be performed concurrently. Must be between 1 and 128.
// If 0, the default value of DefaultConcurrentOps will be used.
ConcurrentOps int
// Readonly should be set to true if the block device is read-only.
Readonly bool
}
type BlockDeviceTrimer ¶
type NbdServer ¶
type NbdServer struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(dev string, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
func NewServerFromFd ¶
func NewServerFromFd(devFd int, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
func NewServerWithNetlink ¶
func NewServerWithNetlink(index int, block BlockDevice, size int64, opts BlockDeviceOptions) (*NbdServer, error)
func (*NbdServer) Disconnect ¶
type NetlinkConn ¶
type NetlinkConn struct {
// contains filtered or unexported fields
}
func NewNetlinkConn ¶
func NewNetlinkConn(index int) (*NetlinkConn, error)
func (*NetlinkConn) Connect ¶
func (c *NetlinkConn) Connect() error
func (*NetlinkConn) Disconnect ¶
func (c *NetlinkConn) Disconnect() error
func (*NetlinkConn) SetBlockSize ¶
func (c *NetlinkConn) SetBlockSize(size uint64)
func (*NetlinkConn) SetFd ¶
func (c *NetlinkConn) SetFd(fd int)
func (*NetlinkConn) SetReadonly ¶
func (c *NetlinkConn) SetReadonly(ro bool)
func (*NetlinkConn) SetSize ¶
func (c *NetlinkConn) SetSize(size uint64)
func (*NetlinkConn) SetSupportsFlush ¶
func (c *NetlinkConn) SetSupportsFlush(flush bool)
func (*NetlinkConn) SetSupportsTrim ¶
func (c *NetlinkConn) SetSupportsTrim(trim bool)
type Reply ¶
type Reply struct {
// contains filtered or unexported fields
}
func (*Reply) BufferSize ¶
type RequestPool ¶
type RequestPool struct {
// contains filtered or unexported fields
}
func (*RequestPool) Put ¶
func (p *RequestPool) Put(r *Request)
Click to show internal directories.
Click to hide internal directories.