3 # this program is used to find source code that includes linux kernel headers directly
4 # (e.g. with #include <linux/...> or #include <asm/...>)
8 import sys, cpp, glob, os, re, getopt
11 from defaults import *
16 usage: find_users.py [-v] (file|directory|@listfile)+
18 this program is used to scan a list of files or directories for
19 sources that include kernel headers directly. the program prints
20 the list of said source files when it's done.
22 when scanning directories, only files matching the following
23 extension will be searched: .c .cpp .S .h
25 use -v to enable verbose output
31 optlist, args = getopt.getopt( sys.argv[1:], 'v' )
34 print "error: unrecognized option"
37 for opt, arg in optlist:
39 kernel.verboseSearch = 1
40 kernel.verboseFind = 1
47 # helper function used to walk the user files
48 def parse_file(path, parser):
49 parser.parseFile(path)
52 # first, obtain the list of kernel files used by our clients
53 # avoid parsing the 'kernel_headers' directory itself since we
54 # use this program with the Android source tree by default.
56 fparser = kernel.HeaderScanner()
57 walk_source_files( args, parse_file, fparser, excludes=["kernel_headers","original"] )
58 files = fparser.getFiles()
60 for f in sorted(files):