mktables.sh (84ab085a13f931bc78e7415e7ce921dbaa14fcb3) mktables.sh (4e901881a1e657e1cbf12d7ef9b476ec373e7939)
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, Version 1.0 only
7# (the "License"). You may not use this file except in compliance
8# with the License.

--- 7 unchanged lines hidden (view full) ---

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]
20#
21# CDDL HEADER END
22#
23#
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, Version 1.0 only
7# (the "License"). You may not use this file except in compliance
8# with the License.

--- 7 unchanged lines hidden (view full) ---

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]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
24# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25# Use is subject to license terms.
26#
25# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26# Use is subject to license terms.
27#
27#ident "%Z%%M% %I% %E% SMI"
28
29#
30# The SMBIOS interfaces defined in <sys/smbios.h> include a set of integer-to-
31# string conversion routines for the various constants defined in the SMBIOS
32# spec. These functions are used by smbios(1M) and prtdiag(1M) and can be
33# leveraged by other clients as well. To simplify maintenance of the source
34# base, this shell script automatically generates the source code for all of
35# these functions from the <sys/smbios.h> header file and its comments. Each

--- 7 unchanged lines hidden (view full) ---

43SMB_BIOSFL_ smbios_bios_flag_name uint64_t
44SMB_BIOSXB1_ smbios_bios_xb1_name uint_t
45SMB_BIOSXB2_ smbios_bios_xb2_name uint_t
46SMB_CAT_ smbios_cache_ctype_name uint_t
47SMB_CAF_ smbios_cache_flag_name uint_t
48SMB_EVFL_ smbios_evlog_flag_name uint_t
49SMB_IPMI_F_ smbios_ipmi_flag_name uint_t
50SMB_MDF_ smbios_memdevice_flag_name uint_t
28
29#
30# The SMBIOS interfaces defined in <sys/smbios.h> include a set of integer-to-
31# string conversion routines for the various constants defined in the SMBIOS
32# spec. These functions are used by smbios(1M) and prtdiag(1M) and can be
33# leveraged by other clients as well. To simplify maintenance of the source
34# base, this shell script automatically generates the source code for all of
35# these functions from the <sys/smbios.h> header file and its comments. Each

--- 7 unchanged lines hidden (view full) ---

43SMB_BIOSFL_ smbios_bios_flag_name uint64_t
44SMB_BIOSXB1_ smbios_bios_xb1_name uint_t
45SMB_BIOSXB2_ smbios_bios_xb2_name uint_t
46SMB_CAT_ smbios_cache_ctype_name uint_t
47SMB_CAF_ smbios_cache_flag_name uint_t
48SMB_EVFL_ smbios_evlog_flag_name uint_t
49SMB_IPMI_F_ smbios_ipmi_flag_name uint_t
50SMB_MDF_ smbios_memdevice_flag_name uint_t
51SMB_PRC_ smbios_processor_core_flag_name uint_t
51SMB_TYPE_ smbios_type_name uint_t
52SMB_SLCH1_ smbios_slot_ch1_name uint_t
53SMB_SLCH2_ smbios_slot_ch2_name uint_t
54'
55
56desc_funcs='
57SMB_BBFL_ smbios_bboard_flag_desc uint_t
58SMB_BBT_ smbios_bboard_type_desc uint_t

--- 17 unchanged lines hidden (view full) ---

76SMB_IPMI_F_ smbios_ipmi_flag_desc uint_t
77SMB_IPMI_T_ smbios_ipmi_type_desc uint_t
78SMB_MAL_ smbios_memarray_loc_desc uint_t
79SMB_MAU_ smbios_memarray_use_desc uint_t
80SMB_MAE_ smbios_memarray_ecc_desc uint_t
81SMB_MDF_ smbios_memdevice_flag_desc uint_t
82SMB_MDFF_ smbios_memdevice_form_desc uint_t
83SMB_MDT_ smbios_memdevice_type_desc uint_t
52SMB_TYPE_ smbios_type_name uint_t
53SMB_SLCH1_ smbios_slot_ch1_name uint_t
54SMB_SLCH2_ smbios_slot_ch2_name uint_t
55'
56
57desc_funcs='
58SMB_BBFL_ smbios_bboard_flag_desc uint_t
59SMB_BBT_ smbios_bboard_type_desc uint_t

--- 17 unchanged lines hidden (view full) ---

77SMB_IPMI_F_ smbios_ipmi_flag_desc uint_t
78SMB_IPMI_T_ smbios_ipmi_type_desc uint_t
79SMB_MAL_ smbios_memarray_loc_desc uint_t
80SMB_MAU_ smbios_memarray_use_desc uint_t
81SMB_MAE_ smbios_memarray_ecc_desc uint_t
82SMB_MDF_ smbios_memdevice_flag_desc uint_t
83SMB_MDFF_ smbios_memdevice_form_desc uint_t
84SMB_MDT_ smbios_memdevice_type_desc uint_t
85SMB_MDR_ smbios_memdevice_rank_desc uint_t
84SMB_POC_ smbios_port_conn_desc uint_t
85SMB_POT_ smbios_port_type_desc uint_t
86SMB_POC_ smbios_port_conn_desc uint_t
87SMB_POT_ smbios_port_type_desc uint_t
88SMB_PRC_ smbios_processor_core_flag_desc uint_t
86SMB_PRF_ smbios_processor_family_desc uint_t
87SMB_PRS_ smbios_processor_status_desc uint_t
88SMB_PRT_ smbios_processor_type_desc uint_t
89SMB_PRU_ smbios_processor_upgrade_desc uint_t
90SMB_SLCH1_ smbios_slot_ch1_desc uint_t
91SMB_SLCH2_ smbios_slot_ch2_desc uint_t
92SMB_SLL_ smbios_slot_length_desc uint_t
93SMB_SLT_ smbios_slot_type_desc uint_t

--- 5 unchanged lines hidden (view full) ---

99
100if [ $# -ne 1 ]; then
101 echo "Usage: $0 file.h > file.c" >&2
102 exit 2
103fi
104
105echo "\
106/*\n\
89SMB_PRF_ smbios_processor_family_desc uint_t
90SMB_PRS_ smbios_processor_status_desc uint_t
91SMB_PRT_ smbios_processor_type_desc uint_t
92SMB_PRU_ smbios_processor_upgrade_desc uint_t
93SMB_SLCH1_ smbios_slot_ch1_desc uint_t
94SMB_SLCH2_ smbios_slot_ch2_desc uint_t
95SMB_SLL_ smbios_slot_length_desc uint_t
96SMB_SLT_ smbios_slot_type_desc uint_t

--- 5 unchanged lines hidden (view full) ---

102
103if [ $# -ne 1 ]; then
104 echo "Usage: $0 file.h > file.c" >&2
105 exit 2
106fi
107
108echo "\
109/*\n\
110 * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.\n\
107 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\
108 * Use is subject to license terms.\n\
109 */\n\
110\n\
111 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\
112 * Use is subject to license terms.\n\
113 */\n\
114\n\
111#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
112\n\
113#include <smbios.h>"
114
115echo "$name_funcs" | while read p name type; do
116 [ -z "$p" ] && continue
117 pattern="^#define[ ]\($p[A-Za-z0-9_]*\)[ ]*[A-Z0-9]*.*$"
118 replace=' case \1: return ("\1");'
119
120 echo "\nconst char *\n$name($type x)\n{\n\tswitch (x) {"

--- 25 unchanged lines hidden ---
115#include <smbios.h>"
116
117echo "$name_funcs" | while read p name type; do
118 [ -z "$p" ] && continue
119 pattern="^#define[ ]\($p[A-Za-z0-9_]*\)[ ]*[A-Z0-9]*.*$"
120 replace=' case \1: return ("\1");'
121
122 echo "\nconst char *\n$name($type x)\n{\n\tswitch (x) {"

--- 25 unchanged lines hidden ---