xref: /titanic_52/usr/src/uts/common/sys/errorq.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/time.h>
34 #include <sys/nvpair.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct errorq errorq_t;
41 typedef struct errorq_elem errorq_elem_t;
42 typedef void (*errorq_func_t)(void *, const void *, const errorq_elem_t *);
43 
44 /*
45  * Public flags for errorq_create(): bit range 0-15
46  */
47 #define	ERRORQ_VITAL	0x0001	/* drain queue automatically on system reset */
48 
49 /*
50  * Public flags for errorq_dispatch():
51  */
52 #define	ERRORQ_ASYNC	0	/* schedule async queue drain for caller */
53 #define	ERRORQ_SYNC	1	/* do not schedule drain; caller will drain */
54 
55 #ifdef	_KERNEL
56 
57 extern errorq_t *errorq_create(const char *, errorq_func_t, void *,
58     ulong_t, size_t, uint_t, uint_t);
59 
60 extern errorq_t *errorq_nvcreate(const char *, errorq_func_t, void *,
61     ulong_t, size_t, uint_t, uint_t);
62 
63 extern void errorq_destroy(errorq_t *);
64 extern void errorq_dispatch(errorq_t *, const void *, size_t, uint_t);
65 extern void errorq_drain(errorq_t *);
66 extern void errorq_init(void);
67 extern void errorq_panic(void);
68 extern errorq_elem_t *errorq_reserve(errorq_t *);
69 extern void errorq_commit(errorq_t *, errorq_elem_t *, uint_t);
70 extern void errorq_cancel(errorq_t *, errorq_elem_t *);
71 extern nvlist_t *errorq_elem_nvl(errorq_t *, const errorq_elem_t *);
72 extern nv_alloc_t *errorq_elem_nva(errorq_t *, const errorq_elem_t *);
73 extern void *errorq_elem_dup(errorq_t *, const errorq_elem_t *,
74     errorq_elem_t **);
75 extern void errorq_dump();
76 
77 #endif	/* _KERNEL */
78 
79 #ifdef	__cplusplus
80 }
81 #endif
82 
83 #endif	/* _ERRORQ_H */
84