Wichert Akkerman | a966785 | 2001-03-17 17:26:34 +0000 | [diff] [blame] | 1 | #! /bin/sh |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2 | |
Wichert Akkerman | a966785 | 2001-03-17 17:26:34 +0000 | [diff] [blame] | 3 | files="linux/* asm/* scsi/*" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 4 | |
Wichert Akkerman | a966785 | 2001-03-17 17:26:34 +0000 | [diff] [blame] | 5 | # Build the list of all ioctls |
| 6 | regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+_\(IO\|IOW\|IOR\|IOWR\)\>' |
| 7 | grep $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 Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 10 | |
Wichert Akkerman | a966785 | 2001-03-17 17:26:34 +0000 | [diff] [blame] | 11 | # Some use a special base to offset their ioctls on. Extract that as well. |
| 12 | : > ioctldefs.h |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 13 | |
Wichert Akkerman | a966785 | 2001-03-17 17:26:34 +0000 | [diff] [blame] | 14 | bases=$(sed -ne 's/.*_IOC_NONE,\([A-Z][A-Z0-9_]\+\),.*/\1/p' ioctls.h | uniq | sort) |
| 15 | for 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 |
| 19 | done |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 20 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 21 | |