On Tue, 26 Apr 2016 15:31:51 +0200, Silvan Jegen said: > A simple but naive approach would be a grep command like this. > > grep "function_pointer =" `find . -iname '*.c' -o -iname '*.h'`
Two better ways:
grep -r "function_pointer =' [A-Za-z]*
find * -name '*.[ch]' | xargs grep 'function pointer ='
Hint 1: Globbing * rather than . is a win at the top level of the
kernel source, because * won't match .git, which is a gigabyte or so
of stuff that you don't want to grep through
Hint 2: You want -name rather than -iname because there shouldn't be any
*.C or *.H files in the tree, and avoiding case-insensitive matches is a bit
faster.
And another winner if you have a git tree (which of course you should):
git grep 'function_pointer ='
One gotcha is that in some places, the kernel does evil pre-processor
stuff like:
#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
#define ATOMIC_LONG_PFX(x) atomic ## x
#endif
#define ATOMIC_LONG_READ_OP(mo) static
inline long atomic_long_read##mo(const atomic_long_t *l) {
ATOMIC_LONG_PFX(_t) *v = (ATOMIC_LONG_PFX(_t) *)l;
return
(long)ATOMIC_LONG_PFX(_read##mo)(v); }
ATOMIC_LONG_READ_OP()
ATOMIC_LONG_READ_OP(_acquire)
(this example from include/asm-generic/atomic-long.h, but similar ## abuse
happens elsewhere as well...)
pgpsiSWGQqzKT.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
