Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joshtriplett/nbd-netlink

Rust crate to set up an NBD device for a specified socket and parameters, using the Linux netlink interface
https://github.com/joshtriplett/nbd-netlink

nbd netlink network-block-device rust rust-lang

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

`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

```rust
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])?;
```