178 lines
6.1 KiB
Bash
178 lines
6.1 KiB
Bash
#!/bin/sh
|
|
# $NetBSD: mkioctls,v 1.32 2007/03/05 17:38:25 he Exp $
|
|
#
|
|
# Copyright (c) 1994
|
|
# The Regents of the University of California. All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
# must display the following acknowledgement:
|
|
# This product includes software developed by the University of
|
|
# California, Berkeley and its contributors.
|
|
# 4. Neither the name of the University nor the names of its contributors
|
|
# may be used to endorse or promote products derived from this software
|
|
# without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
#
|
|
# @(#)mkioctls 8.2 (Berkeley) 4/28/95
|
|
#
|
|
echo "/* Automatically generated file, do not edit! */"
|
|
#echo "#define const" # XXX: timepps lossage
|
|
echo "#define COMPAT_43"
|
|
echo "struct lwp;"
|
|
echo "struct crap { int _xxx; };" # XXX arm video lossage
|
|
echo "typedef struct crap videomemory_t;" # XXX arm video lossage
|
|
echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
|
|
echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
|
|
echo "#include <stdio.h>"
|
|
echo "#include <sys/types.h>"
|
|
echo "#include <sys/param.h>"
|
|
echo "#ifndef NBPG"
|
|
echo "#define NBPG 4096 /* workaround / dummy for sparc */"
|
|
echo "#endif /* NBPG */"
|
|
echo "#include <sys/disk.h>"
|
|
echo "#include <sys/dkbad.h>"
|
|
echo "#include <sys/mount.h>"
|
|
echo "#include <sys/termios.h>"
|
|
echo "#include <sys/disklabel.h>"
|
|
echo "#include <sys/device.h>"
|
|
echo "#include <net/if.h>"
|
|
echo "#include <net/if_ether.h>"
|
|
echo "#include <net/route.h>"
|
|
echo "#include <net/ppp_defs.h>"
|
|
echo "#include <netinet/in.h>"
|
|
echo "#include <netinet/in_systm.h>"
|
|
echo "#include <netinet/ip.h>"
|
|
echo "#include <netinet/ip_mroute.h>"
|
|
echo "#include <netinet/ip_compat.h>"
|
|
echo "#include <net80211/ieee80211.h>"
|
|
echo "#include <net80211/ieee80211_radiotap.h>"
|
|
echo "#include <netinet6/in6_var.h>"
|
|
echo "#include <netinet6/nd6.h>"
|
|
echo "#include <netiso/iso.h>"
|
|
echo "#include <dev/ic/hd44780reg.h>"
|
|
echo "#include <dev/pci/mlyreg.h>"
|
|
echo "#include <prop/proplib.h>"
|
|
for i
|
|
do
|
|
echo "#include <$i>"
|
|
done | sed -e "s,${DESTDIR}/usr/include/,,g"
|
|
|
|
${CC:-cc} -E -nostdinc -idirafter $DESTDIR/usr/include -dM ${1+"$@"} | awk '
|
|
BEGIN {
|
|
keep["SLIOCGUNIT"] = 1; # Same as PPPIOCGASYNCMAP
|
|
keep["TUNSLMODE"] = 1; # Same as PPPIOCGASYNCMAP
|
|
keep["SIOCRMNAT"] = 1; # Same as SIOCRMAFR
|
|
keep["SIOCADNAT"] = 1; # Same as SIOCADAFR
|
|
keep["SIOCDELST"] = 1; # Same as SIOCRMNAT
|
|
keep["SIOCPROXY"] = 1; # Same as SIOCLOOKUPSTAT
|
|
keep["CHIOGPICKER"] = 1; # Same as CDIOREADTOCHEADER
|
|
keep["KBDSTPMAT"] = 1; # Same as LMREADY, pcvt is gone so ok.
|
|
keep["SIOCSLOWAT"] = 1; # Same as SATIOSBUFSIZE
|
|
keep["UTOPPYIOTURBO"] = 1; # Same as OTIOCSETD
|
|
keep["TIOCHPCL"] = 1; # Same as UTOPPYIOCANCEL
|
|
keep["TIOCCBRK"] = 1; # Same as CONSOLE_X_MODE_OFF
|
|
keep["TIOCSDTR"] = 1; # Same as CONSOLE_X_MODE_ON
|
|
keep["APM_IOC_SUSPEND"] = 1; # Same as AGPIOC_RELEASE
|
|
keep["APM_IOC_STANDBY"] = 1; # Same as AGPIOC_ACQUIRE
|
|
keep["BTDEV_GETINFO"] = 1; # Same as BTSCO_GETINFO
|
|
keep["BTHSET_GETINFO"] = 1; # Same as BTSCO_GETINFO
|
|
keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
|
|
keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
|
|
keep["SCIOC_USE_ADF"] = 1; # Same as STICIO_STARTQ
|
|
keep["SCBUSIOLLSCAN"] = 1; # Same as USB_DISCOVER
|
|
keep["OPIOCGETNEXT"] = 1; # Same as OFIOCGETNEXT
|
|
keep["OPIOCGET"] = 1; # Same as OFIOCGET
|
|
keep["OPIOCGETCHILD"] = 1; # Same as OFIOCGETCHILD
|
|
keep["OPIOCFINDDEVICE"] = 1; # Same as OFIOCFINDDEVICE
|
|
keep["OPIOCGETOPTNODE"] = 1; # Same as OFIOCGETOPTNODE
|
|
keep["OPIOCNEXTPROP"] = 1; # Same as OFIOCNEXTPROP
|
|
keep["OPIOCSET"] = 1; # Same as OFIOCSET
|
|
keep["MBPPIOCSPARAM"] = 1; # Same as PARIOCSPARAM
|
|
keep["MBPPIOCGPARAM"] = 1; # Same as PARIOCGPARAM
|
|
keep["CLOCKCTL_ADJTIME"] = 1; # Same as TCTRL_MODEM_PWR
|
|
keep["OFIOCNEXTPROP"] = 1; # Same as PNVIOCGETNUMGE
|
|
keep["OFIOCGET"] = 1; # Same as PNVIOCGET
|
|
|
|
i = 1;
|
|
altqt[i++] = "RED";
|
|
altqt[i++] = "BLUE";
|
|
altqt[i++] = "RIO";
|
|
altqt[i++] = "FIFOQ";
|
|
altqt[i++] = "HFSC";
|
|
altqt[i++] = "PRIQ";
|
|
altqt[i++] = "WFQ";
|
|
altqt[i++] = "CBQ";
|
|
altqt[i++] = "CNDR";
|
|
|
|
i = 1;
|
|
altqf[i++] = "IF_ATTACH";
|
|
altqf[i++] = "DISABLE";
|
|
altqf[i++] = "ENABLE";
|
|
altqf[i++] = "CONFIG";
|
|
altqf[i++] = "GETSTATS";
|
|
altqf[i++] = "IF_DETACH";
|
|
altqf[i++] = "ADD_CLASS";
|
|
altqf[i++] = "DEL_CLASS";
|
|
altqf[i++] = "MOD_CLASS";
|
|
altqf[i++] = "ADD_FILTER";
|
|
altqf[i++] = "DEL_FILTER";
|
|
altqf[i++] = "CLEAR_HIERARCHY";
|
|
|
|
for (t in altqt) {
|
|
for (f in altqf) {
|
|
keep[altqt[t] "_" altqf[f]] = 1;
|
|
}
|
|
}
|
|
|
|
print ""
|
|
print "#include \"ktrace.h\""
|
|
print ""
|
|
print "const char *"
|
|
print "ioctlname(u_long val)"
|
|
print "{"
|
|
print ""
|
|
print "\tswitch (val) {\n"
|
|
}
|
|
|
|
/^#[ ]*define[ ]*[A-Z_]*[ ]*_IO[W]*[R]*[ ]*\(/ {
|
|
|
|
# find where the name starts
|
|
for (i = 1; i <= NF; i++)
|
|
if ($i ~ /define/)
|
|
break;
|
|
++i;
|
|
printf("/* %s [%s] */\n", $0, $i);
|
|
#
|
|
if ($i ~ /^[A-Z0-9a-z_]*$/) {
|
|
if (keep[$i] != 1) {
|
|
printf("\tcase %s:\n\t\treturn \"%s\";\n", $i, $i);
|
|
keep[$i] = 1;
|
|
}
|
|
}
|
|
}
|
|
END {
|
|
print "\tdefault:\n\t\treturn NULL;\n"
|
|
print "\t}\n"
|
|
print "}"
|
|
}
|
|
'
|