blob: 8493e239844597a79348ab324b20c004f8e9fa28 [file] [log] [blame]
Wichert Akkermana9667852001-03-17 17:26:34 +00001#! /bin/sh
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00002
Wichert Akkermana9667852001-03-17 17:26:34 +00003files="linux/* asm/* scsi/*"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00004
Wichert Akkermana9667852001-03-17 17:26:34 +00005# Build the list of all ioctls
6regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+_\(IO\|IOW\|IOR\|IOWR\)\>'
7grep $regexp $files 2>/dev/null | \
8 sed -ne 's/^\(.*\):[[:space:]]*#[[:space:]]*define[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*_I.*(\([^[,]*\),\([^,)]*\).*/ { "\1", "\2", _IOC(_IOC_NONE,\3,\4,0) },/p' \
9 > ioctls.h
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000010
Wichert Akkermana9667852001-03-17 17:26:34 +000011# Some use a special base to offset their ioctls on. Extract that as well.
12: > ioctldefs.h
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000013
Wichert Akkermana9667852001-03-17 17:26:34 +000014bases=$(sed -ne 's/.*_IOC_NONE,\([A-Z][A-Z0-9_]\+\),.*/\1/p' ioctls.h | uniq | sort)
15for base in $bases ; do
16 echo "Looking for $base"
17 regexp="^[[:space:]]*#[[:space:]]*define[[:space:]]\+$base"
18 grep -h $regexp 2>/dev/null $files | grep -v '\<_IO' >> ioctldefs.h
19done
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000020
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000021