Loading...
Searching...
No Matches
nbd.h File Reference

Network block device layer. More...

Typedefs

typedef void(* spdk_nbd_fini_cb) (void *arg)
 
typedef void(* spdk_nbd_start_cb) (void *cb_arg, struct spdk_nbd_disk *nbd, int rc)
 Called when an NBD device has been started.
 

Functions

int spdk_nbd_init (void)
 Initialize the network block device layer.
 
void spdk_nbd_fini (spdk_nbd_fini_cb cb_fn, void *cb_arg)
 Stop and close all the running network block devices.
 
void spdk_nbd_start (const char *bdev_name, const char *nbd_path, spdk_nbd_start_cb cb_fn, void *cb_arg)
 Start a network block device backed by the bdev.
 
int spdk_nbd_stop (struct spdk_nbd_disk *nbd)
 Stop the running network block device safely.
 
const char * spdk_nbd_get_path (struct spdk_nbd_disk *nbd)
 Get the local filesystem path used for the network block device.
 
void spdk_nbd_write_config_json (struct spdk_json_write_ctx *w)
 Write NBD subsystem configuration into provided JSON context.
 

Detailed Description

Network block device layer.

Typedef Documentation

◆ spdk_nbd_start_cb

typedef void(* spdk_nbd_start_cb) (void *cb_arg, struct spdk_nbd_disk *nbd, int rc)

Called when an NBD device has been started.

On success, rc is assigned 0; On failure, rc is assigned negated errno.

Function Documentation

◆ spdk_nbd_fini()

void spdk_nbd_fini ( spdk_nbd_fini_cb cb_fn,
void * cb_arg )

Stop and close all the running network block devices.

Parameters
cb_fnCallback to be always called.
cb_argPassed to cb_fn.

◆ spdk_nbd_init()

int spdk_nbd_init ( void )

Initialize the network block device layer.

Returns
0 on success.

◆ spdk_nbd_start()

void spdk_nbd_start ( const char * bdev_name,
const char * nbd_path,
spdk_nbd_start_cb cb_fn,
void * cb_arg )

Start a network block device backed by the bdev.

Parameters
bdev_nameName of bdev exposed as a network block device.
nbd_pathPath to the registered network block device.
cb_fnCallback to be always called.
cb_argPassed to cb_fn.

◆ spdk_nbd_stop()

int spdk_nbd_stop ( struct spdk_nbd_disk * nbd)

Stop the running network block device safely.

Parameters
nbdA pointer to the network block device to stop.
Returns
0 on success.

◆ spdk_nbd_write_config_json()

void spdk_nbd_write_config_json ( struct spdk_json_write_ctx * w)

Write NBD subsystem configuration into provided JSON context.

Parameters
wJSON write context