7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * Common Development and Distribution License (the "License").
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
8393544efeffe8042bf5273c148010b32fa827e2Hyon Kim * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiconst char *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi switch (s) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_INTERNAL: return (TOPO_STABSTR_INTERNAL);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_PRIVATE: return (TOPO_STABSTR_PRIVATE);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_OBSOLETE: return (TOPO_STABSTR_OBSOLETE);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_EXTERNAL: return (TOPO_STABSTR_EXTERNAL);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_UNSTABLE: return (TOPO_STABSTR_UNSTABLE);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_EVOLVING: return (TOPO_STABSTR_EVOLVING);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_STABLE: return (TOPO_STABSTR_STABLE);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi case TOPO_STABILITY_STANDARD: return (TOPO_STABSTR_STANDARD);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi default: return (TOPO_STABSTR_UNKNOWN);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi { "stderr", "send debug messages to stderr", TOPO_DBOUT_STDERR },
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi { "syslog", "send debug messages to syslog", TOPO_DBOUT_SYSLOG },
0eb822a1c0c2bea495647510b75f77f0e57633ebcindistatic const topo_debug_mode_t _topo_dbflag_modes[] = {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { "error", "error handling debug messages enabled", TOPO_DBG_ERR },
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { "module", "module debug messages enabled", TOPO_DBG_MOD },
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { "modulesvc", "module services debug messages enabled",
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { "walk", "walker subsystem debug messages enabled", TOPO_DBG_WALK },
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi { "xml", "xml file parsing messages enabled", TOPO_DBG_XML },
8393544efeffe8042bf5273c148010b32fa827e2Hyon Kim { "devinfoforce", "devinfo DINFOFORCE snapshot used", TOPO_DBG_FORCE },
0eb822a1c0c2bea495647510b75f77f0e57633ebcindienv_process_value(topo_hdl_t *thp, const char *begin, const char *end)
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_debug_set(topo_hdl_t *thp, const char *dbmode, const char *dout)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi for (end = (char *)dbmode; *end != '\0'; value = next) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_vdprintf(topo_hdl_t *thp, int mask, const char *mod, const char *format,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi syslog(LOG_DEBUG | LOG_USER, "libtopo DEBUG: %s", msg);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*PRINTFLIKE3*/
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_dprintf(topo_hdl_t *thp, int mask, const char *format, ...)
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * buf_append -- Append str to buf (if it's non-NULL). Place prepend
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * in buf in front of str and append behind it (if they're non-NULL).
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * Continue to update size even if we run out of space to actually
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * stuff characters in the buffer.
74a31ce69a88d851777ca840d31ec610ce9ecab3timhtopo_fmristr_build(ssize_t *sz, char *buf, size_t buflen, char *str,
74a31ce69a88d851777ca840d31ec610ce9ecab3timh *sz += snprintf(buf, left, "%s%s%s", prepend, str, append);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define TOPO_PLATFORM_PATH "%s/usr/platform/%s/lib/fm/topo/%s"
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditopo_search_path(topo_mod_t *mod, const char *rootdir, const char *file)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Search for file name in order of platform, machine and common
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * topo directories
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (void) snprintf(sp, PATH_MAX, TOPO_PLATFORM_PATH, rootdir,
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * SMBIOS serial numbers can contain characters (particularly ':' and ' ')
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * that are invalid for the authority and can break FMRI parsing. We translate
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * any invalid characters to a safe '-', as well as trimming any leading or
20c794b39650d115e17a15983b6b82e46238cf45gavinm * trailing whitespace. Similarly, '/' can be found in some product names
20c794b39650d115e17a15983b6b82e46238cf45gavinm * so we translate that to '-'.
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frosttopo_cleanup_auth_str(topo_hdl_t *thp, const char *begin)
e3d60c9bd991a9826cbfa63b10595d44e123b9c4Adrian Frost if (c == ':' || c == '=' || c == '/' || isspace(c) ||
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtopo_sensor_type_name(uint32_t type, char *buf, size_t len)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj for (ntp = &topo_sensor_type_table[0]; ntp->int_name != NULL; ntp++) {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtopo_sensor_units_name(uint8_t type, char *buf, size_t len)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj for (ntp = &topo_units_type_table[0]; ntp->int_name != NULL; ntp++) {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj for (ntp = &topo_led_type_table[0]; ntp->int_name != NULL; ntp++) {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtopo_led_state_name(uint8_t type, char *buf, size_t len)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj for (ntp = &topo_led_states_table[0]; ntp->int_name != NULL; ntp++) {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtopo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston ntp = &topo_sensor_states_generic_failure_table[0];