nbd

package
v7.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package nbd attaches NBD exports to kernel block devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(conn *net.UnixConn, export *Export, backend string, index int) (int, error)

Connect attaches a negotiated connection to a kernel device and returns the device index. A negative index asks the kernel for an unused device, creating one if needed.

func Disconnect

func Disconnect(index int) error

Disconnect detaches the server from a device.

Types

type Export

type Export struct {
	Size      uint64
	Flags     uint16
	BlockSize uint64
}

Export describes a negotiated NBD export.

func Negotiate

func Negotiate(conn net.Conn) (*Export, error)

Negotiate performs the fixed newstyle handshake for the default export of the server behind conn. On success the connection is in the transmission phase and can be handed to the kernel.

Jump to

Keyboard shortcuts

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