[PATCH 1/2] Add support for finding DRM ioctls to linux/ioctlent.sh

Ole Henrik Jahren olehenja at alumni.ntnu.no
Tue Apr 12 03:54:47 UTC 2011


---

The whole DRM interface is pretty much all about ioctls. Decoding them
mentally gets boring fast. So this will probably also make other people
happy.

-ohj

 linux/ioctlent.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/linux/ioctlent.sh b/linux/ioctlent.sh
index 65b005d..8b83c0e 100755
--- a/linux/ioctlent.sh
+++ b/linux/ioctlent.sh
@@ -82,7 +82,7 @@ if [ -e $dir/Kbuild ]; then
 		echo "$asm/* asm-generic/*"
 	)
 	# special case: some headers aren't exported directly
-	files="${files} media/* net/bluetooth/* pcmcia/*"
+	files="${files} media/* net/bluetooth/* pcmcia/* drm/*"
 else
 	# older kernel so just assume some headers
 	files="linux/* $asm/* asm-generic/* scsi/* sound/*"
@@ -92,10 +92,11 @@ fi
 # Example output:
 # { "asm/ioctls.h",	"TIOCSWINSZ",	0x5414  },
 # { "asm/mce.h",	"MCE_GETCLEAR_FLAGS",	_IOC(_IOC_NONE,'M',3,0) },
-regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+_S\?\(IO\|IOW\|IOR\|IOWR\)\>'
+regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+\(DRM_\|_S\|_\)\(IO\|IOW\|IOR\|IOWR\)\>'
 (cd $dir && grep $regexp $files 2>/dev/null) | \
 	sed -n \
 	-e "s,$asm/,asm/,g" \
+	-e 's/^\(.*\):[[:space:]]*#[[:space:]]*define[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*DRM_I.*(\([^[,]*\)[[:space:]]*,.*/	{ "\1",	"\2",	_IOC(_IOC_NONE,DRM_IOCTL_BASE,\3,0)	},/p' \
 	-e 's/^\(.*\):[[:space:]]*#[[:space:]]*define[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*_S\?I.*(\([^[,]*\)[[:space:]]*,[[:space:]]*\([^,)]*\).*/	{ "\1",	"\2",	_IOC(_IOC_NONE,\3,\4,0)	},/p' \
 	>> ioctls.h
 
@@ -109,6 +110,7 @@ regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\
 # Some use a special base to offset their ioctls on. Extract that as well.
 # Some use 2 defines: _IOC(_IOC_NONE,DM_IOCTL,DM_LIST_DEVICES_CMD,....)
 bases=$(sed -n \
+       -e 's/.*\(DRM_[A-Z0-9_]*_BASE\)[[:space:]]\{1,\}+[[:space:]]\{1,\}\(DRM\_\(I810\|I830\|I915\|MGA\|NOUVEAU\|R128\|RADEON\|SAVAGE\|SIS\|VIA\)_[A-Z0-9_]*\).*/\1\n\2/p' \
        -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z][A-Z0-9_]\+\)[[:space:]]*,[[:space:]]*\([A-Z][A-Z0-9_]\+\)[[:space:]+,].*/\1\n\2/p' \
        -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z][A-Z0-9_]\+\)[[:space:]+,].*/\1/p' \
        ioctls.h | sort -u)
-- 
1.7.5.rc1





More information about the Strace-devel mailing list