diff options
Diffstat (limited to 'scripts/basic')
-rw-r--r-- | scripts/basic/Makefile | 8 | ||||
-rw-r--r-- | scripts/basic/docproc.c | 34 |
2 files changed, 22 insertions, 20 deletions
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index 2f60070f9733..4c324a1f1e0e 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile | |||
@@ -1,13 +1,13 @@ | |||
1 | ### | 1 | ### |
2 | # Makefile.basic list the most basic programs used during the build process. | 2 | # Makefile.basic lists the most basic programs used during the build process. |
3 | # The programs listed herein is what is needed to do the basic stuff, | 3 | # The programs listed herein are what are needed to do the basic stuff, |
4 | # such as fix dependency file. | 4 | # such as fix file dependencies. |
5 | # This initial step is needed to avoid files to be recompiled | 5 | # This initial step is needed to avoid files to be recompiled |
6 | # when kernel configuration changes (which is what happens when | 6 | # when kernel configuration changes (which is what happens when |
7 | # .config is included by main Makefile. | 7 | # .config is included by main Makefile. |
8 | # --------------------------------------------------------------------------- | 8 | # --------------------------------------------------------------------------- |
9 | # fixdep: Used to generate dependency information during build process | 9 | # fixdep: Used to generate dependency information during build process |
10 | # docproc: Used in Documentation/docbook | 10 | # docproc: Used in Documentation/DocBook |
11 | 11 | ||
12 | hostprogs-y := fixdep docproc | 12 | hostprogs-y := fixdep docproc |
13 | always := $(hostprogs-y) | 13 | always := $(hostprogs-y) |
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index f4d2f68452ba..e5c6ac7bde9b 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
@@ -10,8 +10,10 @@ | |||
10 | * documentation-frontend | 10 | * documentation-frontend |
11 | * Scans the template file and call kernel-doc for | 11 | * Scans the template file and call kernel-doc for |
12 | * all occurrences of ![EIF]file | 12 | * all occurrences of ![EIF]file |
13 | * Beforehand each referenced file are scanned for | 13 | * Beforehand each referenced file is scanned for |
14 | * any exported sympols "EXPORT_SYMBOL()" statements. | 14 | * any symbols that are exported via these macros: |
15 | * EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), & | ||
16 | * EXPORT_SYMBOL_GPL_FUTURE() | ||
15 | * This is used to create proper -function and | 17 | * This is used to create proper -function and |
16 | * -nofunction arguments in calls to kernel-doc. | 18 | * -nofunction arguments in calls to kernel-doc. |
17 | * Usage: docproc doc file.tmpl | 19 | * Usage: docproc doc file.tmpl |
@@ -73,7 +75,7 @@ void usage (void) | |||
73 | } | 75 | } |
74 | 76 | ||
75 | /* | 77 | /* |
76 | * Execute kernel-doc with parameters givin in svec | 78 | * Execute kernel-doc with parameters given in svec |
77 | */ | 79 | */ |
78 | void exec_kernel_doc(char **svec) | 80 | void exec_kernel_doc(char **svec) |
79 | { | 81 | { |
@@ -82,7 +84,7 @@ void exec_kernel_doc(char **svec) | |||
82 | char real_filename[PATH_MAX + 1]; | 84 | char real_filename[PATH_MAX + 1]; |
83 | /* Make sure output generated so far are flushed */ | 85 | /* Make sure output generated so far are flushed */ |
84 | fflush(stdout); | 86 | fflush(stdout); |
85 | switch(pid=fork()) { | 87 | switch (pid=fork()) { |
86 | case -1: | 88 | case -1: |
87 | perror("fork"); | 89 | perror("fork"); |
88 | exit(1); | 90 | exit(1); |
@@ -133,6 +135,7 @@ struct symfile * add_new_file(char * filename) | |||
133 | symfilelist[symfilecnt++].filename = strdup(filename); | 135 | symfilelist[symfilecnt++].filename = strdup(filename); |
134 | return &symfilelist[symfilecnt - 1]; | 136 | return &symfilelist[symfilecnt - 1]; |
135 | } | 137 | } |
138 | |||
136 | /* Check if file already are present in the list */ | 139 | /* Check if file already are present in the list */ |
137 | struct symfile * filename_exist(char * filename) | 140 | struct symfile * filename_exist(char * filename) |
138 | { | 141 | { |
@@ -156,8 +159,8 @@ void noaction2(char * file, char * line) { file = file; line = line; } | |||
156 | void printline(char * line) { printf("%s", line); } | 159 | void printline(char * line) { printf("%s", line); } |
157 | 160 | ||
158 | /* | 161 | /* |
159 | * Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL | 162 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & |
160 | * in filename. | 163 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). |
161 | * All symbols located are stored in symfilelist. | 164 | * All symbols located are stored in symfilelist. |
162 | */ | 165 | */ |
163 | void find_export_symbols(char * filename) | 166 | void find_export_symbols(char * filename) |
@@ -179,15 +182,15 @@ void find_export_symbols(char * filename) | |||
179 | perror(real_filename); | 182 | perror(real_filename); |
180 | exit(1); | 183 | exit(1); |
181 | } | 184 | } |
182 | while(fgets(line, MAXLINESZ, fp)) { | 185 | while (fgets(line, MAXLINESZ, fp)) { |
183 | char *p; | 186 | char *p; |
184 | char *e; | 187 | char *e; |
185 | if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) || | 188 | if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) || |
186 | ((p = strstr(line, "EXPORT_SYMBOL")) != 0)) { | 189 | ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { |
187 | /* Skip EXPORT_SYMBOL{_GPL} */ | 190 | /* Skip EXPORT_SYMBOL{_GPL} */ |
188 | while (isalnum(*p) || *p == '_') | 191 | while (isalnum(*p) || *p == '_') |
189 | p++; | 192 | p++; |
190 | /* Remove paranteses and additional ws */ | 193 | /* Remove parentheses & additional whitespace */ |
191 | while (isspace(*p)) | 194 | while (isspace(*p)) |
192 | p++; | 195 | p++; |
193 | if (*p != '(') | 196 | if (*p != '(') |
@@ -211,7 +214,7 @@ void find_export_symbols(char * filename) | |||
211 | * Document all external or internal functions in a file. | 214 | * Document all external or internal functions in a file. |
212 | * Call kernel-doc with following parameters: | 215 | * Call kernel-doc with following parameters: |
213 | * kernel-doc -docbook -nofunction function_name1 filename | 216 | * kernel-doc -docbook -nofunction function_name1 filename |
214 | * function names are obtained from all the src files | 217 | * Function names are obtained from all the src files |
215 | * by find_export_symbols. | 218 | * by find_export_symbols. |
216 | * intfunc uses -nofunction | 219 | * intfunc uses -nofunction |
217 | * extfunc uses -function | 220 | * extfunc uses -function |
@@ -262,7 +265,7 @@ void singfunc(char * filename, char * line) | |||
262 | vec[idx++] = KERNELDOC; | 265 | vec[idx++] = KERNELDOC; |
263 | vec[idx++] = DOCBOOK; | 266 | vec[idx++] = DOCBOOK; |
264 | 267 | ||
265 | /* Split line up in individual parameters preceeded by FUNCTION */ | 268 | /* Split line up in individual parameters preceded by FUNCTION */ |
266 | for (i=0; line[i]; i++) { | 269 | for (i=0; line[i]; i++) { |
267 | if (isspace(line[i])) { | 270 | if (isspace(line[i])) { |
268 | line[i] = '\0'; | 271 | line[i] = '\0'; |
@@ -292,7 +295,7 @@ void parse_file(FILE *infile) | |||
292 | { | 295 | { |
293 | char line[MAXLINESZ]; | 296 | char line[MAXLINESZ]; |
294 | char * s; | 297 | char * s; |
295 | while(fgets(line, MAXLINESZ, infile)) { | 298 | while (fgets(line, MAXLINESZ, infile)) { |
296 | if (line[0] == '!') { | 299 | if (line[0] == '!') { |
297 | s = line + 2; | 300 | s = line + 2; |
298 | switch (line[1]) { | 301 | switch (line[1]) { |
@@ -351,9 +354,9 @@ int main(int argc, char *argv[]) | |||
351 | { | 354 | { |
352 | /* Need to do this in two passes. | 355 | /* Need to do this in two passes. |
353 | * First pass is used to collect all symbols exported | 356 | * First pass is used to collect all symbols exported |
354 | * in the various files. | 357 | * in the various files; |
355 | * Second pass generate the documentation. | 358 | * Second pass generate the documentation. |
356 | * This is required because function are declared | 359 | * This is required because some functions are declared |
357 | * and exported in different files :-(( | 360 | * and exported in different files :-(( |
358 | */ | 361 | */ |
359 | /* Collect symbols */ | 362 | /* Collect symbols */ |
@@ -396,4 +399,3 @@ int main(int argc, char *argv[]) | |||
396 | fflush(stdout); | 399 | fflush(stdout); |
397 | return exitstatus; | 400 | return exitstatus; |
398 | } | 401 | } |
399 | |||