17aec1d6eScindi /*
27aec1d6eScindi  * CDDL HEADER START
37aec1d6eScindi  *
47aec1d6eScindi  * The contents of this file are subject to the terms of the
50eb822a1Scindi  * Common Development and Distribution License (the "License").
60eb822a1Scindi  * You may not use this file except in compliance with the License.
77aec1d6eScindi  *
87aec1d6eScindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6eScindi  * or http://www.opensolaris.org/os/licensing.
107aec1d6eScindi  * See the License for the specific language governing permissions
117aec1d6eScindi  * and limitations under the License.
127aec1d6eScindi  *
137aec1d6eScindi  * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6eScindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6eScindi  * If applicable, add the following below this CDDL HEADER, with the
167aec1d6eScindi  * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6eScindi  * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6eScindi  *
197aec1d6eScindi  * CDDL HEADER END
207aec1d6eScindi  */
217aec1d6eScindi /*
227aec1d6eScindi  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237aec1d6eScindi  * Use is subject to license terms.
247aec1d6eScindi  */
257aec1d6eScindi 
267aec1d6eScindi #ifndef	_TOPO_ERROR_H
277aec1d6eScindi #define	_TOPO_ERROR_H
287aec1d6eScindi 
297aec1d6eScindi #pragma ident	"%Z%%M%	%I%	%E% SMI"
307aec1d6eScindi 
317aec1d6eScindi #include <topo_tree.h>
327aec1d6eScindi #include <topo_module.h>
337aec1d6eScindi 
347aec1d6eScindi #ifdef	__cplusplus
357aec1d6eScindi extern "C" {
367aec1d6eScindi #endif
377aec1d6eScindi 
387aec1d6eScindi /*
397aec1d6eScindi  * This enum definition is used to define a set of error tags associated with
400eb822a1Scindi  * the libtopo internal error conditions.  The shell script mkerror.sh is
417aec1d6eScindi  * used to parse this file and create a corresponding topo_error.c source file.
427aec1d6eScindi  * If you do something other than add a new error tag here, you may need to
437aec1d6eScindi  * update the mkerror shell script as it is based upon simple regexps.
447aec1d6eScindi  */
457aec1d6eScindi typedef enum topo_errno {
467aec1d6eScindi     ETOPO_UNKNOWN = 1000, /* unknown libtopo error */
477aec1d6eScindi     ETOPO_NOMEM,	/* memory limit exceeded */
487aec1d6eScindi     ETOPO_MODULE,	/* module detected or caused an error */
490eb822a1Scindi     ETOPO_HDL_ABIVER,	/* handle opened with invalid ABI version */
507aec1d6eScindi     ETOPO_HDL_SNAP,	/* snapshot already taken */
517aec1d6eScindi     ETOPO_HDL_INVAL,	/* invalid argument specified */
527aec1d6eScindi     ETOPO_HDL_UUID,	/* uuid already set */
537aec1d6eScindi     ETOPO_MOD_INIT,	/* failed to initialize module */
547aec1d6eScindi     ETOPO_MOD_FINI,	/* failed to uninitialize module */
557aec1d6eScindi     ETOPO_MOD_LOADED,	/* specified module is already loaded */
567aec1d6eScindi     ETOPO_MOD_NOMOD,	/* specified module is not loaded */
570eb822a1Scindi     ETOPO_MOD_ABIVER,	/* module registered with invalid ABI version */
587aec1d6eScindi     ETOPO_MOD_INVAL,	/* module invalid argument */
597aec1d6eScindi     ETOPO_MOD_DUP,	/* module duplicate node entry */
607aec1d6eScindi     ETOPO_MOD_NOREG,	/* module failed to register */
617aec1d6eScindi     ETOPO_MOD_NOENT,	/* module path invalid */
620eb822a1Scindi     ETOPO_MOD_XRD,	/* unable to read topology map file */
630eb822a1Scindi     ETOPO_MOD_XENUM,	/* unable to enumerate from a topology map file */
647aec1d6eScindi     ETOPO_MOD_NOSUP,	/* enumerator not supported in this module */
650eb822a1Scindi     ETOPO_MOD_VER,	/* module version mismatch while loading */
667aec1d6eScindi     ETOPO_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
677aec1d6eScindi     ETOPO_RTLD_INIT,	/* shared library plug-in does not define _topo_init */
687aec1d6eScindi     ETOPO_RTLD_NOMEM,	/* memory limit exceeded when opening shared library */
697aec1d6eScindi     ETOPO_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
707aec1d6eScindi     ETOPO_BLTIN_INIT,	/* built-in plug-in does not define init function */
717aec1d6eScindi     ETOPO_NODE_INVAL,	/* node opertation invalid argument */
727aec1d6eScindi     ETOPO_NODE_LINKED,	/* node already linked */
737aec1d6eScindi     ETOPO_NODE_BOUND,	/* node already bound */
747aec1d6eScindi     ETOPO_NODE_DUP,	/* duplicate node */
757aec1d6eScindi     ETOPO_NODE_RANGE,	/* invalid instance range */
767aec1d6eScindi     ETOPO_NODE_NOENT,	/* node not found */
777aec1d6eScindi     ETOPO_NODE_FMRI,	/* no fmri specified */
787aec1d6eScindi     ETOPO_VER_OLD,	/* plugin compiled using an obsolete topo ABI */
797aec1d6eScindi     ETOPO_VER_NEW,	/* plugin is compiled using a newer topo ABI */
807aec1d6eScindi     ETOPO_ENUM_PARTIAL,	/* partial enumeration completed for client */
810eb822a1Scindi     ETOPO_ENUM_NOMAP,	/* no topology map file for enumeration */
820eb822a1Scindi     ETOPO_ENUM_FATAL,	/* fatal enumeration error */
83*9dd0f810Scindi     ETOPO_ENUM_RECURS,	/* recursive enumertation detected */
847aec1d6eScindi     ETOPO_FMRI_NVL,	/* nvlist allocation failure for FMRI */
857aec1d6eScindi     ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */
867aec1d6eScindi     ETOPO_FMRI_MALFORM,	/* malformed FMRI */
877aec1d6eScindi     ETOPO_NVL_INVAL,	/* invalid nvlist function argument */
887aec1d6eScindi     ETOPO_METHOD_INVAL,	/* invalid method registration */
897aec1d6eScindi     ETOPO_METHOD_NOTSUP, /* method not supported */
907aec1d6eScindi     ETOPO_METHOD_FAIL,	/* method failed */
917aec1d6eScindi     ETOPO_FILE_NOENT,	/* no topology file found */
927aec1d6eScindi     ETOPO_PRSR_BADGRP,	/* unrecognized grouping */
937aec1d6eScindi     ETOPO_PRSR_BADNUM,	/* unable to interpret attribute numerically */
947aec1d6eScindi     ETOPO_PRSR_BADRNG,	/* non-sensical range */
957aec1d6eScindi     ETOPO_PRSR_BADSCH,	/* unrecognized scheme */
967aec1d6eScindi     ETOPO_PRSR_BADSTAB,	/* unrecognized stability */
977aec1d6eScindi     ETOPO_PRSR_BADTYPE,	/* unrecognized property value type */
987aec1d6eScindi     ETOPO_PRSR_NOATTR,	/* tag missing attribute */
997aec1d6eScindi     ETOPO_PRSR_NOENT,	/* topology xml file not found */
1007aec1d6eScindi     ETOPO_PRSR_NOMETH,	/* range missing enum-method */
1017aec1d6eScindi     ETOPO_PRSR_NVPROP,	/* properties as nvlist missing crucial field */
1027aec1d6eScindi     ETOPO_PRSR_OOR,	/* node instance out of declared range */
1037aec1d6eScindi     ETOPO_WALK_EMPTY,	/* empty topology */
1047aec1d6eScindi     ETOPO_WALK_NOTFOUND, /* scheme based topology not found */
1057aec1d6eScindi     ETOPO_END		/* end of custom errno list (to ease auto-merge) */
1067aec1d6eScindi } topo_errno_t;
1077aec1d6eScindi 
1087aec1d6eScindi extern int topo_hdl_seterrno(topo_hdl_t *, int);
1097aec1d6eScindi extern const char *topo_hdl_errmsg(topo_hdl_t *);
1107aec1d6eScindi extern int topo_hdl_errno(topo_hdl_t *);
1117aec1d6eScindi 
1127aec1d6eScindi #ifdef	__cplusplus
1137aec1d6eScindi }
1147aec1d6eScindi #endif
1157aec1d6eScindi 
1167aec1d6eScindi #endif	/* _TOPO_ERROR_H */
117