xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/topo_error.h (revision 004388ebfdfe2ed7dfd2d153a876dfcc22d2c006)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_TOPO_ERROR_H
28 #define	_TOPO_ERROR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <topo_tree.h>
33 #include <topo_module.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * This enum definition is used to define a set of error tags associated with
41  * the fmd daemon's various error conditions.  The shell script mkerror.sh is
42  * used to parse this file and create a corresponding topo_error.c source file.
43  * If you do something other than add a new error tag here, you may need to
44  * update the mkerror shell script as it is based upon simple regexps.
45  */
46 typedef enum topo_errno {
47     ETOPO_UNKNOWN = 1000, /* unknown libtopo error */
48     ETOPO_NOMEM,	/* memory limit exceeded */
49     ETOPO_MODULE,	/* module detected or caused an error */
50     ETOPO_HDL_VER,	/* handle opened with invalid ABI version */
51     ETOPO_HDL_SNAP,	/* snapshot already taken */
52     ETOPO_HDL_INVAL,	/* invalid argument specified */
53     ETOPO_HDL_UUID,	/* uuid already set */
54     ETOPO_MOD_INIT,	/* failed to initialize module */
55     ETOPO_MOD_FINI,	/* failed to uninitialize module */
56     ETOPO_MOD_LOADED,	/* specified module is already loaded */
57     ETOPO_MOD_NOMOD,	/* specified module is not loaded */
58     ETOPO_MOD_NONVL,	/* specified module is not loaded */
59     ETOPO_MOD_INVAL,	/* module invalid argument */
60     ETOPO_MOD_DUP,	/* module duplicate node entry */
61     ETOPO_MOD_NOREG,	/* module failed to register */
62     ETOPO_MOD_NOENT,	/* module path invalid */
63     ETOPO_MOD_NOSUP,	/* enumerator not supported in this module */
64     ETOPO_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
65     ETOPO_RTLD_INIT,	/* shared library plug-in does not define _topo_init */
66     ETOPO_RTLD_NOMEM,	/* memory limit exceeded when opening shared library */
67     ETOPO_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
68     ETOPO_BLTIN_INIT,	/* built-in plug-in does not define init function */
69     ETOPO_NODE_INVAL,	/* node opertation invalid argument */
70     ETOPO_NODE_LINKED,	/* node already linked */
71     ETOPO_NODE_BOUND,	/* node already bound */
72     ETOPO_NODE_DUP,	/* duplicate node */
73     ETOPO_NODE_RANGE,	/* invalid instance range */
74     ETOPO_NODE_NOENT,	/* node not found */
75     ETOPO_NODE_FMRI,	/* no fmri specified */
76     ETOPO_VER_OLD,	/* plugin compiled using an obsolete topo ABI */
77     ETOPO_VER_NEW,	/* plugin is compiled using a newer topo ABI */
78     ETOPO_ENUM_PARTIAL,	/* partial enumeration completed for client */
79     ETOPO_PROP_NOENT,	/* undefined property or property group */
80     ETOPO_PROP_DEFD,	/* static property already defined */
81     ETOPO_PROP_NOMEM,	/* memory limit exceeded during property allocation */
82     ETOPO_PROP_TYPE,	/* invalid property type */
83     ETOPO_PROP_NOINHERIT, /* can not inherit property */
84     ETOPO_FMRI_NVL,	/* nvlist allocation failure for FMRI */
85     ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */
86     ETOPO_FMRI_MALFORM,	/* malformed FMRI */
87     ETOPO_NVL_INVAL,	/* invalid nvlist function argument */
88     ETOPO_METHOD_INVAL,	/* invalid method registration */
89     ETOPO_METHOD_NOTSUP, /* method not supported */
90     ETOPO_METHOD_FAIL,	/* method failed */
91     ETOPO_FILE_NOENT,	/* no topology file found */
92     ETOPO_PRSR_BADGRP,	/* unrecognized grouping */
93     ETOPO_PRSR_BADNUM,	/* unable to interpret attribute numerically */
94     ETOPO_PRSR_BADRNG,	/* non-sensical range */
95     ETOPO_PRSR_BADSCH,	/* unrecognized scheme */
96     ETOPO_PRSR_BADSTAB,	/* unrecognized stability */
97     ETOPO_PRSR_BADTYPE,	/* unrecognized property value type */
98     ETOPO_PRSR_NOATTR,	/* tag missing attribute */
99     ETOPO_PRSR_NOENT,	/* topology xml file not found */
100     ETOPO_PRSR_NOMETH,	/* range missing enum-method */
101     ETOPO_PRSR_NVPROP,	/* properties as nvlist missing crucial field */
102     ETOPO_PRSR_OOR,	/* node instance out of declared range */
103     ETOPO_WALK_EMPTY,	/* empty topology */
104     ETOPO_WALK_NOTFOUND, /* scheme based topology not found */
105     ETOPO_END		/* end of custom errno list (to ease auto-merge) */
106 } topo_errno_t;
107 
108 extern int topo_hdl_seterrno(topo_hdl_t *, int);
109 extern const char *topo_hdl_errmsg(topo_hdl_t *);
110 extern int topo_hdl_errno(topo_hdl_t *);
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif	/* _TOPO_ERROR_H */
117