6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / lib / libipmi / common / mktables.sh
blobd0c60a866cf4d28d64041d91560d3298de28f9ae
1 #!/bin/sh
4 # CDDL HEADER START
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]
21 # CDDL HEADER END
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #ident "%Z%%M% %I% %E% SMI"
30 # Construct translation tables for defines in libipmi.h to translate to readable
31 # strings.
34 if [ $# -ne 1 ]; then
35 echo >&2 "USAGE: $0 <path to libimpi.h>"
36 exit 1
39 if [ -r $1 ]; then
40 libipmi_h=$1
41 else
42 echo >&2 "USAGE: $0 <path to libimpi.h>"
43 echo >&2 "Make sure libipmi.h exists and is readable"
44 exit 1
47 echo "\
49 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
50 * Use is subject to license terms.
53 #pragma ident \"%Z%%M% %I% %E% SMI\"
55 #include <libipmi.h>
56 #include <ipmi_impl.h>"
59 # Error table.
61 echo "
62 ipmi_name_trans_t ipmi_errno_table[] = {"
64 pattern=" \(EIPMI_[0-9A-Z_]*\)[^ \/]*\/\* \(.*\) \*\/$"
65 replace=" { \1, \"\2\" },"
67 cat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1
69 echo "\t{ 0, NULL }
70 };"
73 # Entity table.
75 echo "\nipmi_name_trans_t ipmi_entity_table[] = {"
77 pattern="#define IPMI_ET_\([A-Z0-9_]*\).*\$"
78 replace=" { IPMI_ET_\1, \"\1\" },"
80 cat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1
82 echo "\t{ 0, NULL }
83 };"
86 # Sensor types.
88 echo "\nipmi_name_trans_t ipmi_sensor_type_table[] = {"
90 pattern="#define IPMI_ST_\([A-Z0-9_]*\).*\$"
91 replace=" { IPMI_ST_\1, \"\1\" },"
93 cat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1
95 echo "\t{ 0, NULL }
96 };"
99 # Reading types.
101 echo "\nipmi_name_trans_t ipmi_reading_type_table[] = {"
103 pattern="#define IPMI_RT_\([A-Z0-9_]*\).*\$"
104 replace=" { IPMI_RT_\1, \"\1\" },"
106 cat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1
108 echo "\t{ 0, NULL }
112 # Units
114 echo "\nipmi_name_trans_t ipmi_units_type_table[] = {"
116 pattern="#define IPMI_UNITS_\([A-Z0-9_]*\).*\$"
117 replace=" { IPMI_UNITS_\1, \"\1\" },"
119 cat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1
121 echo "\t{ 0, NULL }