x86: use kernel_stack_pointer() in process_32.c
[safe/jmp/linux-2.6] / scripts / basic / fixdep.c
index 7f42c5d..6bf21f8 100644 (file)
@@ -16,8 +16,7 @@
  * tells make when to remake a file.
  *
  * To use this list as-is however has the drawback that virtually
- * every file in the kernel includes <linux/config.h> which then again
- * includes <linux/autoconf.h>
+ * every file in the kernel includes <linux/autoconf.h>.
  *
  * If the user re-runs make *config, linux/autoconf.h will be
  * regenerated.  make notices that and will rebuild every file which
  * the dependency on linux/autoconf.h by a dependency on every config
  * option which is mentioned in any of the listed prequisites.
  *
- * To be exact, split-include populates a tree in include/config/,
- * e.g. include/config/his/driver.h, which contains the #define/#undef
- * for the CONFIG_HIS_DRIVER option.
+ * kconfig populates a tree in include/config/ with an empty file
+ * for each config symbol and when the configuration is updated
+ * the files representing changed config options are touched
+ * which then let make pick up the changes and the files that use
+ * the config symbols are rebuilt.
  *
  * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
  * which depend on "include/linux/config/his/driver.h" will be rebuilt,
@@ -123,14 +124,16 @@ char *target;
 char *depfile;
 char *cmdline;
 
-void usage(void)
-
+static void usage(void)
 {
        fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
        exit(1);
 }
 
-void print_cmdline(void)
+/*
+ * Print out the commandline prefixed with cmd_<target filename> :=
+ */
+static void print_cmdline(void)
 {
        printf("cmd_%s := %s\n\n", target, cmdline);
 }
@@ -143,7 +146,7 @@ int    len_config  = 0;
  * Grow the configuration string to a desired length.
  * Usually the first growth is plenty.
  */
-void grow_config(int len)
+static void grow_config(int len)
 {
        while (len_config + len > size_config) {
                if (size_config == 0)
@@ -159,7 +162,7 @@ void grow_config(int len)
 /*
  * Lookup a value in the configuration string.
  */
-int is_defined_config(const char * name, int len)
+static int is_defined_config(const char * name, int len)
 {
        const char * pconfig;
        const char * plast = str_config + len_config - len;
@@ -175,7 +178,7 @@ int is_defined_config(const char * name, int len)
 /*
  * Add a new value to the configuration string.
  */
-void define_config(const char * name, int len)
+static void define_config(const char * name, int len)
 {
        grow_config(len + 1);
 
@@ -187,7 +190,7 @@ void define_config(const char * name, int len)
 /*
  * Clear the set of configuration strings.
  */
-void clear_config(void)
+static void clear_config(void)
 {
        len_config = 0;
        define_config("", 0);
@@ -196,7 +199,7 @@ void clear_config(void)
 /*
  * Record the use of a CONFIG_* word.
  */
-void use_config(char *m, int slen)
+static void use_config(char *m, int slen)
 {
        char s[PATH_MAX];
        char *p;
@@ -212,23 +215,23 @@ void use_config(char *m, int slen)
                if (*p == '_')
                        *p = '/';
                else
-                       *p = tolower((unsigned char)*p);
+                       *p = tolower((int)*p);
        }
        printf("    $(wildcard include/config/%s.h) \\\n", s);
 }
 
-void parse_config_file(signed char *map, size_t len)
+static void parse_config_file(char *map, size_t len)
 {
        int *end = (int *) (map + len);
        /* start at +1, so that p can never be < map */
        int *m   = (int *) map + 1;
-       signed char *p, *q;
+       char *p, *q;
 
        for (; m < end; m++) {
-               if (*m == INT_CONF) { p = (signed char *) m  ; goto conf; }
-               if (*m == INT_ONFI) { p = (signed char *) m-1; goto conf; }
-               if (*m == INT_NFIG) { p = (signed char *) m-2; goto conf; }
-               if (*m == INT_FIG_) { p = (signed char *) m-3; goto conf; }
+               if (*m == INT_CONF) { p = (char *) m  ; goto conf; }
+               if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
+               if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
+               if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }
                continue;
        conf:
                if (p > map + len - 7)
@@ -242,12 +245,16 @@ void parse_config_file(signed char *map, size_t len)
                continue;
 
        found:
+               if (!memcmp(q - 7, "_MODULE", 7))
+                       q -= 7;
+               if( (q-p-7) < 0 )
+                       continue;
                use_config(p+7, q-p-7);
        }
 }
 
 /* test is s ends in sub */
-int strrcmp(char *s, char *sub)
+static int strrcmp(char *s, char *sub)
 {
        int slen = strlen(s);
        int sublen = strlen(sub);
@@ -258,7 +265,7 @@ int strrcmp(char *s, char *sub)
        return memcmp(s + slen - sublen, sub, sublen);
 }
 
-void do_config_file(char *filename)
+static void do_config_file(char *filename)
 {
        struct stat st;
        int fd;
@@ -289,11 +296,11 @@ void do_config_file(char *filename)
        close(fd);
 }
 
-void parse_dep_file(void *map, size_t len)
+static void parse_dep_file(void *map, size_t len)
 {
-       signed char *m = map;
-       signed char *end = m + len;
-       signed char *p;
+       char *m = map;
+       char *end = m + len;
+       char *p;
        char s[PATH_MAX];
 
        p = strchr(m, ':');
@@ -329,7 +336,7 @@ void parse_dep_file(void *map, size_t len)
        printf("$(deps_%s):\n", target);
 }
 
-void print_deps(void)
+static void print_deps(void)
 {
        struct stat st;
        int fd;
@@ -361,13 +368,14 @@ void print_deps(void)
        close(fd);
 }
 
-void traps(void)
+static void traps(void)
 {
        static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
+       int *p = (int *)test;
 
-       if (*(int *)test != INT_CONF) {
+       if (*p != INT_CONF) {
                fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
-                       *(int *)test);
+                       *p);
                exit(2);
        }
 }