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

Dmitry V. Levin ldv at altlinux.org
Fri Jan 16 20:31:42 UTC 2015


On Fri, Jan 16, 2015 at 09:05:56PM +0100, Gabriel Laskar wrote:
> 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.

Please rebase to current HEAD, I've just pushed there two ioctlent.sh
cleanup commits.

btw, there is a lookup regexp that could be used to handle drm/*drm.h,
linux/hsi/hsi_char.h, and linux/omapfb.h simultaneously:
^[[:space:]]*#[[:space:]]*define[[:space:]]\+\([A-Z][A-Z0-9_]*\)[[:space:]]\+\([A-Z]\+\)_\(IO\|IOW\|IOR\|IOWR\)[[:space:]]*(\([^,()]*\)[[:space:]]*[,)]



-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150116/f38ba754/attachment.bin>


More information about the Strace-devel mailing list