Add config_intrhook_oneshot(): schedule an intrhook function and automatically unregister it after it runs.
ClosedPublic

Authored by ian on Aug 10 2017, 6:31 PM.

Details

Summary

The config_intrhook mechanism allows a driver to stall the boot process until device(s) required for booting are available, by not allowing system inits to proceed until all intrhook functions have been unregistered. Virtually all existing code simply unregisters from within the hook function when it gets called.

This new function makes that common usage more convenient. Instead of allocating and filling in a struct, passing it to a function that might (in theory) fail, and checking the return code, now a driver can simply call this cannot-fail routine, passing just the intrhook function to call and its arg.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ian created this revision.Aug 10 2017, 6:31 PM
imp added a comment.Aug 10 2017, 7:27 PM

This looks good to me.

ian added a reviewer: cem.Aug 10 2017, 7:36 PM
bcr accepted this revision.Aug 12 2017, 10:33 AM
bcr added a subscriber: bcr.

OK from manpages. Don't forget to bump the .Dd when committing.

This revision is now accepted and ready to land.Aug 12 2017, 10:33 AM
cem accepted this revision.Aug 12 2017, 9:24 PM

Implementation and doc looks good to me.

I think some of the doc people lean away from use of semicolons, and instead prefer to use relatively simple sentences, but I don't care particularly.

sys/kern/subr_autoconf.c
70–73 ↗(On Diff #31887)

The whitespace here looks really messed up in phabricator, but that may just be phabricator.

sys/sys/kernel.h
403 ↗(On Diff #31887)

the typedef could have the argument name omitted

This revision was automatically updated to reflect the committed changes.