2N/A#!/bin/sh
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A
2N/A#
2N/A# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/Aecho "/*
2N/A * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#include <sys/types.h>
2N/A#include <string.h>
2N/A#include <scsi/libses.h>
2N/A#include <scsi/plugins/ses/vendor/sun.h>
2N/A
2N/Astatic const struct {
2N/A\tint se_type;\t/* element type */
2N/A\tconst char *se_name;\t\t/* element type name */
2N/A} _ses_elemtypestr[] = {"
2N/A
2N/Apattern='^ \(SES_ET_\([A-Z0-9_]*\)\).*'
2N/Areplace=' { \1, "\2" },'
2N/Apattern2=', "SUNW_'
2N/Areplace2=', "'
2N/A
2N/A( for file in $*
2N/A do
2N/A cat $file | sed -n "s/$pattern/$replace/p" | sed "s/$pattern2/$replace2/"
2N/A done ) || exit 1
2N/A
2N/Aecho "\
2N/A};\n\
2N/A\n\
2N/Astatic uint_t _ses_nelemtypes =\n\
2N/A sizeof (_ses_elemtypestr) / sizeof (_ses_elemtypestr[0]);\n\
2N/A\n\
2N/Aconst char *
2N/Ases_element_type_name(uint64_t type)
2N/A{
2N/A uint_t t;
2N/A
2N/A for (t = 0; t < _ses_nelemtypes; t++) {
2N/A if (_ses_elemtypestr[t].se_type == type)
2N/A return (_ses_elemtypestr[t].se_name);
2N/A }
2N/A
2N/A return (NULL);
2N/A}"
2N/A
2N/Aexit 0