6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Construct translation tables for defines in libtopo.h to translate to readable
34 echo >&2 "USAGE: $0 <path to libtopo.h>"
41 echo >&2 "USAGE: $0 <path to libtopo.h>"
42 echo >&2 "Make sure libtopo.h exists and is readable"
48 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
49 * Use is subject to license terms.
53 #include \"topo_mod.h\"
54 #include \"topo_subr.h\""
59 echo "\ntopo_name_trans_t topo_sensor_type_table[] = {"
61 pattern
="#define TOPO_SENSOR_TYPE_\([A-Z0-9_]*\).*\$"
62 replace
=" { TOPO_SENSOR_TYPE_\1, \"\1\" },"
64 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
72 echo "\ntopo_name_trans_t topo_units_type_table[] = {"
74 pattern
=" TOPO_SENSOR_UNITS_\([A-Z0-9_]*\).*\$"
75 replace
=" { TOPO_SENSOR_UNITS_\1, \"\1\" },"
77 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
83 # Indicator (LED) types
85 echo "\ntopo_name_trans_t topo_led_type_table[] = {"
87 pattern
=" TOPO_LED_TYPE_\([A-Z0-9_]*\).*\$"
88 replace
=" { TOPO_LED_TYPE_\1, \"\1\" },"
90 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
96 # Indicator (LED) states
98 echo "\ntopo_name_trans_t topo_led_states_table[] = {"
100 pattern
=" TOPO_LED_STATE_\([A-Z0-9_]*\).*\$"
101 replace
=" { TOPO_LED_STATE_\1, \"\1\" },"
103 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
109 # Discrete sensor states
111 echo "\ntopo_name_trans_t topo_sensor_states_physical_table[] = {"
113 pattern
="#define TOPO_SENSOR_STATE_PHYSICAL_\([A-Z0-9_]*\).*\$"
114 replace
=" { TOPO_SENSOR_STATE_PHYSICAL_\1, \"\1\" },"
116 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
121 echo "\ntopo_name_trans_t topo_sensor_states_platform_table[] = {"
123 pattern
="#define TOPO_SENSOR_STATE_PLATFORM_\([A-Z0-9_]*\).*\$"
124 replace
=" { TOPO_SENSOR_STATE_PLATFORM_\1, \"\1\" },"
126 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
131 echo "\ntopo_name_trans_t topo_sensor_states_processor_table[] = {"
133 pattern
="#define TOPO_SENSOR_STATE_PROCESSOR_\([A-Z0-9_]*\).*\$"
134 replace
=" { TOPO_SENSOR_STATE_PROCESSOR_\1, \"\1\" },"
136 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
141 echo "\ntopo_name_trans_t topo_sensor_states_power_supply_table[] = {"
143 pattern
="#define TOPO_SENSOR_STATE_POWER_SUPPLY_\([A-Z0-9_]*\).*\$"
144 replace
=" { TOPO_SENSOR_STATE_POWER_SUPPLY_\1, \"\1\" },"
146 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
151 echo "\ntopo_name_trans_t topo_sensor_states_power_unit_table[] = {"
153 pattern
="#define TOPO_SENSOR_STATE_POWER_UNIT_\([A-Z0-9_]*\).*\$"
154 replace
=" { TOPO_SENSOR_STATE_POWER_UNIT_\1, \"\1\" },"
156 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
161 echo "\ntopo_name_trans_t topo_sensor_states_memory_table[] = {"
163 pattern
="#define TOPO_SENSOR_STATE_MEMORY_\([A-Z0-9_]*\).*\$"
164 replace
=" { TOPO_SENSOR_STATE_MEMORY_\1, \"\1\" },"
166 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
171 echo "\ntopo_name_trans_t topo_sensor_states_bay_table[] = {"
173 pattern
="#define TOPO_SENSOR_STATE_BAY_\([A-Z0-9_]*\).*\$"
174 replace
=" { TOPO_SENSOR_STATE_BAY_\1, \"\1\" },"
176 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
181 echo "\ntopo_name_trans_t topo_sensor_states_firmware_table[] = {"
183 pattern
="#define TOPO_SENSOR_STATE_FIRMWARE_\([A-Z0-9_]*\).*\$"
184 replace
=" { TOPO_SENSOR_STATE_FIRMWARE_\1, \"\1\" },"
186 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
191 echo "\ntopo_name_trans_t topo_sensor_states_event_log_table[] = {"
193 pattern
="#define TOPO_SENSOR_STATE_EVENT_LOG_\([A-Z0-9_]*\).*\$"
194 replace
=" { TOPO_SENSOR_STATE_EVENT_LOG_\1, \"\1\" },"
196 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
201 echo "\ntopo_name_trans_t topo_sensor_states_watchdog1_table[] = {"
203 pattern
="#define TOPO_SENSOR_STATE_WATCHDOG_\([A-Z0-9_]*\).*\$"
204 replace
=" { TOPO_SENSOR_STATE_WATCHDOG_\1, \"\1\" },"
206 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
211 echo "\ntopo_name_trans_t topo_sensor_states_system_table[] = {"
213 pattern
="#define TOPO_SENSOR_STATE_SYSTEM_\([A-Z0-9_]*\).*\$"
214 replace
=" { TOPO_SENSOR_STATE_SYSTEM_\1, \"\1\" },"
216 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
221 echo "\ntopo_name_trans_t topo_sensor_states_critical_table[] = {"
223 pattern
="#define TOPO_SENSOR_STATE_CRITICAL_\([A-Z0-9_]*\).*\$"
224 replace
=" { TOPO_SENSOR_STATE_CRITICAL_\1, \"\1\" },"
226 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
231 echo "\ntopo_name_trans_t topo_sensor_states_button_table[] = {"
233 pattern
="#define TOPO_SENSOR_STATE_BUTTON_\([A-Z0-9_]*\).*\$"
234 replace
=" { TOPO_SENSOR_STATE_BUTTON_\1, \"\1\" },"
236 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
241 echo "\ntopo_name_trans_t topo_sensor_states_cable_table[] = {"
243 pattern
="#define TOPO_SENSOR_STATE_CABLE_\([A-Z0-9_]*\).*\$"
244 replace
=" { TOPO_SENSOR_STATE_CABLE_\1, \"\1\" },"
246 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
251 echo "\ntopo_name_trans_t topo_sensor_states_boot_state_table[] = {"
253 pattern
="#define TOPO_SENSOR_STATE_BOOT_STATE_\([A-Z0-9_]*\).*\$"
254 replace
=" { TOPO_SENSOR_STATE_BOOT_STATE_\1, \"\1\" },"
256 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
261 echo "\ntopo_name_trans_t topo_sensor_states_boot_error_table[] = {"
263 pattern
="#define TOPO_SENSOR_STATE_BOOT_ERROR_\([A-Z0-9_]*\).*\$"
264 replace
=" { TOPO_SENSOR_STATE_BOOT_ERROR_\1, \"\1\" },"
266 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
271 echo "\ntopo_name_trans_t topo_sensor_states_boot_os_table[] = {"
273 pattern
="#define TOPO_SENSOR_STATE_BOOT_OS_\([A-Z0-9_]*\).*\$"
274 replace
=" { TOPO_SENSOR_STATE_BOOT_OS_\1, \"\1\" },"
276 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
281 echo "\ntopo_name_trans_t topo_sensor_states_os_table[] = {"
283 pattern
="#define TOPO_SENSOR_STATE_OS_\([A-Z0-9_]*\).*\$"
284 replace
=" { TOPO_SENSOR_STATE_OS_\1, \"\1\" },"
286 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
291 echo "\ntopo_name_trans_t topo_sensor_states_slot_table[] = {"
293 pattern
="#define TOPO_SENSOR_STATE_SLOT_\([A-Z0-9_]*\).*\$"
294 replace
=" { TOPO_SENSOR_STATE_SLOT_\1, \"\1\" },"
296 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
301 echo "\ntopo_name_trans_t topo_sensor_states_acpi_table[] = {"
303 pattern
="#define TOPO_SENSOR_STATE_ACPI_\([A-Z0-9_]*\).*\$"
304 replace
=" { TOPO_SENSOR_STATE_ACPI_\1, \"\1\" },"
306 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
311 echo "\ntopo_name_trans_t topo_sensor_states_watchdog2_table[] = {"
313 pattern
="#define TOPO_SENSOR_STATE_WATCHDOG2_\([A-Z0-9_]*\).*\$"
314 replace
=" { TOPO_SENSOR_STATE_WATCHDOG2_\1, \"\1\" },"
316 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
321 echo "\ntopo_name_trans_t topo_sensor_states_alert_table[] = {"
323 pattern
="#define TOPO_SENSOR_STATE_ALERT_\([A-Z0-9_]*\).*\$"
324 replace
=" { TOPO_SENSOR_STATE_ALERT_\1, \"\1\" },"
326 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
331 echo "\ntopo_name_trans_t topo_sensor_states_presence_table[] = {"
333 pattern
="#define TOPO_SENSOR_STATE_PRESENCE_\([A-Z0-9_]*\).*\$"
334 replace
=" { TOPO_SENSOR_STATE_PRESENCE_\1, \"\1\" },"
336 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
341 echo "\ntopo_name_trans_t topo_sensor_states_lan_table[] = {"
343 pattern
="#define TOPO_SENSOR_STATE_LAN_\([A-Z0-9_]*\).*\$"
344 replace
=" { TOPO_SENSOR_STATE_LAN_\1, \"\1\" },"
346 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
351 echo "\ntopo_name_trans_t topo_sensor_states_health_table[] = {"
353 pattern
="#define TOPO_SENSOR_STATE_HEALTH_\([A-Z0-9_]*\).*\$"
354 replace
=" { TOPO_SENSOR_STATE_HEALTH_\1, \"\1\" },"
356 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
361 echo "\ntopo_name_trans_t topo_sensor_states_battery_table[] = {"
363 pattern
="#define TOPO_SENSOR_STATE_BATTERY_\([A-Z0-9_]*\).*\$"
364 replace
=" { TOPO_SENSOR_STATE_BATTERY_\1, \"\1\" },"
366 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
371 echo "\ntopo_name_trans_t topo_sensor_states_audit_table[] = {"
373 pattern
="#define TOPO_SENSOR_STATE_AUDIT_\([A-Z0-9_]*\).*\$"
374 replace
=" { TOPO_SENSOR_STATE_AUDIT_\1, \"\1\" },"
376 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
381 echo "\ntopo_name_trans_t topo_sensor_states_version_table[] = {"
383 pattern
="#define TOPO_SENSOR_STATE_VERSION_\([A-Z0-9_]*\).*\$"
384 replace
=" { TOPO_SENSOR_STATE_VERSION_\1, \"\1\" },"
386 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
391 echo "\ntopo_name_trans_t topo_sensor_states_fru_state_table[] = {"
393 pattern
="#define TOPO_SENSOR_STATE_FRU_STATE_\([A-Z0-9_]*\).*\$"
394 replace
=" { TOPO_SENSOR_STATE_FRU_STATE_\1, \"\1\" },"
396 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
401 echo "\ntopo_name_trans_t topo_sensor_states_thresh_table[] = {"
403 pattern
="#define TOPO_SENSOR_STATE_THRESH_\([A-Z0-9_]*\).*\$"
404 replace
=" { TOPO_SENSOR_STATE_THRESH_\1, \"\1\" },"
406 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
411 echo "\ntopo_name_trans_t topo_sensor_states_generic_usage_table[] = {"
413 pattern
="#define TOPO_SENSOR_STATE_GENERIC_USAGE_\([A-Z0-9_]*\).*\$"
414 replace
=" { TOPO_SENSOR_STATE_GENERIC_USAGE_\1, \"\1\" },"
416 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
421 echo "\ntopo_name_trans_t topo_sensor_states_generic_state_table[] = {"
423 pattern
="#define TOPO_SENSOR_STATE_GENERIC_STATE_\([A-Z0-9_]*\).*\$"
424 replace
=" { TOPO_SENSOR_STATE_GENERIC_STATE_\1, \"\1\" },"
426 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
432 echo "\ntopo_name_trans_t topo_sensor_states_generic_predfail_table[] = {"
434 pattern
="#define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_\([A-Z0-9_]*\).*\$"
435 replace
=" { TOPO_SENSOR_STATE_GENERIC_PREDFAIL_\1, \"\1\" },"
437 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
442 echo "\ntopo_name_trans_t topo_sensor_states_generic_limit_table[] = {"
444 pattern
="#define TOPO_SENSOR_STATE_GENERIC_LIMIT_\([A-Z0-9_]*\).*\$"
445 replace
=" { TOPO_SENSOR_STATE_GENERIC_LIMIT_\1, \"\1\" },"
447 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
452 echo "\ntopo_name_trans_t topo_sensor_states_generic_perf_table[] = {"
454 pattern
="#define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_\([A-Z0-9_]*\).*\$"
455 replace
=" { TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_\1, \"\1\" },"
457 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
462 echo "\ntopo_name_trans_t topo_sensor_states_severity_table[] = {"
464 pattern
="#define TOPO_SENSOR_STATE_SEVERITY_\([A-Z0-9_]*\).*\$"
465 replace
=" { TOPO_SENSOR_STATE_SEVERITY_\1, \"\1\" },"
467 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
472 echo "\ntopo_name_trans_t topo_sensor_states_generic_presence_table[] = {"
474 pattern
="#define TOPO_SENSOR_STATE_GENERIC_PRESENCE_\([A-Z0-9_]*\).*\$"
475 replace
=" { TOPO_SENSOR_STATE_GENERIC_PRESENCE_\1, \"\1\" },"
477 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
482 echo "\ntopo_name_trans_t topo_sensor_states_generic_avail_table[] = {"
484 pattern
="#define TOPO_SENSOR_STATE_GENERIC_AVAILABILITY_\([A-Z0-9_]*\).*\$"
485 replace
=" { TOPO_SENSOR_STATE_GENERIC_AVAILABILITY_\1, \"\1\" },"
487 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
492 echo "\ntopo_name_trans_t topo_sensor_states_generic_status_table[] = {"
494 pattern
="#define TOPO_SENSOR_STATE_GENERIC_STATUS_\([A-Z0-9_]*\).*\$"
495 replace
=" { TOPO_SENSOR_STATE_GENERIC_STATUS_\1, \"\1\" },"
497 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
502 echo "\ntopo_name_trans_t topo_sensor_states_generic_acpi_pwr_table[] = {"
504 pattern
="#define TOPO_SENSOR_STATE_GENERIC_ACPI_PWR_STATE_\([A-Z0-9_]*\).*\$"
505 replace
=" { TOPO_SENSOR_STATE_GENERIC_ACPI_PWR_STATE_\1, \"\1\" },"
507 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
512 echo "\ntopo_name_trans_t topo_sensor_states_generic_failure_table[] = {"
514 pattern
="#define TOPO_SENSOR_STATE_GENERIC_FAIL_\([A-Z0-9_]*\).*\$"
515 replace
=" { TOPO_SENSOR_STATE_GENERIC_FAIL_\1, \"\1\" },"
517 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
522 echo "\ntopo_name_trans_t topo_sensor_states_generic_ok_table[] = {"
524 pattern
="#define TOPO_SENSOR_STATE_GENERIC_OK_\([A-Z0-9_]*\).*\$"
525 replace
=" { TOPO_SENSOR_STATE_GENERIC_OK_\1, \"\1\" },"
527 cat $libtopo_h |
sed -n "s/$pattern/$replace/p" ||
exit 1