Skip to content
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

dev_id and/or device file path are not exposed after starting device #82

Open
mattysweeps opened this issue Jan 22, 2025 · 4 comments
Open

Comments

@mattysweeps
Copy link
Contributor

include/ublksrv_priv.h contains ublksrv_ctrl_dev->ublksrv_ctrl_dev_info->dev_id but the dev_id isn't accessible otherwise.

It would be nice if there was some utility functions in include/ublksrv_utils.h which returns the dev_id and/or the file path names of either the control device or the block device.

@mattysweeps
Copy link
Contributor Author

Whoops, the dev_id and all other device info fields can be obtained with the already existing function extern const struct ublksrv_ctrl_dev_info *ublksrv_ctrl_get_dev_info(const struct ublksrv_ctrl_dev *dev);

However, the UBLKC_DEV path still seems tricky to get. On most systems this would be easy to guess though, but it would be nice if ublksrv exposed the value somehow.

Maybe I missed how to obtain that too.

@ming1
Copy link
Collaborator

ming1 commented Jan 23, 2025

Whoops, the dev_id and all other device info fields can be obtained with the already existing function extern const struct ublksrv_ctrl_dev_info *ublksrv_ctrl_get_dev_info(const struct ublksrv_ctrl_dev *dev);

However, the UBLKC_DEV path still seems tricky to get. On most systems this would be easy to guess though, but it would be nice if ublksrv exposed the value somehow.

Maybe I missed how to obtain that too.

Yeah, it may be provided by one autoconf macro or passed from command line, what do you think of this way?

Thanks,

@mattysweeps
Copy link
Contributor Author

Yeah, it may be provided by one autoconf macro or passed from command line, what do you think of this way?

I think that would work. Another idea which I don't have fully thought through is it would be nice if the user could supply the block device, including the full path too. But looking at how the ublk driver creates block devices I'm not sure if that's possible or easy to do: https://github.com/torvalds/linux/blob/master/drivers/block/ublk_drv.c#L2316

@mattysweeps
Copy link
Contributor Author

I realized I could always use mkod so there's no need for ublk to take the block device file name as input.

Yeah, it may be provided by one autoconf macro or passed from command line, what do you think of this way?

I think this is best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants