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 /*
22*825ba0f2Srobj  * Copyright 2008 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 #include <topo_tree.h>
307aec1d6eScindi #include <topo_module.h>
317aec1d6eScindi 
327aec1d6eScindi #ifdef	__cplusplus
337aec1d6eScindi extern "C" {
347aec1d6eScindi #endif
357aec1d6eScindi 
367aec1d6eScindi /*
377aec1d6eScindi  * This enum definition is used to define a set of error tags associated with
380eb822a1Scindi  * the libtopo internal error conditions.  The shell script mkerror.sh is
397aec1d6eScindi  * used to parse this file and create a corresponding topo_error.c source file.
407aec1d6eScindi  * If you do something other than add a new error tag here, you may need to
417aec1d6eScindi  * update the mkerror shell script as it is based upon simple regexps.
427aec1d6eScindi  */
437aec1d6eScindi typedef enum topo_errno {
447aec1d6eScindi     ETOPO_UNKNOWN = 1000, /* unknown libtopo error */
457aec1d6eScindi     ETOPO_NOMEM,	/* memory limit exceeded */
467aec1d6eScindi     ETOPO_MODULE,	/* module detected or caused an error */
477aec1d6eScindi     ETOPO_MOD_INIT,	/* failed to initialize module */
487aec1d6eScindi     ETOPO_MOD_FINI,	/* failed to uninitialize module */
497aec1d6eScindi     ETOPO_MOD_LOADED,	/* specified module is already loaded */
507aec1d6eScindi     ETOPO_MOD_NOMOD,	/* specified module is not loaded */
510eb822a1Scindi     ETOPO_MOD_ABIVER,	/* module registered with invalid ABI version */
527aec1d6eScindi     ETOPO_MOD_INVAL,	/* module invalid argument */
537aec1d6eScindi     ETOPO_MOD_DUP,	/* module duplicate node entry */
547aec1d6eScindi     ETOPO_MOD_NOREG,	/* module failed to register */
557aec1d6eScindi     ETOPO_MOD_NOENT,	/* module path invalid */
560eb822a1Scindi     ETOPO_MOD_XRD,	/* unable to read topology map file */
570eb822a1Scindi     ETOPO_MOD_XENUM,	/* unable to enumerate from a topology map file */
587aec1d6eScindi     ETOPO_MOD_NOSUP,	/* enumerator not supported in this module */
590eb822a1Scindi     ETOPO_MOD_VER,	/* module version mismatch while loading */
607aec1d6eScindi     ETOPO_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
617aec1d6eScindi     ETOPO_RTLD_INIT,	/* shared library plug-in does not define _topo_init */
627aec1d6eScindi     ETOPO_RTLD_NOMEM,	/* memory limit exceeded when opening shared library */
637aec1d6eScindi     ETOPO_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
647aec1d6eScindi     ETOPO_BLTIN_INIT,	/* built-in plug-in does not define init function */
657aec1d6eScindi     ETOPO_VER_OLD,	/* plugin compiled using an obsolete topo ABI */
667aec1d6eScindi     ETOPO_VER_NEW,	/* plugin is compiled using a newer topo ABI */
677aec1d6eScindi     ETOPO_ENUM_PARTIAL,	/* partial enumeration completed for client */
680eb822a1Scindi     ETOPO_ENUM_NOMAP,	/* no topology map file for enumeration */
690eb822a1Scindi     ETOPO_ENUM_FATAL,	/* fatal enumeration error */
709dd0f810Scindi     ETOPO_ENUM_RECURS,	/* recursive enumertation detected */
717aec1d6eScindi     ETOPO_NVL_INVAL,	/* invalid nvlist function argument */
727aec1d6eScindi     ETOPO_FILE_NOENT,	/* no topology file found */
737aec1d6eScindi     ETOPO_PRSR_BADGRP,	/* unrecognized grouping */
747aec1d6eScindi     ETOPO_PRSR_BADNUM,	/* unable to interpret attribute numerically */
757aec1d6eScindi     ETOPO_PRSR_BADRNG,	/* non-sensical range */
767aec1d6eScindi     ETOPO_PRSR_BADSCH,	/* unrecognized scheme */
777aec1d6eScindi     ETOPO_PRSR_BADSTAB,	/* unrecognized stability */
787aec1d6eScindi     ETOPO_PRSR_BADTYPE,	/* unrecognized property value type */
797aec1d6eScindi     ETOPO_PRSR_NOATTR,	/* tag missing attribute */
807aec1d6eScindi     ETOPO_PRSR_NOENT,	/* topology xml file not found */
817aec1d6eScindi     ETOPO_PRSR_NOMETH,	/* range missing enum-method */
827aec1d6eScindi     ETOPO_PRSR_NVPROP,	/* properties as nvlist missing crucial field */
837aec1d6eScindi     ETOPO_PRSR_OOR,	/* node instance out of declared range */
844557a2a1Srobj     ETOPO_PRSR_REGMETH,	/* failed to register property method */
857aec1d6eScindi     ETOPO_WALK_EMPTY,	/* empty topology */
867aec1d6eScindi     ETOPO_WALK_NOTFOUND, /* scheme based topology not found */
87*825ba0f2Srobj     ETOPO_FAC_NOENT,	/* no facility node of specified type found */
887aec1d6eScindi     ETOPO_END		/* end of custom errno list (to ease auto-merge) */
897aec1d6eScindi } topo_errno_t;
907aec1d6eScindi 
917aec1d6eScindi extern int topo_hdl_seterrno(topo_hdl_t *, int);
927aec1d6eScindi extern const char *topo_hdl_errmsg(topo_hdl_t *);
937aec1d6eScindi extern int topo_hdl_errno(topo_hdl_t *);
947aec1d6eScindi 
957aec1d6eScindi #ifdef	__cplusplus
967aec1d6eScindi }
977aec1d6eScindi #endif
987aec1d6eScindi 
997aec1d6eScindi #endif	/* _TOPO_ERROR_H */
100