Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/joshtriplett/nbd-netlink
- Owner: joshtriplett
- Created: 2020-08-11T03:45:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-03T04:05:08.000Z (over 2 years ago)
- Last Synced: 2024-09-13T03:30:18.049Z (4 months ago)
- Topics: nbd, netlink, network-block-device, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 8.79 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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])?;
```