Home | History | Annotate | Line # | Download | only in kdump
mkioctls revision 1.31
      1  1.14  christos #!/bin/sh
      2  1.31      elad #	$NetBSD: mkioctls,v 1.31 2006/11/30 01:59:45 elad Exp $
      3   1.7       jtc #
      4   1.7       jtc # Copyright (c) 1994
      5   1.7       jtc #	The Regents of the University of California.  All rights reserved.
      6   1.7       jtc #
      7   1.7       jtc # Redistribution and use in source and binary forms, with or without
      8   1.7       jtc # modification, are permitted provided that the following conditions
      9   1.7       jtc # are met:
     10   1.7       jtc # 1. Redistributions of source code must retain the above copyright
     11   1.7       jtc #    notice, this list of conditions and the following disclaimer.
     12   1.7       jtc # 2. Redistributions in binary form must reproduce the above copyright
     13   1.7       jtc #    notice, this list of conditions and the following disclaimer in the
     14   1.7       jtc #    documentation and/or other materials provided with the distribution.
     15   1.7       jtc # 3. All advertising materials mentioning features or use of this software
     16   1.7       jtc #    must display the following acknowledgement:
     17   1.7       jtc #	This product includes software developed by the University of
     18   1.7       jtc #	California, Berkeley and its contributors.
     19   1.7       jtc # 4. Neither the name of the University nor the names of its contributors
     20   1.7       jtc #    may be used to endorse or promote products derived from this software
     21   1.7       jtc #    without specific prior written permission.
     22   1.7       jtc #
     23   1.7       jtc # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.7       jtc # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.7       jtc # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.7       jtc # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.7       jtc # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.7       jtc # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.7       jtc # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.7       jtc # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.7       jtc # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.7       jtc # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.7       jtc # SUCH DAMAGE.
     34   1.7       jtc #
     35   1.7       jtc #	@(#)mkioctls	8.2 (Berkeley) 4/28/95
     36   1.3   mycroft #
     37  1.16  christos echo "/* Automatically generated file, do not edit! */"
     38  1.21  christos #echo "#define const" 	# XXX: timepps lossage
     39  1.14  christos echo "#define COMPAT_43"
     40  1.14  christos echo "struct lwp;"
     41  1.24  christos echo "struct crap { int _xxx; };" # XXX arm video lossage
     42  1.24  christos echo "typedef struct crap videomemory_t;" # XXX arm video lossage
     43  1.24  christos echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage
     44  1.24  christos echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage
     45  1.24  christos echo "#include <stdio.h>"
     46  1.14  christos echo "#include <sys/types.h>"
     47  1.14  christos echo "#include <sys/param.h>"
     48  1.29        he echo "#ifndef NBPG"
     49  1.29        he echo "#define NBPG 4096 /* workaround / dummy for sparc */"
     50  1.29        he echo "#endif /* NBPG */"
     51  1.14  christos echo "#include <sys/disk.h>"
     52  1.17   hannken echo "#include <sys/dkbad.h>"
     53  1.14  christos echo "#include <sys/mount.h>"
     54  1.14  christos echo "#include <sys/termios.h>"
     55  1.16  christos echo "#include <sys/disklabel.h>"
     56  1.25  christos echo "#include <sys/device.h>"
     57  1.14  christos echo "#include <net/if.h>"
     58  1.24  christos echo "#include <net/if_ether.h>"
     59  1.14  christos echo "#include <net/route.h>"
     60  1.14  christos echo "#include <net/ppp_defs.h>"
     61  1.14  christos echo "#include <netinet/in.h>"
     62  1.14  christos echo "#include <netinet/in_systm.h>"
     63  1.14  christos echo "#include <netinet/ip.h>"
     64  1.14  christos echo "#include <netinet/ip_mroute.h>"
     65  1.14  christos echo "#include <netinet/ip_compat.h>"
     66  1.14  christos echo "#include <net80211/ieee80211.h>"
     67  1.24  christos echo "#include <net80211/ieee80211_radiotap.h>"
     68  1.24  christos echo "#include <netinet6/in6_var.h>"
     69  1.24  christos echo "#include <netinet6/nd6.h>"
     70  1.14  christos echo "#include <netiso/iso.h>"
     71  1.24  christos echo "#include <dev/ic/hd44780reg.h>"
     72  1.24  christos echo "#include <dev/pci/mlyreg.h>"
     73  1.24  christos echo "#include <prop/proplib.h>"
     74  1.14  christos for i
     75  1.14  christos do
     76  1.14  christos 	echo "#include <$i>"
     77  1.14  christos done | sed -e "s,${DESTDIR}/usr/include/,,g"
     78  1.14  christos 
     79  1.18  drochner ${CC:-cc} -E -nostdinc -idirafter $DESTDIR/usr/include -dM ${1+"$@"} | awk '
     80   1.1       cgd BEGIN {
     81  1.17   hannken 	keep["SLIOCGUNIT"] = 1;	# Same as PPPIOCGASYNCMAP
     82  1.19  christos 	keep["TUNSLMODE"] = 1;	# Same as PPPIOCGASYNCMAP
     83  1.17   hannken 	keep["SIOCRMNAT"] = 1;	# Same as SIOCRMAFR
     84  1.17   hannken 	keep["SIOCADNAT"] = 1;	# Same as SIOCADAFR
     85  1.17   hannken 	keep["SIOCDELST"] = 1;	# Same as SIOCRMNAT
     86  1.22  christos 	keep["SIOCPROXY"] = 1; # Same as SIOCLOOKUPSTAT
     87  1.17   hannken 	keep["CHIOGPICKER"] = 1; # Same as CDIOREADTOCHEADER
     88  1.20  christos 	keep["KBDSTPMAT"] = 1;	# Same as LMREADY, pcvt is gone so ok.
     89  1.24  christos 	keep["SIOCSLOWAT"] = 1;	# Same as SATIOSBUFSIZE
     90  1.24  christos 	keep["UTOPPYIOTURBO"] = 1; # Same as OTIOCSETD
     91  1.24  christos 	keep["TIOCHPCL"] = 1; # Same as UTOPPYIOCANCEL
     92  1.24  christos 	keep["TIOCCBRK"] = 1; # Same as CONSOLE_X_MODE_OFF
     93  1.24  christos 	keep["TIOCSDTR"] = 1; # Same as CONSOLE_X_MODE_ON
     94  1.24  christos 	keep["APM_IOC_SUSPEND"] = 1; # Same as AGPIOC_RELEASE
     95  1.24  christos 	keep["APM_IOC_STANDBY"] = 1; # Same as AGPIOC_ACQUIRE
     96  1.24  christos 	keep["BTDEV_GETINFO"] = 1; # Same as BTSCO_GETINFO
     97  1.24  christos 	keep["BTHSET_GETINFO"] = 1; # Same as BTSCO_GETINFO
     98  1.24  christos 	keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
     99  1.24  christos 	keep["JOY_GET_X_OFFSET"] = 1; # Same as GDT_IOCTL_CTRCNT
    100  1.24  christos 	keep["SCIOC_USE_ADF"] = 1; # Same as STICIO_STARTQ
    101  1.24  christos 	keep["SCBUSIOLLSCAN"] = 1; # Same as USB_DISCOVER
    102  1.26  christos 	keep["OPIOCGETNEXT"] = 1; # Same as OFIOCGETNEXT
    103  1.26  christos 	keep["OPIOCGET"] = 1; # Same as OFIOCGET
    104  1.26  christos 	keep["OPIOCGETCHILD"] = 1; # Same as OFIOCGETCHILD
    105  1.26  christos 	keep["OPIOCFINDDEVICE"] = 1; # Same as OFIOCFINDDEVICE
    106  1.26  christos 	keep["OPIOCGETOPTNODE"] = 1; # Same as OFIOCGETOPTNODE
    107  1.26  christos 	keep["OPIOCNEXTPROP"] = 1; # Same as OFIOCNEXTPROP
    108  1.26  christos 	keep["OPIOCSET"] = 1; # Same as OFIOCSET
    109  1.27        he 	keep["MBPPIOCSPARAM"] = 1; # Same as PARIOCSPARAM
    110  1.27        he 	keep["MBPPIOCGPARAM"] = 1; # Same as PARIOCGPARAM
    111  1.28        he 	keep["CLOCKCTL_ADJTIME"] = 1; # Same as TCTRL_MODEM_PWR
    112  1.24  christos 
    113  1.24  christos 	i = 1;
    114  1.24  christos 	altqt[i++] = "RED";
    115  1.24  christos 	altqt[i++] = "BLUE";
    116  1.24  christos 	altqt[i++] = "RIO";
    117  1.24  christos 	altqt[i++] = "FIFOQ";
    118  1.24  christos 	altqt[i++] = "HFSC";
    119  1.24  christos 	altqt[i++] = "PRIQ";
    120  1.24  christos 	altqt[i++] = "WFQ";
    121  1.24  christos 	altqt[i++] = "CBQ";
    122  1.24  christos 	altqt[i++] = "CNDR";
    123  1.24  christos 
    124  1.24  christos 	i = 1;
    125  1.24  christos 	altqf[i++] = "IF_ATTACH";
    126  1.24  christos 	altqf[i++] = "DISABLE";
    127  1.24  christos 	altqf[i++] = "ENABLE";
    128  1.24  christos 	altqf[i++] = "CONFIG";
    129  1.24  christos 	altqf[i++] = "GETSTATS";
    130  1.24  christos 	altqf[i++] = "IF_DETACH";
    131  1.24  christos 	altqf[i++] = "ADD_CLASS";
    132  1.24  christos 	altqf[i++] = "DEL_CLASS";
    133  1.24  christos 	altqf[i++] = "MOD_CLASS";
    134  1.24  christos 	altqf[i++] = "ADD_FILTER";
    135  1.24  christos 	altqf[i++] = "DEL_FILTER";
    136  1.24  christos 	altqf[i++] = "CLEAR_HIERARCHY";
    137  1.24  christos 
    138  1.24  christos 	for (t in altqt) {
    139  1.24  christos 		for (f in altqf) {
    140  1.24  christos 			keep[altqt[t] "_" altqf[f]] = 1;
    141  1.24  christos 		}
    142  1.24  christos 	}
    143  1.16  christos 
    144  1.10     lukem 	print ""
    145  1.21  christos 	print "#include \"ktrace.h\""
    146   1.1       cgd 	print ""
    147  1.21  christos 	print "const char *"
    148  1.21  christos 	print "ioctlname(u_long val)"
    149   1.1       cgd 	print "{"
    150   1.1       cgd 	print ""
    151  1.16  christos 	print "\tswitch (val) {\n"
    152   1.1       cgd }
    153   1.1       cgd 
    154  1.24  christos /^#[ 	]*define[ 	]*[A-Z_]*[ 	]*_IO[W]*[R]*[ 	]*\(/ {
    155   1.1       cgd 	
    156   1.1       cgd 	# find where the name starts
    157   1.1       cgd 	for (i = 1; i <= NF; i++)
    158   1.1       cgd 		if ($i ~ /define/)
    159   1.1       cgd 			break;
    160   1.1       cgd 	++i;
    161  1.19  christos 	printf("/* %s [%s] */\n", $0, $i);
    162   1.1       cgd 	# 
    163  1.19  christos 	if ($i ~ /^[A-Z0-9a-z_]*$/) {
    164  1.19  christos 		if (keep[$i] != 1) {
    165  1.19  christos 			printf("\tcase %s:\n\t\treturn \"%s\";\n", $i, $i);
    166  1.19  christos 			keep[$i] = 1;
    167  1.19  christos 		}
    168  1.16  christos 	}
    169   1.1       cgd }
    170   1.1       cgd END {
    171  1.16  christos 	print "\tdefault:\n\t\treturn NULL;\n"
    172  1.16  christos 	print "\t}\n"
    173   1.1       cgd 	print "}"
    174   1.1       cgd }
    175   1.5   mycroft '
    176