Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/_eventhandler.h
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
#define EVENTHANDLER_DECLARE(name, type) \ | #define EVENTHANDLER_DECLARE(name, type) \ | ||||
struct eventhandler_entry_ ## name \ | struct eventhandler_entry_ ## name \ | ||||
{ \ | { \ | ||||
struct eventhandler_entry ee; \ | struct eventhandler_entry ee; \ | ||||
type eh_func; \ | type eh_func; \ | ||||
}; \ | }; \ | ||||
struct __hack | struct __hack | ||||
/* | |||||
* Headers to accomodate _rmlock.h | |||||
*/ | |||||
#include <sys/param.h> | |||||
#include <sys/_cpuset.h> | |||||
#include <sys/_lock.h> | |||||
#include <sys/_mutex.h> | |||||
#include <sys/_sx.h> | |||||
#include <sys/_rmlock.h> | |||||
mjg: I don't know what to do with this mess. Moving rmslock to a separate file would only… | |||||
typedef void static_eventhandler_cb(void *); | |||||
enum static_eventhandler_prio { | |||||
STATIC_EVENTHANDLER_PRIO_INVALID, | |||||
STATIC_EVENTHANDLER_PRIO_FIRST, | |||||
STATIC_EVENTHANDLER_PRIO_ANY, | |||||
STATIC_EVENTHANDLER_PRIO_LAST | |||||
}; | |||||
struct static_eventhandler { | |||||
enum static_eventhandler_prio *prio; | |||||
struct rmslock lock; | |||||
u_int count; | |||||
u_int size; | |||||
static_eventhandler_cb **cb; | |||||
}; | |||||
#define STATIC_EVENTHANDLER_DECLARE(name) \ | |||||
extern struct static_eventhandler static_eventhandler_ ## name | |||||
#define STATIC_EVENTHANDLER_REGISTER(name, func, prio) \ | |||||
static_eventhandler_register(&static_eventhandler_ ## name, func, \ | |||||
STATIC_EVENTHANDLER_PRIO_ ## prio) | |||||
#define STATIC_EVENTHANDLER_DEREGISTER(name, func) \ | |||||
static_eventhandler_deregister(&static_eventhandler_ ## name, func) | |||||
#define STATIC_EVENTHANDLER_INVOKE(name, arg) \ | |||||
static_eventhandler_invoke(&static_eventhandler_ ## name, arg) | |||||
#define STATIC_EVENTHANDLER_DEFINE(name) \ | |||||
struct static_eventhandler static_eventhandler_ ## name; \ | |||||
SYSINIT(_seh_init_ ## name, SI_SUB_EVENTHANDLER, SI_ORDER_ANY, \ | |||||
static_eventhandler_init, &static_eventhandler_ ## name); | |||||
#endif | #endif |
I don't know what to do with this mess. Moving rmslock to a separate file would only temporarily take care of the problem. For example addition of bitmaps would pull both param.h and _cpuset.h