Page MenuHomeFreeBSD

libdevctl: Add devctl_getpath
ClosedPublic

Authored by imp on Oct 30 2021, 12:52 AM.
Tags
None
Referenced Files
F103079494: D32746.diff
Wed, Nov 20, 4:22 PM
Unknown Object (File)
Thu, Nov 14, 10:05 PM
Unknown Object (File)
Tue, Oct 29, 12:51 PM
Unknown Object (File)
Tue, Oct 22, 7:10 PM
Unknown Object (File)
Oct 1 2024, 9:42 PM
Unknown Object (File)
Sep 30 2024, 7:12 PM
Unknown Object (File)
Sep 22 2024, 7:42 PM
Unknown Object (File)
Sep 22 2024, 12:41 AM
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 42546
Build 39434: 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.