mkioctls revision 1.28
11.14Schristos#!/bin/sh 21.28She# $NetBSD: mkioctls,v 1.28 2006/08/31 22:25:34 he Exp $ 31.7Sjtc# 41.7Sjtc# Copyright (c) 1994 51.7Sjtc# The Regents of the University of California. All rights reserved. 61.7Sjtc# 71.7Sjtc# Redistribution and use in source and binary forms, with or without 81.7Sjtc# modification, are permitted provided that the following conditions 91.7Sjtc# are met: 101.7Sjtc# 1. Redistributions of source code must retain the above copyright 111.7Sjtc# notice, this list of conditions and the following disclaimer. 121.7Sjtc# 2. Redistributions in binary form must reproduce the above copyright 131.7Sjtc# notice, this list of conditions and the following disclaimer in the 141.7Sjtc# documentation and/or other materials provided with the distribution. 151.7Sjtc# 3. All advertising materials mentioning features or use of this software 161.7Sjtc# must display the following acknowledgement: 171.7Sjtc# This product includes software developed by the University of 181.7Sjtc# California, Berkeley and its contributors. 191.7Sjtc# 4. Neither the name of the University nor the names of its contributors 201.7Sjtc# may be used to endorse or promote products derived from this software 211.7Sjtc# without specific prior written permission. 221.7Sjtc# 231.7Sjtc# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.7Sjtc# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.7Sjtc# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.7Sjtc# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.7Sjtc# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.7Sjtc# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.7Sjtc# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.7Sjtc# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.7Sjtc# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.7Sjtc# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.7Sjtc# SUCH DAMAGE. 341.7Sjtc# 351.7Sjtc# @(#)mkioctls 8.2 (Berkeley) 4/28/95 361.3Smycroft# 371.16Schristosecho "/* Automatically generated file, do not edit! */" 381.21Schristos#echo "#define const" # XXX: timepps lossage 391.14Schristosecho "#define COMPAT_43" 401.14Schristosecho "struct lwp;" 411.24Schristosecho "struct crap { int _xxx; };" # XXX arm video lossage 421.24Schristosecho "typedef struct crap videomemory_t;" # XXX arm video lossage 431.24Schristosecho "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage 441.24Schristosecho "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage 451.24Schristosecho "#include <stdio.h>" 461.14Schristosecho "#include <sys/types.h>" 471.14Schristosecho "#include <sys/param.h>" 481.14Schristosecho "#include <sys/disk.h>" 491.17Shannkenecho "#include <sys/dkbad.h>" 501.14Schristosecho "#include <sys/mount.h>" 511.14Schristosecho "#include <sys/termios.h>" 521.16Schristosecho "#include <sys/disklabel.h>" 531.25Schristosecho "#include <sys/device.h>" 541.14Schristosecho "#include <net/if.h>" 551.24Schristosecho "#include <net/if_ether.h>" 561.14Schristosecho "#include <net/route.h>" 571.14Schristosecho "#include <net/ppp_defs.h>" 581.14Schristosecho "#include <netinet/in.h>" 591.14Schristosecho "#include <netinet/in_systm.h>" 601.14Schristosecho "#include <netinet/ip.h>" 611.14Schristosecho "#include <netinet/ip_mroute.h>" 621.14Schristosecho "#include <netinet/ip_compat.h>" 631.14Schristosecho "#include <net80211/ieee80211.h>" 641.24Schristosecho "#include <net80211/ieee80211_radiotap.h>" 651.24Schristosecho "#include <netinet6/in6_var.h>" 661.24Schristosecho "#include <netinet6/nd6.h>" 671.14Schristosecho "#include <netiso/iso.h>" 681.24Schristosecho "#include <dev/ic/hd44780reg.h>" 691.24Schristosecho "#include <dev/pci/mlyreg.h>" 701.24Schristosecho "#include <prop/proplib.h>" 711.14Schristosfor i 721.14Schristosdo 731.14Schristos echo "#include <$i>" 741.14Schristosdone | sed -e "s,${DESTDIR}/usr/include/,,g" 751.14Schristos 761.18Sdrochner${CC:-cc} -E -nostdinc -idirafter $DESTDIR/usr/include -dM ${1+"$@"} | awk ' 771.1ScgdBEGIN { 781.17Shannken keep["SLIOCGUNIT"] = 1; # Same as PPPIOCGASYNCMAP 791.19Schristos keep["TUNSLMODE"] = 1; # Same as PPPIOCGASYNCMAP 801.17Shannken keep["SIOCRMNAT"] = 1; # Same as SIOCRMAFR 811.17Shannken keep["SIOCADNAT"] = 1; # Same as SIOCADAFR 821.17Shannken keep["SIOCDELST"] = 1; # Same as SIOCRMNAT 831.22Schristos keep["SIOCPROXY"] = 1; # Same as SIOCLOOKUPSTAT 841.17Shannken keep["CHIOGPICKER"] = 1; # Same as CDIOREADTOCHEADER 851.20Schristos keep["KBDSTPMAT"] = 1; # Same as LMREADY, pcvt is gone so ok. 861.24Schristos keep["SIOCSLOWAT"] = 1; # Same as SATIOSBUFSIZE 871.24Schristos keep["UTOPPYIOTURBO"] = 1; # Same as OTIOCSETD 881.24Schristos keep["TIOCHPCL"] = 1; # Same as UTOPPYIOCANCEL 891.24Schristos keep["TIOCCBRK"] = 1; # Same as CONSOLE_X_MODE_OFF 901.24Schristos keep["TIOCSDTR"] = 1; # Same as CONSOLE_X_MODE_ON 911.24Schristos keep["APM_IOC_SUSPEND"] = 1; # Same as AGPIOC_RELEASE 921.24Schristos keep["APM_IOC_STANDBY"] = 1; # Same as AGPIOC_ACQUIRE 931.24Schristos keep["BTDEV_GETINFO"] = 1; # Same as BTSCO_GETINFO 941.24Schristos keep["BTHSET_GETINFO"] = 1; # Same as BTSCO_GETINFO 951.24Schristos keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT 961.24Schristos keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT 971.24Schristos keep["SCIOC_USE_ADF"] = 1; # Same as STICIO_STARTQ 981.24Schristos keep["SCBUSIOLLSCAN"] = 1; # Same as USB_DISCOVER 991.26Schristos keep["OPIOCGETNEXT"] = 1; # Same as OFIOCGETNEXT 1001.26Schristos keep["OPIOCGET"] = 1; # Same as OFIOCGET 1011.26Schristos keep["OPIOCGETCHILD"] = 1; # Same as OFIOCGETCHILD 1021.26Schristos keep["OPIOCFINDDEVICE"] = 1; # Same as OFIOCFINDDEVICE 1031.26Schristos keep["OPIOCGETOPTNODE"] = 1; # Same as OFIOCGETOPTNODE 1041.26Schristos keep["OPIOCNEXTPROP"] = 1; # Same as OFIOCNEXTPROP 1051.26Schristos keep["OPIOCSET"] = 1; # Same as OFIOCSET 1061.27She keep["MBPPIOCSPARAM"] = 1; # Same as PARIOCSPARAM 1071.27She keep["MBPPIOCGPARAM"] = 1; # Same as PARIOCGPARAM 1081.28She keep["CLOCKCTL_ADJTIME"] = 1; # Same as TCTRL_MODEM_PWR 1091.24Schristos 1101.24Schristos i = 1; 1111.24Schristos altqt[i++] = "RED"; 1121.24Schristos altqt[i++] = "BLUE"; 1131.24Schristos altqt[i++] = "RIO"; 1141.24Schristos altqt[i++] = "FIFOQ"; 1151.24Schristos altqt[i++] = "HFSC"; 1161.24Schristos altqt[i++] = "PRIQ"; 1171.24Schristos altqt[i++] = "WFQ"; 1181.24Schristos altqt[i++] = "CBQ"; 1191.24Schristos altqt[i++] = "CNDR"; 1201.24Schristos 1211.24Schristos i = 1; 1221.24Schristos altqf[i++] = "IF_ATTACH"; 1231.24Schristos altqf[i++] = "DISABLE"; 1241.24Schristos altqf[i++] = "ENABLE"; 1251.24Schristos altqf[i++] = "CONFIG"; 1261.24Schristos altqf[i++] = "GETSTATS"; 1271.24Schristos altqf[i++] = "IF_DETACH"; 1281.24Schristos altqf[i++] = "ADD_CLASS"; 1291.24Schristos altqf[i++] = "DEL_CLASS"; 1301.24Schristos altqf[i++] = "MOD_CLASS"; 1311.24Schristos altqf[i++] = "ADD_FILTER"; 1321.24Schristos altqf[i++] = "DEL_FILTER"; 1331.24Schristos altqf[i++] = "CLEAR_HIERARCHY"; 1341.24Schristos 1351.24Schristos for (t in altqt) { 1361.24Schristos for (f in altqf) { 1371.24Schristos keep[altqt[t] "_" altqf[f]] = 1; 1381.24Schristos } 1391.24Schristos } 1401.16Schristos 1411.10Slukem print "" 1421.21Schristos print "#include \"ktrace.h\"" 1431.1Scgd print "" 1441.21Schristos print "const char *" 1451.21Schristos print "ioctlname(u_long val)" 1461.1Scgd print "{" 1471.1Scgd print "" 1481.16Schristos print "\tswitch (val) {\n" 1491.1Scgd} 1501.1Scgd 1511.24Schristos/^#[ ]*define[ ]*[A-Z_]*[ ]*_IO[W]*[R]*[ ]*\(/ { 1521.1Scgd 1531.1Scgd # find where the name starts 1541.1Scgd for (i = 1; i <= NF; i++) 1551.1Scgd if ($i ~ /define/) 1561.1Scgd break; 1571.1Scgd ++i; 1581.19Schristos printf("/* %s [%s] */\n", $0, $i); 1591.1Scgd # 1601.19Schristos if ($i ~ /^[A-Z0-9a-z_]*$/) { 1611.19Schristos if (keep[$i] != 1) { 1621.19Schristos printf("\tcase %s:\n\t\treturn \"%s\";\n", $i, $i); 1631.19Schristos keep[$i] = 1; 1641.19Schristos } 1651.16Schristos } 1661.1Scgd} 1671.1ScgdEND { 1681.16Schristos print "\tdefault:\n\t\treturn NULL;\n" 1691.16Schristos print "\t}\n" 1701.1Scgd print "}" 1711.1Scgd} 1721.5Smycroft' 173