Skip to content

Rust crate to set up an NBD device for a specified socket and parameters, using the Linux netlink interface

Notifications You must be signed in to change notification settings

joshtriplett/nbd-netlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nbd-netlink supports setting up an NBD device for a specified socket and parameters, using the Linux kernel's netlink interface to NBD. Unlike the ioctl-based interface, the netlink interface can hand off a socket to the kernel without leaving a thread or process running.

Example

use std::net::{Ipv4Addr, TcpStream};
use nbd_netlink::{NBD, NBDConnect};
let nbd_socket = TcpStream::connect((Ipv4Addr::LOCALHOST, 10809))?;
nbd_socket.set_nodelay(true);
let mut nbd = NBD::new()?;
let index = NBDConnect::new()
    .size_bytes(1048576)
    .read_only(true)
    .connect(&mut nbd, &[nbd_socket])?;

About

Rust crate to set up an NBD device for a specified socket and parameters, using the Linux netlink interface

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Languages