summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-11-26 13:45:18 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-11-26 13:45:18 +0000
commitb06b09a95f519addb55ccbc49df2f7f8f893c3e9 (patch)
tree9cdd560dec1f55fcd35a402ccc8e4e1a5e625249
parentb2e917cea26fe004a0e30ea2c0e4fa8f63983200 (diff)
parse all the usefull files in sys for ioctls, change if() return to a switch(), makes it much smaller on most architectures
-rw-r--r--usr.bin/kdump/Makefile17
-rw-r--r--usr.bin/kdump/mkioctls37
2 files changed, 35 insertions, 19 deletions
diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile
index 4c5c77505de..1cd0f8658d2 100644
--- a/usr.bin/kdump/Makefile
+++ b/usr.bin/kdump/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 2002/10/17 15:14:57 jason Exp $
+# $OpenBSD: Makefile,v 1.5 2002/11/26 13:45:17 mickey Exp $
LDSTATIC=${STATIC}
PROG= kdump
@@ -10,6 +10,19 @@ CLEANFILES+=ioctl.c
ioctl.c: mkioctls
/bin/sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include/sys/ioctl.h \
${DESTDIR}/usr/include/sys/ioctl_compat.h \
- ${DESTDIR}/usr/include/sys/audioio.h > ioctl.c
+ ${DESTDIR}/usr/include/dev/wscons/wsconsio.h \
+ ${DESTDIR}/usr/include/sys/ataio.h \
+ ${DESTDIR}/usr/include/sys/audioio.h \
+ ${DESTDIR}/usr/include/sys/cdio.h \
+ ${DESTDIR}/usr/include/sys/chio.h \
+ ${DESTDIR}/usr/include/sys/dkio.h \
+ ${DESTDIR}/usr/include/sys/filio.h \
+ ${DESTDIR}/usr/include/sys/midiio.h \
+ ${DESTDIR}/usr/include/sys/mtio.h \
+ ${DESTDIR}/usr/include/sys/pciio.h \
+ ${DESTDIR}/usr/include/sys/radioio.h \
+ ${DESTDIR}/usr/include/sys/scanio.h \
+ ${DESTDIR}/usr/include/sys/scsiio.h \
+ ${DESTDIR}/usr/include/sys/sockio.h > ioctl.c
.include <bsd.prog.mk>
diff --git a/usr.bin/kdump/mkioctls b/usr.bin/kdump/mkioctls
index 6e5bed1f13f..e0e7efab353 100644
--- a/usr.bin/kdump/mkioctls
+++ b/usr.bin/kdump/mkioctls
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: mkioctls,v 1.7 2002/10/17 15:14:57 jason Exp $
+# $OpenBSD: mkioctls,v 1.8 2002/11/26 13:45:17 mickey Exp $
#
# Copyright (c) 1994
@@ -49,7 +49,20 @@ BEGIN {
print "#include <sys/termios.h>"
print "#include <netinet/ip_ipsp.h>"
print "#include <net/if_enc.h>"
+ print "#include <sys/disklabel.h>"
+ print "#include <sys/ataio.h>"
print "#include <sys/audioio.h>"
+ print "#include <sys/cdio.h>"
+ print "#include <sys/chio.h>"
+ print "#include <sys/dkio.h>"
+ print "#include <sys/filio.h>"
+ print "#include <sys/midiio.h>"
+ print "#include <sys/mtio.h>"
+ print "#include <sys/pciio.h>"
+ print "#include <sys/radioio.h>"
+ print "#include <sys/scanio.h>"
+ print "#include <sys/scsiio.h>"
+ print "#include <dev/wscons/wsconsio.h>"
print "#define COMPAT_43"
print "#include <sys/ioctl.h>"
print ""
@@ -57,34 +70,24 @@ BEGIN {
print "ioctlname(val)"
print "\tunsigned long val;"
print "{"
+ print "\tswitch (val) {"
print ""
}
-/^#[ ]*define[ ]*(TIO|FIO|SIO|OSIO)[A-Z]*[ ]*_IO/ {
+/^#[ ]*define[ ]*(ATAIO|AUDIO_|CDIO|CHIO|DIOC|MIDI_|SEQUENCER_|TIO|FIO|FIBMAP|MTIOC|SIO|OSIO|PCIOC|RIOC|SCIOC|OSCIOC|WSKBD|WSMOUSE|WSDISPLAY|WSMUX)[A-Z]*[ ]*_IO/ {
# find where the name starts
for (i = 1; i <= NF; i++)
if ($i ~ /define/)
break;
++i;
- #
- printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i);
-
-}
-
-/^#[ ]*define[ ]*(AUDIO_)[A-Z]*[ ]*_IO/ {
-
- # find where the name starts
- for (i = 1; i <= NF; i++)
- if ($i ~ /define/)
- break;
- ++i;
- #
- printf("\tif (val == %s)\n\t\treturn (\"%s\");\n", $i, $i);
+ ioc[$i] = 0;
}
END {
- print "\n\treturn (NULL);"
+ for(i in ioc)
+ printf("\tcase %s:\t\treturn (\"%s\");\n", i, i);
+ print "\tdefault:\t\treturn (NULL);\n\t}"
print "}"
}
'