1 #ifndef _FBSD_COMPAT_SYS_CALLOUT_H_ 2 #define _FBSD_COMPAT_SYS_CALLOUT_H_ 3 4 #include <net_stack.h> 5 6 #include <sys/mutex.h> 7 #include <sys/queue.h> 8 9 10 struct callout { 11 struct net_timer c_timer; 12 void * c_arg; 13 void (*c_func)(void *); 14 struct mtx * c_mtx; 15 int c_flags; 16 }; 17 18 19 void callout_init_mtx(struct callout *, struct mtx *, int); 20 int callout_reset(struct callout *, int, void (*)(void *), void *); 21 22 #define callout_drain(c) _callout_stop_safe(c, 1) 23 #define callout_stop(c) _callout_stop_safe(c, 0) 24 int _callout_stop_safe(struct callout *, int); 25 26 27 static inline void 28 callout_init(struct callout *c, int mpsafe) 29 { 30 if (mpsafe) 31 callout_init_mtx(c, NULL, 0); 32 else 33 callout_init_mtx(c, &Giant, 0); 34 } 35 36 #endif 37