16070Srobj#!/bin/sh 26070Srobj 36070Srobj# 46070Srobj# CDDL HEADER START 56070Srobj# 66070Srobj# The contents of this file are subject to the terms of the 76070Srobj# Common Development and Distribution License (the "License"). 86070Srobj# You may not use this file except in compliance with the License. 96070Srobj# 106070Srobj# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 116070Srobj# or http://www.opensolaris.org/os/licensing. 126070Srobj# See the License for the specific language governing permissions 136070Srobj# and limitations under the License. 146070Srobj# 156070Srobj# When distributing Covered Code, include this CDDL HEADER in each 166070Srobj# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 176070Srobj# If applicable, add the following below this CDDL HEADER, with the 186070Srobj# fields enclosed by brackets "[]" replaced with your own identifying 196070Srobj# information: Portions Copyright [yyyy] [name of copyright owner] 206070Srobj# 216070Srobj# CDDL HEADER END 226070Srobj# 236070Srobj# 24*11756SRobert.Johnston@Sun.COM# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 256070Srobj# Use is subject to license terms. 266070Srobj# 276070Srobj 286070Srobj# 296070Srobj# Construct translation tables for defines in libipmi.h to translate to readable 306070Srobj# strings. 316070Srobj# 326070Srobj 336070Srobjif [ $# -ne 1 ]; then 346070Srobj echo >&2 "USAGE: $0 <path to libimpi.h>" 356070Srobj exit 1 366070Srobjfi 376070Srobj 386070Srobjif [ -r $1 ]; then 396070Srobj libipmi_h=$1 406070Srobjelse 416070Srobj echo >&2 "USAGE: $0 <path to libimpi.h>" 426070Srobj echo >&2 "Make sure libipmi.h exists and is readable" 436070Srobj exit 1 446070Srobjfi 456070Srobj 466070Srobjecho "\ 476070Srobj/* 48*11756SRobert.Johnston@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 496070Srobj * Use is subject to license terms. 506070Srobj */ 516070Srobj 526070Srobj#include <libipmi.h> 536070Srobj#include <ipmi_impl.h>" 546070Srobj 556070Srobj# 566070Srobj# Error table. 576070Srobj# 586070Srobjecho " 596070Srobjipmi_name_trans_t ipmi_errno_table[] = {" 606070Srobj 616070Srobjpattern=" \(EIPMI_[0-9A-Z_]*\)[^ \/]*\/\* \(.*\) \*\/$" 626070Srobjreplace=" { \1, \"\2\" }," 636070Srobj 646070Srobjcat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1 656070Srobj 666070Srobjecho "\t{ 0, NULL } 676070Srobj};" 686070Srobj 696070Srobj# 706070Srobj# Entity table. 716070Srobj# 726070Srobjecho "\nipmi_name_trans_t ipmi_entity_table[] = {" 736070Srobj 746070Srobjpattern="#define IPMI_ET_\([A-Z0-9_]*\).*\$" 756070Srobjreplace=" { IPMI_ET_\1, \"\1\" }," 766070Srobj 776070Srobjcat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1 786070Srobj 796070Srobjecho "\t{ 0, NULL } 806070Srobj};" 816070Srobj 826070Srobj# 836070Srobj# Sensor types. 846070Srobj# 856070Srobjecho "\nipmi_name_trans_t ipmi_sensor_type_table[] = {" 866070Srobj 876070Srobjpattern="#define IPMI_ST_\([A-Z0-9_]*\).*\$" 886070Srobjreplace=" { IPMI_ST_\1, \"\1\" }," 896070Srobj 906070Srobjcat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1 916070Srobj 926070Srobjecho "\t{ 0, NULL } 936070Srobj};" 946070Srobj 956070Srobj# 966070Srobj# Reading types. 976070Srobj# 986070Srobjecho "\nipmi_name_trans_t ipmi_reading_type_table[] = {" 996070Srobj 1006070Srobjpattern="#define IPMI_RT_\([A-Z0-9_]*\).*\$" 1016070Srobjreplace=" { IPMI_RT_\1, \"\1\" }," 1026070Srobj 1036070Srobjcat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1 1046070Srobj 1056070Srobjecho "\t{ 0, NULL } 1066070Srobj};" 1077243Srobj 1087243Srobj# 1097243Srobj# Units 1107243Srobj# 1117243Srobjecho "\nipmi_name_trans_t ipmi_units_type_table[] = {" 1127243Srobj 1137243Srobjpattern="#define IPMI_UNITS_\([A-Z0-9_]*\).*\$" 1147243Srobjreplace=" { IPMI_UNITS_\1, \"\1\" }," 1157243Srobj 1167243Srobjcat $libipmi_h | sed -n "s/$pattern/$replace/p" || exit 1 1177243Srobj 1187243Srobjecho "\t{ 0, NULL } 1197243Srobj};" 1207243Srobj 121