summaryrefslogtreecommitdiffstats
path: root/sys/sys/eventhandler.h
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2010-03-19 19:51:03 +0000
committerbz <bz@FreeBSD.org>2010-03-19 19:51:03 +0000
commit102a1f8933fc21bc4d59fefc7cf937a79852efd3 (patch)
treef7449f42c29dbbbb2dfc5e32c28e23f633214e78 /sys/sys/eventhandler.h
parent1d097a47c39ac0c2575579a65e78796174fba8d3 (diff)
downloadFreeBSD-src-102a1f8933fc21bc4d59fefc7cf937a79852efd3.zip
FreeBSD-src-102a1f8933fc21bc4d59fefc7cf937a79852efd3.tar.gz
Split eventhandler_register() into an internal part and a wrapper function
that provides the allocated and setup eventhandler entry. Add a new wrapper for VIMAGE that allocates extra space to hold the callback function and argument in addition to an extra wrapper function. While the wrapper function goes as normal callback function the argument points to the extra space allocated holding the original func and arg that the wrapper function can then call. Provide an iterator function for the virtual network stack (vnet) that will call the callback function for each network stack. Provide a new set of macros for VNET that in the non-VIMAGE case will just call eventhandler_register() while in the VIMAGE case it will use vimage_eventhandler_register() passing in the extra iterator function but will only register once rather than per-vnet. We need a special macro in case we are interested in the tag returned as we must check for curvnet and can neither simply assign the return value, nor not change it in the non-vnet0 case without that. Sponsored by: ISPsystem Discussed with: jhb Reviewed by: zec (earlier version), jhb MFC after: 1 month
Diffstat (limited to 'sys/sys/eventhandler.h')
-rw-r--r--sys/sys/eventhandler.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index 6715efc..47a0efc 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -41,6 +41,14 @@ struct eventhandler_entry {
void *ee_arg;
};
+#ifdef VIMAGE
+struct eventhandler_entry_vimage {
+ void (* func)(void); /* Original function registered. */
+ void *ee_arg; /* Original argument registered. */
+ void *sparep[2];
+};
+#endif
+
struct eventhandler_list {
char *el_name;
int el_flags;
@@ -142,6 +150,14 @@ void eventhandler_deregister(struct eventhandler_list *list,
struct eventhandler_list *eventhandler_find_list(const char *name);
void eventhandler_prune_list(struct eventhandler_list *list);
+#ifdef VIMAGE
+typedef void (*vimage_iterator_func_t)(void *, ...);
+
+eventhandler_tag vimage_eventhandler_register(struct eventhandler_list *list,
+ const char *name, void *func, void *arg, int priority,
+ vimage_iterator_func_t);
+#endif
+
/*
* Standard system event queues.
*/
OpenPOWER on IntegriCloud