oll3 / nbd-async

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

Add read-only option to serve_local_nbd #6

Closed PiMaker closed 4 years ago

PiMaker commented 4 years ago

Add an option to set NBD_READ_ONLY on the device node serve_local_nbd connects to. This marks the block device as read-only, helping certain userspace tools.

This is a breaking API change. Alternatively, a second method serve_local_nbd_ro might make sense and only require to bump the minor version.

Happy to hear feedback, thanks for the previous work!

oll3 commented 4 years ago

Think it looks good. Maybe should have a flag struct for passing multiple flags to attach_device(), but since there is only one flag right now I think this is sufficient. Thanks! :+1: