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 2006 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_HDL_ABIVER, /* handle opened with invalid ABI version */ 50 ETOPO_HDL_SNAP, /* snapshot already taken */ 51 ETOPO_HDL_INVAL, /* invalid argument specified */ 52 ETOPO_HDL_UUID, /* uuid already set */ 53 ETOPO_MOD_INIT, /* failed to initialize module */ 54 ETOPO_MOD_FINI, /* failed to uninitialize module */ 55 ETOPO_MOD_LOADED, /* specified module is already loaded */ 56 ETOPO_MOD_NOMOD, /* specified module is not loaded */ 57 ETOPO_MOD_ABIVER, /* module registered with invalid ABI version */ 58 ETOPO_MOD_INVAL, /* module invalid argument */ 59 ETOPO_MOD_DUP, /* module duplicate node entry */ 60 ETOPO_MOD_NOREG, /* module failed to register */ 61 ETOPO_MOD_NOENT, /* module path invalid */ 62 ETOPO_MOD_XRD, /* unable to read topology map file */ 63 ETOPO_MOD_XENUM, /* unable to enumerate from a topology map file */ 64 ETOPO_MOD_NOSUP, /* enumerator not supported in this module */ 65 ETOPO_MOD_VER, /* module version mismatch while loading */ 66 ETOPO_RTLD_OPEN, /* rtld failed to open shared library plug-in */ 67 ETOPO_RTLD_INIT, /* shared library plug-in does not define _topo_init */ 68 ETOPO_RTLD_NOMEM, /* memory limit exceeded when opening shared library */ 69 ETOPO_BLTIN_NAME, /* built-in plug-in name not found in definition list */ 70 ETOPO_BLTIN_INIT, /* built-in plug-in does not define init function */ 71 ETOPO_NODE_INVAL, /* node opertation invalid argument */ 72 ETOPO_NODE_LINKED, /* node already linked */ 73 ETOPO_NODE_BOUND, /* node already bound */ 74 ETOPO_NODE_DUP, /* duplicate node */ 75 ETOPO_NODE_RANGE, /* invalid instance range */ 76 ETOPO_NODE_NOENT, /* node not found */ 77 ETOPO_NODE_FMRI, /* no fmri specified */ 78 ETOPO_VER_OLD, /* plugin compiled using an obsolete topo ABI */ 79 ETOPO_VER_NEW, /* plugin is compiled using a newer topo ABI */ 80 ETOPO_ENUM_PARTIAL, /* partial enumeration completed for client */ 81 ETOPO_ENUM_NOMAP, /* no topology map file for enumeration */ 82 ETOPO_ENUM_FATAL, /* fatal enumeration error */ 83 ETOPO_FMRI_NVL, /* nvlist allocation failure for FMRI */ 84 ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */ 85 ETOPO_FMRI_MALFORM, /* malformed FMRI */ 86 ETOPO_NVL_INVAL, /* invalid nvlist function argument */ 87 ETOPO_METHOD_INVAL, /* invalid method registration */ 88 ETOPO_METHOD_NOTSUP, /* method not supported */ 89 ETOPO_METHOD_FAIL, /* method failed */ 90 ETOPO_FILE_NOENT, /* no topology file found */ 91 ETOPO_PRSR_BADGRP, /* unrecognized grouping */ 92 ETOPO_PRSR_BADNUM, /* unable to interpret attribute numerically */ 93 ETOPO_PRSR_BADRNG, /* non-sensical range */ 94 ETOPO_PRSR_BADSCH, /* unrecognized scheme */ 95 ETOPO_PRSR_BADSTAB, /* unrecognized stability */ 96 ETOPO_PRSR_BADTYPE, /* unrecognized property value type */ 97 ETOPO_PRSR_NOATTR, /* tag missing attribute */ 98 ETOPO_PRSR_NOENT, /* topology xml file not found */ 99 ETOPO_PRSR_NOMETH, /* range missing enum-method */ 100 ETOPO_PRSR_NVPROP, /* properties as nvlist missing crucial field */ 101 ETOPO_PRSR_OOR, /* node instance out of declared range */ 102 ETOPO_WALK_EMPTY, /* empty topology */ 103 ETOPO_WALK_NOTFOUND, /* scheme based topology not found */ 104 ETOPO_END /* end of custom errno list (to ease auto-merge) */ 105 } topo_errno_t; 106 107 extern int topo_hdl_seterrno(topo_hdl_t *, int); 108 extern const char *topo_hdl_errmsg(topo_hdl_t *); 109 extern int topo_hdl_errno(topo_hdl_t *); 110 111 #ifdef __cplusplus 112 } 113 #endif 114 115 #endif /* _TOPO_ERROR_H */ 116