[PATCH 1/5] Add parsing support for named ioctls APIs

Gabriel Laskar gabriel at lse.epita.fr
Fri Jan 16 20:05:56 UTC 2015


On Fri, Jan 16, 2015 at 8:31 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Thu, Jan 15, 2015 at 08:32:26PM +0100, Gabriel Laskar wrote:
> [...]
>> --- a/linux/ioctlent.sh
>> +++ b/linux/ioctlent.sh
>> @@ -94,6 +94,21 @@ regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\
>>       -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
>>
>> +lookup_named_ioctls() {
>> +     api_name=$1
>> +
>> +     regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*\(([a-z,]*)\)\?[[:space:]]\+'$api_name'_\(IOR\|IOW\|IO\|IOWR\)[[:space:]]*'
>> +     (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:]]*'$api_name'_IO.*(\([^[,]*\)[[:space:]]*,.*/  { "\1", "\2",   _IOC(_IOC_NONE,DRM_IOCTL_BASE,\3,0)     },/p' \
>> +             >> ioctls.h
>> +}
>> +
>> +lookup_named_ioctls DRM
>> +lookup_named_ioctls OMAP
>> +lookup_named_ioctls HSC
>
> Why DRM_IOCTL_BASE ('d') is applied not only to DRM but also to HSC
> (where its analog is 'k') and OMAP (where its analog is 'O')?

My bad. I have only tested with DRM ioctls, I will do a new version
with the correct output for every one.


-- 
Gabriel Laskar




More information about the Strace-devel mailing list