blob: fb37ae539a3eb100d85f5c5cd15fab952e9564e7 [file] [log] [blame]
Wichert Akkermana9667852001-03-17 17:26:34 +00001#! /bin/sh
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00002
Wichert Akkermanb50c9072001-08-03 21:49:34 +00003dir="/usr/include"
Wichert Akkermana9667852001-03-17 17:26:34 +00004files="linux/* asm/* scsi/*"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00005
Wichert Akkermana9667852001-03-17 17:26:34 +00006# Build the list of all ioctls
Wichert Akkermanb50c9072001-08-03 21:49:34 +00007regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+_S\?\(IO\|IOW\|IOR\|IOWR\)\>'
Wichert Akkerman29f0d052001-03-31 16:14:55 +00008(cd $dir ; grep $regexp $files 2>/dev/null ) | \
Wichert Akkermanb50c9072001-08-03 21:49:34 +00009 sed -ne 's/^\(.*\):[[:space:]]*#[[:space:]]*define[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*_S\?I.*(\([^[,]*\)[[:space:]]*,[[:space:]]*\([^,)]*\).*/ { "\1", "\2", _IOC(_IOC_NONE,\3,\4,0) },/p' \
Wichert Akkermana9667852001-03-17 17:26:34 +000010 > ioctls.h
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000011
Wichert Akkermana9667852001-03-17 17:26:34 +000012# Some use a special base to offset their ioctls on. Extract that as well.
13: > ioctldefs.h
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000014
Wichert Akkermanb50c9072001-08-03 21:49:34 +000015bases=$(sed -ne 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z][A-Z0-9_]\+\)[[:space:]+,].*/\1/p' ioctls.h | uniq | sort)
Wichert Akkermana9667852001-03-17 17:26:34 +000016for base in $bases ; do
17 echo "Looking for $base"
18 regexp="^[[:space:]]*#[[:space:]]*define[[:space:]]\+$base"
Wichert Akkerman29f0d052001-03-31 16:14:55 +000019 (cd $dir ; grep -h $regexp 2>/dev/null $files ) | \
20 grep -v '\<_IO' >> ioctldefs.h
Wichert Akkermana9667852001-03-17 17:26:34 +000021done
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000022
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000023