-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions on README #2
Comments
Because it's not very Rusty, currently to create a let params = DeviceParams {
attrs: Default::default(),
logical_bs_shift: 9,
...
} A more rust-idiomatic approach could be using a builder pattern, like the one used in
Is just a nit, I want to return a descriptive error if the user tries to set parameters to a device in a LIVE state, so I need to send a GetDevInfo() first to get the state. I don't think it's a problem since is just the control path, so one extra command will make no difference.
|
Like DeviceInfo, DeviceParams is ABI between linux kernel and libublksrv, DeviceOptions should be just one rust/ublk internal data for building DeviceInfo, DeviceParams, and other KABI data for sending control IMO, DeviceInfo, DeviceParams follows the usual kernel ABI pattern, Not sure I understand your exact question, if not, please explain in
Yes,
OK, got it. Also if set params command is sent to one device in LIVE Thanks, |
I think we are talking about two different things, sorry, I should have explained myself better. user <- (1) -> ublk-rs <- (2) -> kernel I'm ok with the ABI between ublk-rs and the kernel (2), I'm not talking about the For example, instead of creating it as: let params = DeviceParams {
attrs: Default::default(),
logical_bs_shift: 9,
...
} We can do it "the rust way", using the builder pattern: let params = DeviceParams
.sector_size(512)
... or let params = DeviceParams
.logical_bs_shift(9)
... or something similar.
This is the type of things that I want to "hide" in the API to avoid misusing, I want to make it impossible to define: let params = DeviceParams {
logical_bs_shift: 9,
dev_sectors: dev_size >> 8,
...
}
Probably EBUSY is a bit better, but I don't think it's a big deal to send an info command to check the state. I was talking about the rust Errors returned as part of Result<> |
OK, looks I misunderstood the point, and now ublk-rs API is completely
OK, looks still one ublk-rs specific issue. Thanks, |
Hello,
Care to provide more details?
Right, GetDevInfo() is available anytime. And in which cases, you need to send
multiple messages?
The original imlementation supports to set each param in single command, but
that way makes things a bit complicated, but the control interface can be extended,
and we just need to understand the use case.
Thanks,
Ming
The text was updated successfully, but these errors were encountered: