xref: /illumos-gate/usr/src/uts/common/sys/errorq.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ERRORQ_H
28 #define	_ERRORQ_H
29 
30 #include <sys/types.h>
31 #include <sys/time.h>
32 #include <sys/nvpair.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 typedef struct errorq errorq_t;
39 typedef struct errorq_elem errorq_elem_t;
40 typedef void (*errorq_func_t)(void *, const void *, const errorq_elem_t *);
41 
42 /*
43  * Public flags for errorq_create(): bit range 0-15
44  */
45 #define	ERRORQ_VITAL	0x0001	/* drain queue automatically on system reset */
46 
47 /*
48  * Public flags for errorq_dispatch():
49  */
50 #define	ERRORQ_ASYNC	0	/* schedule async queue drain for caller */
51 #define	ERRORQ_SYNC	1	/* do not schedule drain; caller will drain */
52 
53 #ifdef	_KERNEL
54 
55 extern errorq_t *errorq_create(const char *, errorq_func_t, void *,
56     ulong_t, size_t, uint_t, uint_t);
57 
58 extern errorq_t *errorq_nvcreate(const char *, errorq_func_t, void *,
59     ulong_t, size_t, uint_t, uint_t);
60 
61 extern void errorq_destroy(errorq_t *);
62 extern void errorq_dispatch(errorq_t *, const void *, size_t, uint_t);
63 extern void errorq_drain(errorq_t *);
64 extern void errorq_init(void);
65 extern void errorq_panic(void);
66 extern errorq_elem_t *errorq_reserve(errorq_t *);
67 extern void errorq_commit(errorq_t *, errorq_elem_t *, uint_t);
68 extern void errorq_cancel(errorq_t *, errorq_elem_t *);
69 extern nvlist_t *errorq_elem_nvl(errorq_t *, const errorq_elem_t *);
70 extern nv_alloc_t *errorq_elem_nva(errorq_t *, const errorq_elem_t *);
71 extern void *errorq_elem_dup(errorq_t *, const errorq_elem_t *,
72     errorq_elem_t **);
73 extern void errorq_dump();
74 
75 #endif	/* _KERNEL */
76 
77 #ifdef	__cplusplus
78 }
79 #endif
80 
81 #endif	/* _ERRORQ_H */
82