xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/topo_error.h (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_TOPO_ERROR_H
27 #define	_TOPO_ERROR_H
28 
29 #include <topo_tree.h>
30 #include <topo_module.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This enum definition is used to define a set of error tags associated with
38  * the libtopo internal error conditions.  The shell script mkerror.sh is
39  * used to parse this file and create a corresponding topo_error.c source file.
40  * If you do something other than add a new error tag here, you may need to
41  * update the mkerror shell script as it is based upon simple regexps.
42  */
43 typedef enum topo_errno {
44     ETOPO_UNKNOWN = 1000, /* unknown libtopo error */
45     ETOPO_NOMEM,	/* memory limit exceeded */
46     ETOPO_MODULE,	/* module detected or caused an error */
47     ETOPO_MOD_INIT,	/* failed to initialize module */
48     ETOPO_MOD_FINI,	/* failed to uninitialize module */
49     ETOPO_MOD_LOADED,	/* specified module is already loaded */
50     ETOPO_MOD_NOMOD,	/* specified module is not loaded */
51     ETOPO_MOD_ABIVER,	/* module registered with invalid ABI version */
52     ETOPO_MOD_INVAL,	/* module invalid argument */
53     ETOPO_MOD_DUP,	/* module duplicate node entry */
54     ETOPO_MOD_NOREG,	/* module failed to register */
55     ETOPO_MOD_NOENT,	/* module path invalid */
56     ETOPO_MOD_XRD,	/* unable to read topology map file */
57     ETOPO_MOD_XENUM,	/* unable to enumerate from a topology map file */
58     ETOPO_MOD_NOSUP,	/* enumerator not supported in this module */
59     ETOPO_MOD_VER,	/* module version mismatch while loading */
60     ETOPO_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
61     ETOPO_RTLD_INIT,	/* shared library plug-in does not define _topo_init */
62     ETOPO_RTLD_NOMEM,	/* memory limit exceeded when opening shared library */
63     ETOPO_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
64     ETOPO_BLTIN_INIT,	/* built-in plug-in does not define init function */
65     ETOPO_VER_OLD,	/* plugin compiled using an obsolete topo ABI */
66     ETOPO_VER_NEW,	/* plugin is compiled using a newer topo ABI */
67     ETOPO_ENUM_PARTIAL,	/* partial enumeration completed for client */
68     ETOPO_ENUM_NOMAP,	/* no topology map file for enumeration */
69     ETOPO_ENUM_FATAL,	/* fatal enumeration error */
70     ETOPO_ENUM_RECURS,	/* recursive enumertation detected */
71     ETOPO_NVL_INVAL,	/* invalid nvlist function argument */
72     ETOPO_FILE_NOENT,	/* no topology file found */
73     ETOPO_PRSR_BADGRP,	/* unrecognized grouping */
74     ETOPO_PRSR_BADNUM,	/* unable to interpret attribute numerically */
75     ETOPO_PRSR_BADRNG,	/* non-sensical range */
76     ETOPO_PRSR_BADSCH,	/* unrecognized scheme */
77     ETOPO_PRSR_BADSTAB,	/* unrecognized stability */
78     ETOPO_PRSR_BADTYPE,	/* unrecognized property value type */
79     ETOPO_PRSR_NOATTR,	/* tag missing attribute */
80     ETOPO_PRSR_NOENT,	/* topology xml file not found */
81     ETOPO_PRSR_NOMETH,	/* range missing enum-method */
82     ETOPO_PRSR_NVPROP,	/* properties as nvlist missing crucial field */
83     ETOPO_PRSR_OOR,	/* node instance out of declared range */
84     ETOPO_PRSR_REGMETH,	/* failed to register property method */
85     ETOPO_WALK_EMPTY,	/* empty topology */
86     ETOPO_WALK_NOTFOUND, /* scheme based topology not found */
87     ETOPO_FAC_NOENT,	/* no facility node of specified type found */
88     ETOPO_END		/* end of custom errno list (to ease auto-merge) */
89 } topo_errno_t;
90 
91 extern int topo_hdl_seterrno(topo_hdl_t *, int);
92 extern const char *topo_hdl_errmsg(topo_hdl_t *);
93 extern int topo_hdl_errno(topo_hdl_t *);
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif	/* _TOPO_ERROR_H */
100