11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * "Optimize" a list of dependencies as spit out by gcc -MD 31da177e4SLinus Torvalds * for the kernel build 41da177e4SLinus Torvalds * =========================================================================== 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * Author Kai Germaschewski 71da177e4SLinus Torvalds * Copyright 2002 by Kai Germaschewski <[email protected]> 81da177e4SLinus Torvalds * 91da177e4SLinus Torvalds * This software may be used and distributed according to the terms 101da177e4SLinus Torvalds * of the GNU General Public License, incorporated herein by reference. 111da177e4SLinus Torvalds * 121da177e4SLinus Torvalds * 131da177e4SLinus Torvalds * Introduction: 141da177e4SLinus Torvalds * 151da177e4SLinus Torvalds * gcc produces a very nice and correct list of dependencies which 161da177e4SLinus Torvalds * tells make when to remake a file. 171da177e4SLinus Torvalds * 181da177e4SLinus Torvalds * To use this list as-is however has the drawback that virtually 19264a2683SSam Ravnborg * every file in the kernel includes autoconf.h. 201da177e4SLinus Torvalds * 21264a2683SSam Ravnborg * If the user re-runs make *config, autoconf.h will be 221da177e4SLinus Torvalds * regenerated. make notices that and will rebuild every file which 231da177e4SLinus Torvalds * includes autoconf.h, i.e. basically all files. This is extremely 241da177e4SLinus Torvalds * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. 251da177e4SLinus Torvalds * 261da177e4SLinus Torvalds * So we play the same trick that "mkdep" played before. We replace 27264a2683SSam Ravnborg * the dependency on autoconf.h by a dependency on every config 284e433fc4SCao jin * option which is mentioned in any of the listed prerequisites. 291da177e4SLinus Torvalds * 30c21b1e4dSJan Beulich * kconfig populates a tree in include/config/ with an empty file 31c21b1e4dSJan Beulich * for each config symbol and when the configuration is updated 32c21b1e4dSJan Beulich * the files representing changed config options are touched 33c21b1e4dSJan Beulich * which then let make pick up the changes and the files that use 34c21b1e4dSJan Beulich * the config symbols are rebuilt. 351da177e4SLinus Torvalds * 361da177e4SLinus Torvalds * So if the user changes his CONFIG_HIS_DRIVER option, only the objects 374e433fc4SCao jin * which depend on "include/config/his/driver.h" will be rebuilt, 381da177e4SLinus Torvalds * so most likely only his driver ;-) 391da177e4SLinus Torvalds * 401da177e4SLinus Torvalds * The idea above dates, by the way, back to Michael E Chastain, AFAIK. 411da177e4SLinus Torvalds * 421da177e4SLinus Torvalds * So to get dependencies right, there are two issues: 431da177e4SLinus Torvalds * o if any of the files the compiler read changed, we need to rebuild 441da177e4SLinus Torvalds * o if the command line given to the compile the file changed, we 451da177e4SLinus Torvalds * better rebuild as well. 461da177e4SLinus Torvalds * 471da177e4SLinus Torvalds * The former is handled by using the -MD output, the later by saving 481da177e4SLinus Torvalds * the command line used to compile the old object and comparing it 491da177e4SLinus Torvalds * to the one we would now use. 501da177e4SLinus Torvalds * 511da177e4SLinus Torvalds * Again, also this idea is pretty old and has been discussed on 521da177e4SLinus Torvalds * kbuild-devel a long time ago. I don't have a sensibly working 531da177e4SLinus Torvalds * internet connection right now, so I rather don't mention names 541da177e4SLinus Torvalds * without double checking. 551da177e4SLinus Torvalds * 561da177e4SLinus Torvalds * This code here has been based partially based on mkdep.c, which 571da177e4SLinus Torvalds * says the following about its history: 581da177e4SLinus Torvalds * 591da177e4SLinus Torvalds * Copyright abandoned, Michael Chastain, <mailto:[email protected]>. 601da177e4SLinus Torvalds * This is a C version of syncdep.pl by Werner Almesberger. 611da177e4SLinus Torvalds * 621da177e4SLinus Torvalds * 631da177e4SLinus Torvalds * It is invoked as 641da177e4SLinus Torvalds * 651da177e4SLinus Torvalds * fixdep <depfile> <target> <cmdline> 661da177e4SLinus Torvalds * 671da177e4SLinus Torvalds * and will read the dependency file <depfile> 681da177e4SLinus Torvalds * 691da177e4SLinus Torvalds * The transformed dependency snipped is written to stdout. 701da177e4SLinus Torvalds * 711da177e4SLinus Torvalds * It first generates a line 721da177e4SLinus Torvalds * 731da177e4SLinus Torvalds * cmd_<target> = <cmdline> 741da177e4SLinus Torvalds * 751da177e4SLinus Torvalds * and then basically copies the .<target>.d file to stdout, in the 76264a2683SSam Ravnborg * process filtering out the dependency on autoconf.h and adding 771da177e4SLinus Torvalds * dependencies on include/config/my/option.h for every 784e433fc4SCao jin * CONFIG_MY_OPTION encountered in any of the prerequisites. 791da177e4SLinus Torvalds * 801da177e4SLinus Torvalds * It will also filter out all the dependencies on *.ver. We need 811da177e4SLinus Torvalds * to make sure that the generated version checksum are globally up 821da177e4SLinus Torvalds * to date before even starting the recursive build, so it's too late 831da177e4SLinus Torvalds * at this point anyway. 841da177e4SLinus Torvalds * 85dee81e98SAlexey Dobriyan * We don't even try to really parse the header files, but 861da177e4SLinus Torvalds * merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will 871da177e4SLinus Torvalds * be picked up as well. It's not a problem with respect to 881da177e4SLinus Torvalds * correctness, since that can only give too many dependencies, thus 891da177e4SLinus Torvalds * we cannot miss a rebuild. Since people tend to not mention totally 901da177e4SLinus Torvalds * unrelated CONFIG_ options all over the place, it's not an 911da177e4SLinus Torvalds * efficiency problem either. 921da177e4SLinus Torvalds * 931da177e4SLinus Torvalds * (Note: it'd be easy to port over the complete mkdep state machine, 941da177e4SLinus Torvalds * but I don't think the added complexity is worth it) 951da177e4SLinus Torvalds */ 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds #include <sys/types.h> 981da177e4SLinus Torvalds #include <sys/stat.h> 991da177e4SLinus Torvalds #include <unistd.h> 1001da177e4SLinus Torvalds #include <fcntl.h> 1011da177e4SLinus Torvalds #include <string.h> 1021da177e4SLinus Torvalds #include <stdlib.h> 1031da177e4SLinus Torvalds #include <stdio.h> 1041da177e4SLinus Torvalds #include <ctype.h> 1051da177e4SLinus Torvalds 1064356f489STrevor Keith static void usage(void) 1071da177e4SLinus Torvalds { 108d8329e35SNicolas Pitre fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n"); 109d8329e35SNicolas Pitre fprintf(stderr, " -e insert extra dependencies given on stdin\n"); 1101da177e4SLinus Torvalds exit(1); 1111da177e4SLinus Torvalds } 1121da177e4SLinus Torvalds 1134d99f93bSSam Ravnborg /* 114d8329e35SNicolas Pitre * Print out a dependency path from a symbol name 115d8329e35SNicolas Pitre */ 116fbfa9be9SMasahiro Yamada static void print_dep(const char *m, int slen, const char *dir) 117d8329e35SNicolas Pitre { 118*b3aa58d2SNicolas Pitre int c, prev_c = '/', i; 119d8329e35SNicolas Pitre 120fbfa9be9SMasahiro Yamada printf(" $(wildcard %s/", dir); 121d8329e35SNicolas Pitre for (i = 0; i < slen; i++) { 122d8329e35SNicolas Pitre c = m[i]; 123d8329e35SNicolas Pitre if (c == '_') 124d8329e35SNicolas Pitre c = '/'; 125d8329e35SNicolas Pitre else 126d8329e35SNicolas Pitre c = tolower(c); 127*b3aa58d2SNicolas Pitre if (c != '/' || prev_c != '/') 128d8329e35SNicolas Pitre putchar(c); 129*b3aa58d2SNicolas Pitre prev_c = c; 130d8329e35SNicolas Pitre } 131d8329e35SNicolas Pitre printf(".h) \\\n"); 132d8329e35SNicolas Pitre } 133d8329e35SNicolas Pitre 134d8329e35SNicolas Pitre static void do_extra_deps(void) 135d8329e35SNicolas Pitre { 136d8329e35SNicolas Pitre char buf[80]; 1375d1ef76fSMasahiro Yamada 138d8329e35SNicolas Pitre while (fgets(buf, sizeof(buf), stdin)) { 139d8329e35SNicolas Pitre int len = strlen(buf); 1405d1ef76fSMasahiro Yamada 141d8329e35SNicolas Pitre if (len < 2 || buf[len - 1] != '\n') { 142d8329e35SNicolas Pitre fprintf(stderr, "fixdep: bad data on stdin\n"); 143d8329e35SNicolas Pitre exit(1); 144d8329e35SNicolas Pitre } 145fbfa9be9SMasahiro Yamada print_dep(buf, len - 1, "include/ksym"); 146d8329e35SNicolas Pitre } 147d8329e35SNicolas Pitre } 148d8329e35SNicolas Pitre 1498af27e1dSEric Dumazet struct item { 1508af27e1dSEric Dumazet struct item *next; 1518af27e1dSEric Dumazet unsigned int len; 1528af27e1dSEric Dumazet unsigned int hash; 1538af27e1dSEric Dumazet char name[0]; 1548af27e1dSEric Dumazet }; 1551da177e4SLinus Torvalds 1568af27e1dSEric Dumazet #define HASHSZ 256 1578af27e1dSEric Dumazet static struct item *hashtab[HASHSZ]; 1588af27e1dSEric Dumazet 1598af27e1dSEric Dumazet static unsigned int strhash(const char *str, unsigned int sz) 1601da177e4SLinus Torvalds { 1618af27e1dSEric Dumazet /* fnv32 hash */ 1628af27e1dSEric Dumazet unsigned int i, hash = 2166136261U; 1631da177e4SLinus Torvalds 1648af27e1dSEric Dumazet for (i = 0; i < sz; i++) 1658af27e1dSEric Dumazet hash = (hash ^ str[i]) * 0x01000193; 1668af27e1dSEric Dumazet return hash; 1678af27e1dSEric Dumazet } 1681da177e4SLinus Torvalds 1691da177e4SLinus Torvalds /* 1701da177e4SLinus Torvalds * Lookup a value in the configuration string. 1711da177e4SLinus Torvalds */ 1728af27e1dSEric Dumazet static int is_defined_config(const char *name, int len, unsigned int hash) 1731da177e4SLinus Torvalds { 1748af27e1dSEric Dumazet struct item *aux; 1758af27e1dSEric Dumazet 1768af27e1dSEric Dumazet for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) { 1778af27e1dSEric Dumazet if (aux->hash == hash && aux->len == len && 1788af27e1dSEric Dumazet memcmp(aux->name, name, len) == 0) 1791da177e4SLinus Torvalds return 1; 1801da177e4SLinus Torvalds } 1811da177e4SLinus Torvalds return 0; 1821da177e4SLinus Torvalds } 1831da177e4SLinus Torvalds 1841da177e4SLinus Torvalds /* 1851da177e4SLinus Torvalds * Add a new value to the configuration string. 1861da177e4SLinus Torvalds */ 1878af27e1dSEric Dumazet static void define_config(const char *name, int len, unsigned int hash) 1881da177e4SLinus Torvalds { 1898af27e1dSEric Dumazet struct item *aux = malloc(sizeof(*aux) + len); 1901da177e4SLinus Torvalds 1918af27e1dSEric Dumazet if (!aux) { 1928af27e1dSEric Dumazet perror("fixdep:malloc"); 1938af27e1dSEric Dumazet exit(1); 1948af27e1dSEric Dumazet } 1958af27e1dSEric Dumazet memcpy(aux->name, name, len); 1968af27e1dSEric Dumazet aux->len = len; 1978af27e1dSEric Dumazet aux->hash = hash; 1988af27e1dSEric Dumazet aux->next = hashtab[hash % HASHSZ]; 1998af27e1dSEric Dumazet hashtab[hash % HASHSZ] = aux; 2001da177e4SLinus Torvalds } 2011da177e4SLinus Torvalds 2021da177e4SLinus Torvalds /* 2031da177e4SLinus Torvalds * Record the use of a CONFIG_* word. 2041da177e4SLinus Torvalds */ 2058af27e1dSEric Dumazet static void use_config(const char *m, int slen) 2061da177e4SLinus Torvalds { 2078af27e1dSEric Dumazet unsigned int hash = strhash(m, slen); 2081da177e4SLinus Torvalds 2098af27e1dSEric Dumazet if (is_defined_config(m, slen, hash)) 2101da177e4SLinus Torvalds return; 2111da177e4SLinus Torvalds 2128af27e1dSEric Dumazet define_config(m, slen, hash); 213fbfa9be9SMasahiro Yamada print_dep(m, slen, "include/config"); 2141da177e4SLinus Torvalds } 2151da177e4SLinus Torvalds 216d8329e35SNicolas Pitre /* test if s ends in sub */ 21787b95a81SMasahiro Yamada static int str_ends_with(const char *s, int slen, const char *sub) 2181da177e4SLinus Torvalds { 2191da177e4SLinus Torvalds int sublen = strlen(sub); 2201da177e4SLinus Torvalds 2211da177e4SLinus Torvalds if (sublen > slen) 22287b95a81SMasahiro Yamada return 0; 2231da177e4SLinus Torvalds 22487b95a81SMasahiro Yamada return !memcmp(s + slen - sublen, sub, sublen); 2251da177e4SLinus Torvalds } 2261da177e4SLinus Torvalds 227ab9ce9feSMasahiro Yamada static void parse_config_file(const char *p) 228ab9ce9feSMasahiro Yamada { 229ab9ce9feSMasahiro Yamada const char *q, *r; 2305b8ad96dSRasmus Villemoes const char *start = p; 231ab9ce9feSMasahiro Yamada 232ab9ce9feSMasahiro Yamada while ((p = strstr(p, "CONFIG_"))) { 2335b8ad96dSRasmus Villemoes if (p > start && (isalnum(p[-1]) || p[-1] == '_')) { 2345b8ad96dSRasmus Villemoes p += 7; 2355b8ad96dSRasmus Villemoes continue; 2365b8ad96dSRasmus Villemoes } 237ab9ce9feSMasahiro Yamada p += 7; 238ab9ce9feSMasahiro Yamada q = p; 239ab9ce9feSMasahiro Yamada while (*q && (isalnum(*q) || *q == '_')) 240ab9ce9feSMasahiro Yamada q++; 241ab9ce9feSMasahiro Yamada if (str_ends_with(p, q - p, "_MODULE")) 242ab9ce9feSMasahiro Yamada r = q - 7; 243ab9ce9feSMasahiro Yamada else 244ab9ce9feSMasahiro Yamada r = q; 245ab9ce9feSMasahiro Yamada if (r > p) 246ab9ce9feSMasahiro Yamada use_config(p, r - p); 247ab9ce9feSMasahiro Yamada p = q; 248ab9ce9feSMasahiro Yamada } 249ab9ce9feSMasahiro Yamada } 250ab9ce9feSMasahiro Yamada 2514003fd80SMasahiro Yamada static void *read_file(const char *filename) 2521da177e4SLinus Torvalds { 2531da177e4SLinus Torvalds struct stat st; 2541da177e4SLinus Torvalds int fd; 2554003fd80SMasahiro Yamada char *buf; 2561da177e4SLinus Torvalds 2571da177e4SLinus Torvalds fd = open(filename, O_RDONLY); 2581da177e4SLinus Torvalds if (fd < 0) { 2594003fd80SMasahiro Yamada fprintf(stderr, "fixdep: error opening file: "); 2601da177e4SLinus Torvalds perror(filename); 2611da177e4SLinus Torvalds exit(2); 2621da177e4SLinus Torvalds } 26346fe94adSTom Rini if (fstat(fd, &st) < 0) { 2644003fd80SMasahiro Yamada fprintf(stderr, "fixdep: error fstat'ing file: "); 26546fe94adSTom Rini perror(filename); 26646fe94adSTom Rini exit(2); 26746fe94adSTom Rini } 2684003fd80SMasahiro Yamada buf = malloc(st.st_size + 1); 2694003fd80SMasahiro Yamada if (!buf) { 270dee81e98SAlexey Dobriyan perror("fixdep: malloc"); 2717c2ec43aSLukas Bulwahn exit(2); 2721da177e4SLinus Torvalds } 2734003fd80SMasahiro Yamada if (read(fd, buf, st.st_size) != st.st_size) { 274dee81e98SAlexey Dobriyan perror("fixdep: read"); 2757c2ec43aSLukas Bulwahn exit(2); 276dee81e98SAlexey Dobriyan } 2774003fd80SMasahiro Yamada buf[st.st_size] = '\0'; 278dee81e98SAlexey Dobriyan close(fd); 279dee81e98SAlexey Dobriyan 2804003fd80SMasahiro Yamada return buf; 2811da177e4SLinus Torvalds } 2821da177e4SLinus Torvalds 28387b95a81SMasahiro Yamada /* Ignore certain dependencies */ 28487b95a81SMasahiro Yamada static int is_ignored_file(const char *s, int len) 28587b95a81SMasahiro Yamada { 28687b95a81SMasahiro Yamada return str_ends_with(s, len, "include/generated/autoconf.h") || 28787b95a81SMasahiro Yamada str_ends_with(s, len, "include/generated/autoksyms.h") || 28887b95a81SMasahiro Yamada str_ends_with(s, len, ".ver"); 28987b95a81SMasahiro Yamada } 29087b95a81SMasahiro Yamada 2917840fea2SMichal Marek /* 2927840fea2SMichal Marek * Important: The below generated source_foo.o and deps_foo.o variable 2937840fea2SMichal Marek * assignments are parsed not only by make, but also by the rather simple 2947840fea2SMichal Marek * parser in scripts/mod/sumversion.c. 2957840fea2SMichal Marek */ 2965d1ef76fSMasahiro Yamada static void parse_dep_file(char *m, const char *target, int insert_extra_deps) 2971da177e4SLinus Torvalds { 29848b9d03cSJ.A. Magallon char *p; 29901b5cbe7SMasahiro Yamada int is_last, is_target; 3002ab8a996SStephen Warren int saw_any_target = 0; 3012ab8a996SStephen Warren int is_first_dep = 0; 3024003fd80SMasahiro Yamada void *buf; 3031da177e4SLinus Torvalds 30401b5cbe7SMasahiro Yamada while (1) { 3052ab8a996SStephen Warren /* Skip any "white space" */ 30601b5cbe7SMasahiro Yamada while (*m == ' ' || *m == '\\' || *m == '\n') 3071da177e4SLinus Torvalds m++; 30801b5cbe7SMasahiro Yamada 30901b5cbe7SMasahiro Yamada if (!*m) 31001b5cbe7SMasahiro Yamada break; 31101b5cbe7SMasahiro Yamada 3122ab8a996SStephen Warren /* Find next "white space" */ 3131da177e4SLinus Torvalds p = m; 31401b5cbe7SMasahiro Yamada while (*p && *p != ' ' && *p != '\\' && *p != '\n') 3151da177e4SLinus Torvalds p++; 31601b5cbe7SMasahiro Yamada is_last = (*p == '\0'); 3172ab8a996SStephen Warren /* Is the token we found a target name? */ 3182ab8a996SStephen Warren is_target = (*(p-1) == ':'); 3192ab8a996SStephen Warren /* Don't write any target names into the dependency file */ 3202ab8a996SStephen Warren if (is_target) { 3212ab8a996SStephen Warren /* The /next/ file is the first dependency */ 3222ab8a996SStephen Warren is_first_dep = 1; 32387b95a81SMasahiro Yamada } else if (!is_ignored_file(m, p - m)) { 324ccfe7887SMasahiro Yamada *p = '\0'; 3252ab8a996SStephen Warren 326b7bd1821SMichal Marek /* 32787b95a81SMasahiro Yamada * Do not list the source file as dependency, so that 32887b95a81SMasahiro Yamada * kbuild is not confused if a .c file is rewritten 32987b95a81SMasahiro Yamada * into .S or vice versa. Storing it in source_* is 33087b95a81SMasahiro Yamada * needed for modpost to compute srcversions. 331b7bd1821SMichal Marek */ 3322ab8a996SStephen Warren if (is_first_dep) { 3332ab8a996SStephen Warren /* 33487b95a81SMasahiro Yamada * If processing the concatenation of multiple 33587b95a81SMasahiro Yamada * dependency files, only process the first 33687b95a81SMasahiro Yamada * target name, which will be the original 33787b95a81SMasahiro Yamada * source name, and ignore any other target 33887b95a81SMasahiro Yamada * names, which will be intermediate temporary 3392ab8a996SStephen Warren * files. 3402ab8a996SStephen Warren */ 3412ab8a996SStephen Warren if (!saw_any_target) { 3422ab8a996SStephen Warren saw_any_target = 1; 3432ab8a996SStephen Warren printf("source_%s := %s\n\n", 344ccfe7887SMasahiro Yamada target, m); 34587b95a81SMasahiro Yamada printf("deps_%s := \\\n", target); 3462ab8a996SStephen Warren } 3472ab8a996SStephen Warren is_first_dep = 0; 34887b95a81SMasahiro Yamada } else { 349ccfe7887SMasahiro Yamada printf(" %s \\\n", m); 35087b95a81SMasahiro Yamada } 3514003fd80SMasahiro Yamada 352ccfe7887SMasahiro Yamada buf = read_file(m); 3534003fd80SMasahiro Yamada parse_config_file(buf); 3544003fd80SMasahiro Yamada free(buf); 3551da177e4SLinus Torvalds } 35601b5cbe7SMasahiro Yamada 35701b5cbe7SMasahiro Yamada if (is_last) 35801b5cbe7SMasahiro Yamada break; 35901b5cbe7SMasahiro Yamada 3602ab8a996SStephen Warren /* 3612ab8a996SStephen Warren * Start searching for next token immediately after the first 3622ab8a996SStephen Warren * "whitespace" character that follows this token. 3632ab8a996SStephen Warren */ 3641da177e4SLinus Torvalds m = p + 1; 3651da177e4SLinus Torvalds } 3662ab8a996SStephen Warren 3672ab8a996SStephen Warren if (!saw_any_target) { 3682ab8a996SStephen Warren fprintf(stderr, "fixdep: parse error; no targets found\n"); 3692ab8a996SStephen Warren exit(1); 3702ab8a996SStephen Warren } 3712ab8a996SStephen Warren 3725d1ef76fSMasahiro Yamada if (insert_extra_deps) 373d8329e35SNicolas Pitre do_extra_deps(); 374d8329e35SNicolas Pitre 3751da177e4SLinus Torvalds printf("\n%s: $(deps_%s)\n\n", target, target); 3761da177e4SLinus Torvalds printf("$(deps_%s):\n", target); 3771da177e4SLinus Torvalds } 3781da177e4SLinus Torvalds 3791da177e4SLinus Torvalds int main(int argc, char *argv[]) 3801da177e4SLinus Torvalds { 3815d1ef76fSMasahiro Yamada const char *depfile, *target, *cmdline; 3825d1ef76fSMasahiro Yamada int insert_extra_deps = 0; 3834003fd80SMasahiro Yamada void *buf; 3844003fd80SMasahiro Yamada 385d8329e35SNicolas Pitre if (argc == 5 && !strcmp(argv[1], "-e")) { 386d8329e35SNicolas Pitre insert_extra_deps = 1; 387d8329e35SNicolas Pitre argv++; 388d8329e35SNicolas Pitre } else if (argc != 4) 3891da177e4SLinus Torvalds usage(); 3901da177e4SLinus Torvalds 3911da177e4SLinus Torvalds depfile = argv[1]; 3921da177e4SLinus Torvalds target = argv[2]; 3931da177e4SLinus Torvalds cmdline = argv[3]; 3941da177e4SLinus Torvalds 3955d1ef76fSMasahiro Yamada printf("cmd_%s := %s\n\n", target, cmdline); 3964003fd80SMasahiro Yamada 3974003fd80SMasahiro Yamada buf = read_file(depfile); 3985d1ef76fSMasahiro Yamada parse_dep_file(buf, target, insert_extra_deps); 3994003fd80SMasahiro Yamada free(buf); 4001da177e4SLinus Torvalds 4011da177e4SLinus Torvalds return 0; 4021da177e4SLinus Torvalds } 403