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 2010 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Construct translation tables for defines in libipmi.h to translate to readable
34 echo >&2 "USAGE: $0 <path to libimpi.h>"
41 echo >&2 "USAGE: $0 <path to libimpi.h>"
42 echo >&2 "Make sure libipmi.h exists and is readable"
48 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
49 * Use is subject to license terms.
53 #include <ipmi_impl.h>"
59 ipmi_name_trans_t ipmi_errno_table[] = {"
61 pattern
=" \(EIPMI_[0-9A-Z_]*\)[^ \/]*\/\* \(.*\) \*\/$"
62 replace
=" { \1, \"\2\" },"
64 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
72 echo "\nipmi_name_trans_t ipmi_entity_table[] = {"
74 pattern
="#define IPMI_ET_\([A-Z0-9_]*\).*\$"
75 replace
=" { IPMI_ET_\1, \"\1\" },"
77 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
85 echo "\nipmi_name_trans_t ipmi_sensor_type_table[] = {"
87 pattern
="#define IPMI_ST_\([A-Z0-9_]*\).*\$"
88 replace
=" { IPMI_ST_\1, \"\1\" },"
90 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
98 echo "\nipmi_name_trans_t ipmi_reading_type_table[] = {"
100 pattern
="#define IPMI_RT_\([A-Z0-9_]*\).*\$"
101 replace
=" { IPMI_RT_\1, \"\1\" },"
103 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1
111 echo "\nipmi_name_trans_t ipmi_units_type_table[] = {"
113 pattern
="#define IPMI_UNITS_\([A-Z0-9_]*\).*\$"
114 replace
=" { IPMI_UNITS_\1, \"\1\" },"
116 cat $libipmi_h |
sed -n "s/$pattern/$replace/p" ||
exit 1