Lines Matching defs:eq
38 fmd_eventq_t *eq = fmd_zalloc(sizeof (fmd_eventq_t), FMD_SLEEP);
40 (void) pthread_mutex_init(&eq->eq_lock, NULL);
41 (void) pthread_cond_init(&eq->eq_cv, NULL);
43 eq->eq_mod = mp;
44 eq->eq_stats = stats;
45 eq->eq_stats_lock = stats_lock;
46 eq->eq_limit = limit;
47 eq->eq_sgid = fmd_dispq_getgid(fmd.d_disp, eq);
49 return (eq);
53 fmd_eventq_destroy(fmd_eventq_t *eq)
57 while ((eqe = fmd_list_next(&eq->eq_list)) != NULL) {
58 fmd_list_delete(&eq->eq_list, eqe);
63 fmd_dispq_delgid(fmd.d_disp, eq->eq_sgid);
64 fmd_free(eq, sizeof (fmd_eventq_t));
68 fmd_eventq_drop(fmd_eventq_t *eq, fmd_eventqelem_t *eqe)
70 (void) pthread_mutex_lock(eq->eq_stats_lock);
71 eq->eq_stats->eqs_dropped.fmds_value.ui64++;
72 (void) pthread_mutex_unlock(eq->eq_stats_lock);
79 fmd_eventq_drop_topo(fmd_eventq_t *eq)
90 (void) pthread_mutex_lock(&eq->eq_lock);
91 eqe = fmd_list_prev(&eq->eq_list);
97 fmd_list_delete(&eq->eq_list, tmp);
98 eq->eq_size--;
99 fmd_eventq_drop(eq, tmp);
110 (void) pthread_mutex_unlock(&eq->eq_lock);
118 fmd_eventqstat_dispatch(fmd_eventq_t *eq)
120 fmd_eventqstat_t *eqs = eq->eq_stats;
124 (void) pthread_mutex_lock(eq->eq_stats_lock);
137 (void) pthread_mutex_unlock(eq->eq_stats_lock);
141 fmd_eventq_insert_at_head(fmd_eventq_t *eq, fmd_event_t *ep)
151 if (eq->eq_limit == 0) {
161 (void) pthread_mutex_lock(&eq->eq_lock);
163 if ((ok = eq->eq_size < eq->eq_limit || evt != FMD_EVT_PROTOCOL) != 0) {
165 fmd_eventqstat_dispatch(eq);
167 fmd_list_prepend(&eq->eq_list, eqe);
168 eq->eq_size++;
171 (void) pthread_cond_broadcast(&eq->eq_cv);
172 (void) pthread_mutex_unlock(&eq->eq_lock);
175 fmd_eventq_drop(eq, eqe);
179 fmd_eventq_insert_at_time(fmd_eventq_t *eq, fmd_event_t *ep)
190 if (eq->eq_limit == 0) {
200 (void) pthread_mutex_lock(&eq->eq_lock);
212 for (oqe = fmd_list_prev(&eq->eq_list); oqe; oqe = fmd_list_prev(oqe)) {
217 if ((ok = eq->eq_size < eq->eq_limit || evt != FMD_EVT_PROTOCOL) != 0) {
219 fmd_eventqstat_dispatch(eq);
222 fmd_list_prepend(&eq->eq_list, eqe);
224 fmd_list_insert_after(&eq->eq_list, oqe, eqe);
225 eq->eq_size++;
228 (void) pthread_cond_broadcast(&eq->eq_cv);
229 (void) pthread_mutex_unlock(&eq->eq_lock);
232 fmd_eventq_drop(eq, eqe);
236 fmd_eventq_delete(fmd_eventq_t *eq)
238 fmd_eventqstat_t *eqs = eq->eq_stats;
245 (void) pthread_mutex_lock(&eq->eq_lock);
247 while (!(eq->eq_flags & FMD_EVENTQ_ABORT) &&
248 (eq->eq_size == 0 || (eq->eq_flags & FMD_EVENTQ_SUSPEND)))
249 (void) pthread_cond_wait(&eq->eq_cv, &eq->eq_lock);
251 if (eq->eq_flags & FMD_EVENTQ_ABORT) {
252 (void) pthread_mutex_unlock(&eq->eq_lock);
256 eqe = fmd_list_next(&eq->eq_list);
257 fmd_list_delete(&eq->eq_list, eqe);
258 eq->eq_size--;
260 (void) pthread_mutex_unlock(&eq->eq_lock);
281 (void) pthread_mutex_lock(eq->eq_stats_lock);
299 (void) pthread_mutex_unlock(eq->eq_stats_lock);
310 fmd_eventq_done(fmd_eventq_t *eq)
312 fmd_eventqstat_t *eqs = eq->eq_stats;
315 (void) pthread_mutex_lock(eq->eq_stats_lock);
323 (void) pthread_mutex_unlock(eq->eq_stats_lock);
327 fmd_eventq_cancel(fmd_eventq_t *eq, uint_t type, void *data)
331 (void) pthread_mutex_lock(&eq->eq_lock);
333 for (eqe = fmd_list_next(&eq->eq_list); eqe != NULL; eqe = nqe) {
337 fmd_list_delete(&eq->eq_list, eqe);
338 eq->eq_size--;
344 (void) pthread_mutex_unlock(&eq->eq_lock);
348 fmd_eventq_suspend(fmd_eventq_t *eq)
350 (void) pthread_mutex_lock(&eq->eq_lock);
351 eq->eq_flags |= FMD_EVENTQ_SUSPEND;
352 (void) pthread_mutex_unlock(&eq->eq_lock);
356 fmd_eventq_resume(fmd_eventq_t *eq)
358 (void) pthread_mutex_lock(&eq->eq_lock);
359 eq->eq_flags &= ~FMD_EVENTQ_SUSPEND;
360 (void) pthread_cond_broadcast(&eq->eq_cv);
361 (void) pthread_mutex_unlock(&eq->eq_lock);
365 fmd_eventq_abort(fmd_eventq_t *eq)
369 (void) pthread_mutex_lock(&eq->eq_lock);
371 while ((eqe = fmd_list_next(&eq->eq_list)) != NULL) {
372 fmd_list_delete(&eq->eq_list, eqe);
377 eq->eq_flags |= FMD_EVENTQ_ABORT;
378 (void) pthread_cond_broadcast(&eq->eq_cv);
379 (void) pthread_mutex_unlock(&eq->eq_lock);