1#!/bin/sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "%Z%%M% %I% %E% SMI" 28 29echo "/* 30 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 31 * Use is subject to license terms. 32 */ 33 34#pragma ident\t\"@(#)mkelemtype.sh\t1.1\t07/01/19 SMI\" 35 36#include <sys/types.h> 37#include <string.h> 38#include <scsi/libses.h> 39 40static const struct { 41\tses2_element_type_t se_type;\t/* element type */ 42\tconst char *se_name;\t\t/* element type name */ 43} _ses_elemtypestr[] = {" 44 45pattern='^ \(SES_ET_\([A-Z0-9_]*\)\).*' 46replace=' { \1, "\2" },' 47 48( sed -n "s/$pattern/$replace/p" ) || exit 1 49 50echo "\ 51};\n\ 52\n\ 53static uint_t _ses_nelemtypes =\n\ 54 sizeof (_ses_elemtypestr) / sizeof (_ses_elemtypestr[0]);\n\ 55\n\ 56const char * 57ses_element_type_name(uint64_t type) 58{ 59 uint_t t; 60 61 for (t = 0; t < _ses_nelemtypes; t++) { 62 if (_ses_elemtypestr[t].se_type == type) 63 return (_ses_elemtypestr[t].se_name); 64 } 65 66 return (NULL); 67}" 68 69exit 0 70