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