oll3 / nbd-async

Block device driver in userspace!
https://crates.io/crates/nbd-async
MIT License
8 stars 7 forks source link

Separate providing NBD from attaching NBD? #1

Closed joshtriplett closed 4 years ago

joshtriplett commented 4 years ago

Thank you for building this, it looks great!

One request: would you consider separating the interface for responding to NBD requests given a BlockDevice implementation from the interface for attaching an NBD socket to the local system? That would make it easy to hook the former up to a server socket, and to use the latter to attach a remote socket to a local NBD device.

oll3 commented 4 years ago

Sure, sounds like a good idea. Would something like #5 sufficient?

joshtriplett commented 4 years ago

That looks promising!

I would reverse the names of the two main functions, though; the function called serve_nbd is what I'd call attach_device and vice versa. The function that serves NBD protocol over a socket should be called serve_nbd, and the function that attaches a socket to a kernel NBD device should be called attach_device.

Otherwise, this looks good from inspection.

joshtriplett commented 4 years ago

5 fixed this; closing. Thank you!

joshtriplett commented 4 years ago

Would you consider a new 0.2 release with the current changes included?