76 * serial execution.
77 */
78 typedef struct callb_table {
79 kmutex_t ct_lock; /* protect all callb states */
80 callb_t *ct_freelist; /* free callb structures */
81 int ct_busy; /* != 0 prevents additions */
82 kcondvar_t ct_busy_cv; /* to wait for not busy */
83 int ct_ncallb; /* num of callbs allocated */
84 callb_t *ct_first_cb[NCBCLASS]; /* ptr to 1st callb in a class */
85 } callb_table_t;
86
87 int callb_timeout_sec = CPR_KTHREAD_TIMEOUT_SEC;
88
89 static callb_id_t callb_add_common(boolean_t (*)(void *, int),
90 void *, int, char *, kthread_id_t);
91
92 static callb_table_t callb_table; /* system level callback table */
93 static callb_table_t *ct = &callb_table;
94 static kmutex_t callb_safe_mutex;
95 callb_cpr_t callb_cprinfo_safe = {
96 &callb_safe_mutex, CALLB_CPR_ALWAYS_SAFE, 0, 0, 0 };
97
98 /*
99 * Init all callb tables in the system.
100 */
101 void
102 callb_init()
103 {
104 callb_table.ct_busy = 0; /* mark table open for additions */
105 mutex_init(&callb_safe_mutex, NULL, MUTEX_DEFAULT, NULL);
106 mutex_init(&callb_table.ct_lock, NULL, MUTEX_DEFAULT, NULL);
107 }
108
109 /*
110 * callout_add() is called to register func() be called later.
111 */
112 static callb_id_t
113 callb_add_common(boolean_t (*func)(void *arg, int code),
114 void *arg, int class, char *name, kthread_id_t t)
115 {
116 callb_t *cp;
|
76 * serial execution.
77 */
78 typedef struct callb_table {
79 kmutex_t ct_lock; /* protect all callb states */
80 callb_t *ct_freelist; /* free callb structures */
81 int ct_busy; /* != 0 prevents additions */
82 kcondvar_t ct_busy_cv; /* to wait for not busy */
83 int ct_ncallb; /* num of callbs allocated */
84 callb_t *ct_first_cb[NCBCLASS]; /* ptr to 1st callb in a class */
85 } callb_table_t;
86
87 int callb_timeout_sec = CPR_KTHREAD_TIMEOUT_SEC;
88
89 static callb_id_t callb_add_common(boolean_t (*)(void *, int),
90 void *, int, char *, kthread_id_t);
91
92 static callb_table_t callb_table; /* system level callback table */
93 static callb_table_t *ct = &callb_table;
94 static kmutex_t callb_safe_mutex;
95 callb_cpr_t callb_cprinfo_safe = {
96 &callb_safe_mutex, CALLB_CPR_ALWAYS_SAFE, NULL, {0}, {0} };
97
98 /*
99 * Init all callb tables in the system.
100 */
101 void
102 callb_init()
103 {
104 callb_table.ct_busy = 0; /* mark table open for additions */
105 mutex_init(&callb_safe_mutex, NULL, MUTEX_DEFAULT, NULL);
106 mutex_init(&callb_table.ct_lock, NULL, MUTEX_DEFAULT, NULL);
107 }
108
109 /*
110 * callout_add() is called to register func() be called later.
111 */
112 static callb_id_t
113 callb_add_common(boolean_t (*func)(void *arg, int code),
114 void *arg, int class, char *name, kthread_id_t t)
115 {
116 callb_t *cp;
|