Page MenuHomeFreeBSD

libdevctl: Add devctl_getpath
ClosedPublic

Authored by imp on Oct 30 2021, 12:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 11:42 PM
Unknown Object (File)
Nov 22 2024, 5:56 PM
Unknown Object (File)
Nov 21 2024, 6:49 AM
Unknown Object (File)
Nov 20 2024, 6:28 PM
Unknown Object (File)
Nov 20 2024, 6:26 PM
Unknown Object (File)
Nov 20 2024, 4:22 PM
Unknown Object (File)
Nov 14 2024, 10:05 PM
Unknown Object (File)
Oct 29 2024, 12:51 PM
Subscribers

Details

Summary

Helper routine to call the kernel to get a path to the named device.
Different path enumeration methods (called locators) can be used
for different path types depending on what the kernel implements.

Sponsored by: Netflix

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42447
Build 39335: arc lint + arc unit

Event Timeline

imp requested review of this revision.Oct 30 2021, 12:52 AM
imp added a parent revision: D32745: devctl: Add DEV_GET_PATH.
gbe added a subscriber: gbe.

LGTM for the man page part.

lib/libdevctl/devctl.c
171
185

I don't know that you need this check? The ioctl handler in the kernel already validates the length, and it enforces a much smaller limit (64) anyway?

190
203

Note that this isn't necessarily guaranteed to loop twice if the path "changes" size for some reason (not sure if we have any paths that will ever change size dynamically?) It might be nice to return a more specific error value for the buffer being too short. Other places in the kernel (e.g. sysctl handlers) tend to return ENOMEM for this rather than EINVAL. (The argument wasn't invalid, just too small). That would let you then just loop on the specific errno value without the BUFLEN check. It might still loop more than once, but you would know it wasn't due to some other EINVAL case at least.

imp marked 4 inline comments as done.Nov 5 2021, 11:28 PM
imp added inline comments.
lib/libdevctl/devctl.c
185

Sure.

203

We have no devices that change path today.
It also returns ENAMETOOLONG and I've fixed that.

imp marked 2 inline comments as done.

update with jhb review comments

This revision is now accepted and ready to land.Nov 9 2021, 5:30 PM
This revision was automatically updated to reflect the committed changes.