6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / errorq_impl.h
bloba2584b958eb99d9d6240832f9adea7315971a4da
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _ERRORQ_IMPL_H
27 #define _ERRORQ_IMPL_H
29 #include <sys/errorq.h>
30 #include <sys/dditypes.h>
31 #include <sys/kstat.h>
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 typedef struct errorq_nvelem {
38 void *eqn_buf; /* data buf for this nv element */
39 nvlist_t *eqn_nvl; /* nvlist */
40 nv_alloc_t *eqn_nva; /* fixed nv allocator */
41 } errorq_nvelem_t;
43 struct errorq_elem {
44 struct errorq_elem *eqe_next; /* next on processing list */
45 struct errorq_elem *eqe_prev; /* prev on free or pend list */
46 struct errorq_elem *eqe_dump; /* next on crash dump list */
47 void *eqe_data; /* data for this element */
50 typedef struct errorq_kstat {
51 kstat_named_t eqk_dispatched; /* total errors dispatched */
52 kstat_named_t eqk_dropped; /* total errors dropped */
53 kstat_named_t eqk_logged; /* total errors logged */
54 kstat_named_t eqk_reserved; /* total errors reserved */
55 kstat_named_t eqk_reserve_fail; /* total reservation failures */
56 kstat_named_t eqk_committed; /* total errors committed */
57 kstat_named_t eqk_commit_fail; /* total commit failures */
58 kstat_named_t eqk_cancelled; /* total reserves cancelled */
59 } errorq_kstat_t;
62 * errorq implementation flags: bit range 16-31
64 #define ERRORQ_ACTIVE 0x00010000 /* queue is enabled */
65 #define ERRORQ_NVLIST 0x00020000 /* nvlist queue */
67 #define ERRORQ_NAMELEN 31 /* length of queue name */
69 struct errorq {
70 char eq_name[ERRORQ_NAMELEN + 1]; /* string name for debugging */
71 errorq_kstat_t eq_kstat; /* kstat data (see above) */
72 kstat_t *eq_ksp; /* pointer to installed kstat */
73 errorq_func_t eq_func; /* drain callback */
74 void *eq_private; /* drain callback data */
75 void *eq_data; /* buffer of queue data */
76 ulong_t eq_qlen; /* maximum queue length */
77 size_t eq_size; /* size of element data */
78 uint_t eq_ipl; /* soft interrupt priority */
79 uint_t eq_flags; /* flags (see above) */
80 ddi_softintr_t eq_id; /* soft interrupt identifier */
81 kmutex_t eq_lock; /* consumer lock */
82 errorq_elem_t *eq_elems; /* array of all elements */
83 errorq_elem_t *eq_phead; /* head of processing list */
84 errorq_elem_t *eq_ptail; /* tail of processing list */
85 errorq_elem_t *eq_pend; /* list of pending errors */
86 ulong_t *eq_bitmap; /* bitmap of free elements */
87 errorq_elem_t *eq_dump; /* list of crash dump elem's */
88 struct errorq *eq_next; /* next errorq on global list */
89 index_t eq_rotor; /* best efforts bitmap rotor */
92 #ifdef __cplusplus
94 #endif
96 #endif /* _ERRORQ_IMPL_H */