summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2017-08-13 18:10:24 +0000
committerLuiz Souza <luiz@netgate.com>2017-10-17 19:59:17 -0500
commit1d1327eef601aba35e784b04d6e1fc93c0b507ac (patch)
tree093d2c46df5083c69561c3bb9c3bb60b6bccbda3 /sys/sys
parent8ea1c9c79e8c38a4ae8fec5a38b1d3bad0207f80 (diff)
downloadFreeBSD-src-1d1327eef601aba35e784b04d6e1fc93c0b507ac.zip
FreeBSD-src-1d1327eef601aba35e784b04d6e1fc93c0b507ac.tar.gz
Add config_intrhook_oneshot(): schedule an intrhook function and unregister
it automatically after it runs. 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 and its arg. Differential Revision: https://reviews.freebsd.org/D11963 (cherry picked from commit 3dabf0d77785be405b3aa27de0590c5addd533dc)
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/kernel.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index 7124349..c9478fd 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -400,13 +400,16 @@ struct tunable_str {
#define TUNABLE_STR_FETCH(path, var, size) \
getenv_string((path), (var), (size))
+typedef void (*ich_func_t)(void *_arg);
+
struct intr_config_hook {
TAILQ_ENTRY(intr_config_hook) ich_links;
- void (*ich_func)(void *arg);
- void *ich_arg;
+ ich_func_t ich_func;
+ void *ich_arg;
};
int config_intrhook_establish(struct intr_config_hook *hook);
void config_intrhook_disestablish(struct intr_config_hook *hook);
+void config_intrhook_oneshot(ich_func_t _func, void *_arg);
#endif /* !_SYS_KERNEL_H_*/
OpenPOWER on IntegriCloud