Page MenuHomeFreeBSD

nvmecontrol: Refactor devlist implementation
ClosedPublic

Authored by jhb on Oct 31 2024, 2:52 PM.
Tags
None
Referenced Files
F147378510: D47354.id.diff
Tue, Mar 10, 11:42 AM
F147360814: D47354.id.diff
Tue, Mar 10, 8:00 AM
F147356411: D47354.id146020.diff
Tue, Mar 10, 7:05 AM
F147325264: D47354.id.diff
Tue, Mar 10, 12:07 AM
F147273668: D47354.diff
Mon, Mar 9, 2:56 PM
Unknown Object (File)
Fri, Mar 6, 8:43 PM
Unknown Object (File)
Fri, Mar 6, 2:58 PM
Unknown Object (File)
Sat, Feb 28, 5:42 AM
Subscribers

Details

Summary

Split out helper functions for scan_namespace and scan_controller.
While here, replace sprintf() calls with snprintf() and avoid
leaking the contoller fd if read_controller_data() fails.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Oct 31 2024, 2:52 PM

This makes things a lot better. But I can't help but think scanning sequential unit numbers couldn't be better maybe.

sbin/nvmecontrol/devlist.c
95

Is there a better #define that we can use? 64 is fine, but I can't say why

This revision is now accepted and ready to land.Oct 31 2024, 10:14 PM
sbin/nvmecontrol/devlist.c
95

That is in the old code and I just kept it. 64 is arbitrary, but as long as it's only in one place and everything else uses sizeof(name) I'm fine with that. If we had a constant for the largest possible filename in a component, maybe that could be used instead? (So not PATH_MAX, but NAME_MAX I guess?)

sbin/nvmecontrol/devlist.c
95

Gotcha!

This revision was automatically updated to reflect the committed changes.