Using grep first to reduce the files on which pcregrep is run
optimizes considerably the performance of these functions.
If a file doesn't contain the name of a function,
which can easily be checked with grep,
it won't possibly contain the function prototype or definition,
which is much slower to search,
since it implies multiline pcregrep search.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
find * -type f \
|grep '\.c$' \
+ |xargs grep -l "${1}" \
|sort \
|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
find * -type f \
|grep '\.[ch]$' \
+ |xargs grep -l "${1}" \
|sort \
|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
find * -type f \
|grep '\.c$' \
+ |xargs grep -l "${1}" \
|sort \
|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?^}" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
find * -type f \
|grep '\.h$' \
+ |xargs grep -l "${1}" \
|sort \
|xargs pcregrep -Mn \
"(?s)^[\w[][\w\s(,)[:\]]+\s+\**${1}\s*\([\w\s(,)[\]*]+?(...)?\)[\w\s(,)[:\]]*;" \