diff options
Diffstat (limited to 'scripts')
43 files changed, 1231 insertions, 458 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c29be8f90248..c67e73ecd5be 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | |||
| 83 | # is automatically cleaned up. | 83 | # is automatically cleaned up. |
| 84 | try-run = $(shell set -e; \ | 84 | try-run = $(shell set -e; \ |
| 85 | TMP="$(TMPOUT).$$$$.tmp"; \ | 85 | TMP="$(TMPOUT).$$$$.tmp"; \ |
| 86 | TMPO="$(TMPOUT).$$$$.o"; \ | ||
| 86 | if ($(1)) >/dev/null 2>&1; \ | 87 | if ($(1)) >/dev/null 2>&1; \ |
| 87 | then echo "$(2)"; \ | 88 | then echo "$(2)"; \ |
| 88 | else echo "$(3)"; \ | 89 | else echo "$(3)"; \ |
| 89 | fi; \ | 90 | fi; \ |
| 90 | rm -f "$$TMP") | 91 | rm -f "$$TMP" "$$TMPO") |
| 91 | 92 | ||
| 92 | # as-option | 93 | # as-option |
| 93 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) | 94 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
| @@ -99,18 +100,18 @@ as-option = $(call try-run,\ | |||
| 99 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
| 100 | 101 | ||
| 101 | as-instr = $(call try-run,\ | 102 | as-instr = $(call try-run,\ |
| 102 | echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 103 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
| 103 | 104 | ||
| 104 | # cc-option | 105 | # cc-option |
| 105 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
| 106 | 107 | ||
| 107 | cc-option = $(call try-run,\ | 108 | cc-option = $(call try-run,\ |
| 108 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) | 109 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) |
| 109 | 110 | ||
| 110 | # cc-option-yn | 111 | # cc-option-yn |
| 111 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 112 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
| 112 | cc-option-yn = $(call try-run,\ | 113 | cc-option-yn = $(call try-run,\ |
| 113 | $(CC) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) | 114 | $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) |
| 114 | 115 | ||
| 115 | # cc-option-align | 116 | # cc-option-align |
| 116 | # Prefix align with either -falign or -malign | 117 | # Prefix align with either -falign or -malign |
| @@ -130,10 +131,15 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \ | |||
| 130 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 131 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
| 131 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) | 132 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) |
| 132 | 133 | ||
| 134 | # cc-ldoption | ||
| 135 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) | ||
| 136 | cc-ldoption = $(call try-run,\ | ||
| 137 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | ||
| 138 | |||
| 133 | # ld-option | 139 | # ld-option |
| 134 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | 140 | # Usage: LDFLAGS += $(call ld-option, -X) |
| 135 | ld-option = $(call try-run,\ | 141 | ld-option = $(call try-run,\ |
| 136 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | 142 | $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) |
| 137 | 143 | ||
| 138 | ###### | 144 | ###### |
| 139 | 145 | ||
diff --git a/scripts/Makefile b/scripts/Makefile index 9dd5b25a1d53..842dbc2d5aed 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
| 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
| 12 | hostprogs-$(CONFIG_VT) += conmakehash | 12 | hostprogs-$(CONFIG_VT) += conmakehash |
| 13 | hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash | ||
| 14 | hostprogs-$(CONFIG_IKCONFIG) += bin2c | 13 | hostprogs-$(CONFIG_IKCONFIG) += bin2c |
| 15 | 14 | ||
| 16 | always := $(hostprogs-y) $(hostprogs-m) | 15 | always := $(hostprogs-y) $(hostprogs-m) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5c4b7a400c18..341b58902ffc 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -206,7 +206,7 @@ cmd_modversions = \ | |||
| 206 | endif | 206 | endif |
| 207 | 207 | ||
| 208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 209 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 209 | cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
| 210 | "$(if $(CONFIG_64BIT),64,32)" \ | 210 | "$(if $(CONFIG_64BIT),64,32)" \ |
| 211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ | 211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ |
| 212 | "$(if $(part-of-module),1,0)" "$(@)"; | 212 | "$(if $(part-of-module),1,0)" "$(@)"; |
| @@ -216,6 +216,7 @@ define rule_cc_o_c | |||
| 216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ | 216 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ |
| 217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ | 217 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ |
| 218 | $(cmd_modversions) \ | 218 | $(cmd_modversions) \ |
| 219 | $(call echo-cmd,record_mcount) \ | ||
| 219 | $(cmd_record_mcount) \ | 220 | $(cmd_record_mcount) \ |
| 220 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 221 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
| 221 | $(dot-target).tmp; \ | 222 | $(dot-target).tmp; \ |
| @@ -269,7 +270,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always) | |||
| 269 | # Linker scripts preprocessor (.lds.S -> .lds) | 270 | # Linker scripts preprocessor (.lds.S -> .lds) |
| 270 | # --------------------------------------------------------------------------- | 271 | # --------------------------------------------------------------------------- |
| 271 | quiet_cmd_cpp_lds_S = LDS $@ | 272 | quiet_cmd_cpp_lds_S = LDS $@ |
| 272 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< | 273 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ |
| 274 | -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< | ||
| 273 | 275 | ||
| 274 | $(obj)/%.lds: $(src)/%.lds.S FORCE | 276 | $(obj)/%.lds: $(src)/%.lds.S FORCE |
| 275 | $(call if_changed_dep,cpp_lds_S) | 277 | $(call if_changed_dep,cpp_lds_S) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7a7778746ea6..ffdafb26f539 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | |||
| 208 | 208 | ||
| 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; | 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; |
| 210 | # append the size as a 32-bit littleendian number as gzip does. | 210 | # append the size as a 32-bit littleendian number as gzip does. |
| 211 | size_append = echo -ne $(shell \ | 211 | size_append = /bin/echo -ne $(shell \ |
| 212 | dec_size=0; \ | 212 | dec_size=0; \ |
| 213 | for F in $1; do \ | 213 | for F in $1; do \ |
| 214 | fsize=$$(stat -c "%s" $$F); \ | 214 | fsize=$$(stat -c "%s" $$F); \ |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index f4053dc7b5d6..8f14c81abbc7 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | # 2) modpost is then used to | 13 | # 2) modpost is then used to |
| 14 | # 3) create one <module>.mod.c file pr. module | 14 | # 3) create one <module>.mod.c file pr. module |
| 15 | # 4) create one Module.symvers file with CRC for all exported symbols | 15 | # 4) create one Module.symvers file with CRC for all exported symbols |
| 16 | # 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers | ||
| 17 | # 5) compile all <module>.mod.c files | 16 | # 5) compile all <module>.mod.c files |
| 18 | # 6) final link of the module to a <module.ko> file | 17 | # 6) final link of the module to a <module.ko> file |
| 19 | 18 | ||
| @@ -59,10 +58,6 @@ include scripts/Makefile.lib | |||
| 59 | 58 | ||
| 60 | kernelsymfile := $(objtree)/Module.symvers | 59 | kernelsymfile := $(objtree)/Module.symvers |
| 61 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers | 60 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers |
| 62 | kernelmarkersfile := $(objtree)/Module.markers | ||
| 63 | modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers | ||
| 64 | |||
| 65 | markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) | ||
| 66 | 61 | ||
| 67 | # Step 1), find all modules listed in $(MODVERDIR)/ | 62 | # Step 1), find all modules listed in $(MODVERDIR)/ |
| 68 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | 63 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) |
| @@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ | |||
| 85 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ | 80 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ |
| 86 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 81 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
| 87 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 82 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
| 88 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ | ||
| 89 | $(if $(CONFIG_MARKERS),-M $(markersfile)) \ | ||
| 90 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ | 83 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ |
| 91 | $(if $(cross_build),-c) | 84 | $(if $(cross_build),-c) |
| 92 | 85 | ||
| @@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ | |||
| 101 | cmd_kernel-mod = $(modpost) $@ | 94 | cmd_kernel-mod = $(modpost) $@ |
| 102 | 95 | ||
| 103 | vmlinux.o: FORCE | 96 | vmlinux.o: FORCE |
| 104 | @rm -fr $(kernelmarkersfile) | ||
| 105 | $(call cmd,kernel-mod) | 97 | $(call cmd,kernel-mod) |
| 106 | 98 | ||
| 107 | # Declare generated files as targets for modpost | 99 | # Declare generated files as targets for modpost |
| 108 | $(symverfile): __modpost ; | 100 | $(symverfile): __modpost ; |
| 109 | $(modules:.ko=.mod.c): __modpost ; | 101 | $(modules:.ko=.mod.c): __modpost ; |
| 110 | 102 | ||
| 111 | ifdef CONFIG_MARKERS | ||
| 112 | $(markersfile): __modpost ; | ||
| 113 | endif | ||
| 114 | |||
| 115 | 103 | ||
| 116 | # Step 5), compile all *.mod.c files | 104 | # Step 5), compile all *.mod.c files |
| 117 | 105 | ||
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 99ca7a698687..79ab973fb43a 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
| @@ -71,7 +71,7 @@ FILELINE * docsection; | |||
| 71 | 71 | ||
| 72 | static char *srctree, *kernsrctree; | 72 | static char *srctree, *kernsrctree; |
| 73 | 73 | ||
| 74 | void usage (void) | 74 | static void usage (void) |
| 75 | { | 75 | { |
| 76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | 76 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); |
| 77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | 77 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); |
| @@ -84,7 +84,7 @@ void usage (void) | |||
| 84 | /* | 84 | /* |
| 85 | * Execute kernel-doc with parameters given in svec | 85 | * Execute kernel-doc with parameters given in svec |
| 86 | */ | 86 | */ |
| 87 | void exec_kernel_doc(char **svec) | 87 | static void exec_kernel_doc(char **svec) |
| 88 | { | 88 | { |
| 89 | pid_t pid; | 89 | pid_t pid; |
| 90 | int ret; | 90 | int ret; |
| @@ -129,7 +129,7 @@ struct symfile | |||
| 129 | struct symfile symfilelist[MAXFILES]; | 129 | struct symfile symfilelist[MAXFILES]; |
| 130 | int symfilecnt = 0; | 130 | int symfilecnt = 0; |
| 131 | 131 | ||
| 132 | void add_new_symbol(struct symfile *sym, char * symname) | 132 | static void add_new_symbol(struct symfile *sym, char * symname) |
| 133 | { | 133 | { |
| 134 | sym->symbollist = | 134 | sym->symbollist = |
| 135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); | 135 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); |
| @@ -137,14 +137,14 @@ void add_new_symbol(struct symfile *sym, char * symname) | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | /* Add a filename to the list */ | 139 | /* Add a filename to the list */ |
| 140 | struct symfile * add_new_file(char * filename) | 140 | static struct symfile * add_new_file(char * filename) |
| 141 | { | 141 | { |
| 142 | symfilelist[symfilecnt++].filename = strdup(filename); | 142 | symfilelist[symfilecnt++].filename = strdup(filename); |
| 143 | return &symfilelist[symfilecnt - 1]; | 143 | return &symfilelist[symfilecnt - 1]; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | /* Check if file already are present in the list */ | 146 | /* Check if file already are present in the list */ |
| 147 | struct symfile * filename_exist(char * filename) | 147 | static struct symfile * filename_exist(char * filename) |
| 148 | { | 148 | { |
| 149 | int i; | 149 | int i; |
| 150 | for (i=0; i < symfilecnt; i++) | 150 | for (i=0; i < symfilecnt; i++) |
| @@ -157,20 +157,20 @@ struct symfile * filename_exist(char * filename) | |||
| 157 | * List all files referenced within the template file. | 157 | * List all files referenced within the template file. |
| 158 | * Files are separated by tabs. | 158 | * Files are separated by tabs. |
| 159 | */ | 159 | */ |
| 160 | void adddep(char * file) { printf("\t%s", file); } | 160 | static void adddep(char * file) { printf("\t%s", file); } |
| 161 | void adddep2(char * file, char * line) { line = line; adddep(file); } | 161 | static void adddep2(char * file, char * line) { line = line; adddep(file); } |
| 162 | void noaction(char * line) { line = line; } | 162 | static void noaction(char * line) { line = line; } |
| 163 | void noaction2(char * file, char * line) { file = file; line = line; } | 163 | static void noaction2(char * file, char * line) { file = file; line = line; } |
| 164 | 164 | ||
| 165 | /* Echo the line without further action */ | 165 | /* Echo the line without further action */ |
| 166 | void printline(char * line) { printf("%s", line); } | 166 | static void printline(char * line) { printf("%s", line); } |
| 167 | 167 | ||
| 168 | /* | 168 | /* |
| 169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & | 169 | * Find all symbols in filename that are exported with EXPORT_SYMBOL & |
| 170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). | 170 | * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). |
| 171 | * All symbols located are stored in symfilelist. | 171 | * All symbols located are stored in symfilelist. |
| 172 | */ | 172 | */ |
| 173 | void find_export_symbols(char * filename) | 173 | static void find_export_symbols(char * filename) |
| 174 | { | 174 | { |
| 175 | FILE * fp; | 175 | FILE * fp; |
| 176 | struct symfile *sym; | 176 | struct symfile *sym; |
| @@ -227,7 +227,7 @@ void find_export_symbols(char * filename) | |||
| 227 | * intfunc uses -nofunction | 227 | * intfunc uses -nofunction |
| 228 | * extfunc uses -function | 228 | * extfunc uses -function |
| 229 | */ | 229 | */ |
| 230 | void docfunctions(char * filename, char * type) | 230 | static void docfunctions(char * filename, char * type) |
| 231 | { | 231 | { |
| 232 | int i,j; | 232 | int i,j; |
| 233 | int symcnt = 0; | 233 | int symcnt = 0; |
| @@ -258,15 +258,15 @@ void docfunctions(char * filename, char * type) | |||
| 258 | fflush(stdout); | 258 | fflush(stdout); |
| 259 | free(vec); | 259 | free(vec); |
| 260 | } | 260 | } |
| 261 | void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } | 261 | static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } |
| 262 | void extfunc(char * filename) { docfunctions(filename, FUNCTION); } | 262 | static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } |
| 263 | 263 | ||
| 264 | /* | 264 | /* |
| 265 | * Document specific function(s) in a file. | 265 | * Document specific function(s) in a file. |
| 266 | * Call kernel-doc with the following parameters: | 266 | * Call kernel-doc with the following parameters: |
| 267 | * kernel-doc -docbook -function function1 [-function function2] | 267 | * kernel-doc -docbook -function function1 [-function function2] |
| 268 | */ | 268 | */ |
| 269 | void singfunc(char * filename, char * line) | 269 | static void singfunc(char * filename, char * line) |
| 270 | { | 270 | { |
| 271 | char *vec[200]; /* Enough for specific functions */ | 271 | char *vec[200]; /* Enough for specific functions */ |
| 272 | int i, idx = 0; | 272 | int i, idx = 0; |
| @@ -297,7 +297,7 @@ void singfunc(char * filename, char * line) | |||
| 297 | * Call kernel-doc with the following parameters: | 297 | * Call kernel-doc with the following parameters: |
| 298 | * kernel-doc -docbook -function "doc section" filename | 298 | * kernel-doc -docbook -function "doc section" filename |
| 299 | */ | 299 | */ |
| 300 | void docsect(char *filename, char *line) | 300 | static void docsect(char *filename, char *line) |
| 301 | { | 301 | { |
| 302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ | 302 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ |
| 303 | char *s; | 303 | char *s; |
| @@ -324,7 +324,7 @@ void docsect(char *filename, char *line) | |||
| 324 | * 5) Lines containing !P | 324 | * 5) Lines containing !P |
| 325 | * 6) Default lines - lines not matching the above | 325 | * 6) Default lines - lines not matching the above |
| 326 | */ | 326 | */ |
| 327 | void parse_file(FILE *infile) | 327 | static void parse_file(FILE *infile) |
| 328 | { | 328 | { |
| 329 | char line[MAXLINESZ]; | 329 | char line[MAXLINESZ]; |
| 330 | char * s; | 330 | char * s; |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 72c15205bb2b..6bf21f83837d 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
| @@ -16,8 +16,7 @@ | |||
| 16 | * tells make when to remake a file. | 16 | * tells make when to remake a file. |
| 17 | * | 17 | * |
| 18 | * To use this list as-is however has the drawback that virtually | 18 | * To use this list as-is however has the drawback that virtually |
| 19 | * every file in the kernel includes <linux/config.h> which then again | 19 | * every file in the kernel includes <linux/autoconf.h>. |
| 20 | * includes <linux/autoconf.h> | ||
| 21 | * | 20 | * |
| 22 | * If the user re-runs make *config, linux/autoconf.h will be | 21 | * If the user re-runs make *config, linux/autoconf.h will be |
| 23 | * regenerated. make notices that and will rebuild every file which | 22 | * regenerated. make notices that and will rebuild every file which |
| @@ -125,8 +124,7 @@ char *target; | |||
| 125 | char *depfile; | 124 | char *depfile; |
| 126 | char *cmdline; | 125 | char *cmdline; |
| 127 | 126 | ||
| 128 | void usage(void) | 127 | static void usage(void) |
| 129 | |||
| 130 | { | 128 | { |
| 131 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | 129 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); |
| 132 | exit(1); | 130 | exit(1); |
| @@ -135,7 +133,7 @@ void usage(void) | |||
| 135 | /* | 133 | /* |
| 136 | * Print out the commandline prefixed with cmd_<target filename> := | 134 | * Print out the commandline prefixed with cmd_<target filename> := |
| 137 | */ | 135 | */ |
| 138 | void print_cmdline(void) | 136 | static void print_cmdline(void) |
| 139 | { | 137 | { |
| 140 | printf("cmd_%s := %s\n\n", target, cmdline); | 138 | printf("cmd_%s := %s\n\n", target, cmdline); |
| 141 | } | 139 | } |
| @@ -148,7 +146,7 @@ int len_config = 0; | |||
| 148 | * Grow the configuration string to a desired length. | 146 | * Grow the configuration string to a desired length. |
| 149 | * Usually the first growth is plenty. | 147 | * Usually the first growth is plenty. |
| 150 | */ | 148 | */ |
| 151 | void grow_config(int len) | 149 | static void grow_config(int len) |
| 152 | { | 150 | { |
| 153 | while (len_config + len > size_config) { | 151 | while (len_config + len > size_config) { |
| 154 | if (size_config == 0) | 152 | if (size_config == 0) |
| @@ -164,7 +162,7 @@ void grow_config(int len) | |||
| 164 | /* | 162 | /* |
| 165 | * Lookup a value in the configuration string. | 163 | * Lookup a value in the configuration string. |
| 166 | */ | 164 | */ |
| 167 | int is_defined_config(const char * name, int len) | 165 | static int is_defined_config(const char * name, int len) |
| 168 | { | 166 | { |
| 169 | const char * pconfig; | 167 | const char * pconfig; |
| 170 | const char * plast = str_config + len_config - len; | 168 | const char * plast = str_config + len_config - len; |
| @@ -180,7 +178,7 @@ int is_defined_config(const char * name, int len) | |||
| 180 | /* | 178 | /* |
| 181 | * Add a new value to the configuration string. | 179 | * Add a new value to the configuration string. |
| 182 | */ | 180 | */ |
| 183 | void define_config(const char * name, int len) | 181 | static void define_config(const char * name, int len) |
| 184 | { | 182 | { |
| 185 | grow_config(len + 1); | 183 | grow_config(len + 1); |
| 186 | 184 | ||
| @@ -192,7 +190,7 @@ void define_config(const char * name, int len) | |||
| 192 | /* | 190 | /* |
| 193 | * Clear the set of configuration strings. | 191 | * Clear the set of configuration strings. |
| 194 | */ | 192 | */ |
| 195 | void clear_config(void) | 193 | static void clear_config(void) |
| 196 | { | 194 | { |
| 197 | len_config = 0; | 195 | len_config = 0; |
| 198 | define_config("", 0); | 196 | define_config("", 0); |
| @@ -201,7 +199,7 @@ void clear_config(void) | |||
| 201 | /* | 199 | /* |
| 202 | * Record the use of a CONFIG_* word. | 200 | * Record the use of a CONFIG_* word. |
| 203 | */ | 201 | */ |
| 204 | void use_config(char *m, int slen) | 202 | static void use_config(char *m, int slen) |
| 205 | { | 203 | { |
| 206 | char s[PATH_MAX]; | 204 | char s[PATH_MAX]; |
| 207 | char *p; | 205 | char *p; |
| @@ -222,7 +220,7 @@ void use_config(char *m, int slen) | |||
| 222 | printf(" $(wildcard include/config/%s.h) \\\n", s); | 220 | printf(" $(wildcard include/config/%s.h) \\\n", s); |
| 223 | } | 221 | } |
| 224 | 222 | ||
| 225 | void parse_config_file(char *map, size_t len) | 223 | static void parse_config_file(char *map, size_t len) |
| 226 | { | 224 | { |
| 227 | int *end = (int *) (map + len); | 225 | int *end = (int *) (map + len); |
| 228 | /* start at +1, so that p can never be < map */ | 226 | /* start at +1, so that p can never be < map */ |
| @@ -256,7 +254,7 @@ void parse_config_file(char *map, size_t len) | |||
| 256 | } | 254 | } |
| 257 | 255 | ||
| 258 | /* test is s ends in sub */ | 256 | /* test is s ends in sub */ |
| 259 | int strrcmp(char *s, char *sub) | 257 | static int strrcmp(char *s, char *sub) |
| 260 | { | 258 | { |
| 261 | int slen = strlen(s); | 259 | int slen = strlen(s); |
| 262 | int sublen = strlen(sub); | 260 | int sublen = strlen(sub); |
| @@ -267,7 +265,7 @@ int strrcmp(char *s, char *sub) | |||
| 267 | return memcmp(s + slen - sublen, sub, sublen); | 265 | return memcmp(s + slen - sublen, sub, sublen); |
| 268 | } | 266 | } |
| 269 | 267 | ||
| 270 | void do_config_file(char *filename) | 268 | static void do_config_file(char *filename) |
| 271 | { | 269 | { |
| 272 | struct stat st; | 270 | struct stat st; |
| 273 | int fd; | 271 | int fd; |
| @@ -298,7 +296,7 @@ void do_config_file(char *filename) | |||
| 298 | close(fd); | 296 | close(fd); |
| 299 | } | 297 | } |
| 300 | 298 | ||
| 301 | void parse_dep_file(void *map, size_t len) | 299 | static void parse_dep_file(void *map, size_t len) |
| 302 | { | 300 | { |
| 303 | char *m = map; | 301 | char *m = map; |
| 304 | char *end = m + len; | 302 | char *end = m + len; |
| @@ -338,7 +336,7 @@ void parse_dep_file(void *map, size_t len) | |||
| 338 | printf("$(deps_%s):\n", target); | 336 | printf("$(deps_%s):\n", target); |
| 339 | } | 337 | } |
| 340 | 338 | ||
| 341 | void print_deps(void) | 339 | static void print_deps(void) |
| 342 | { | 340 | { |
| 343 | struct stat st; | 341 | struct stat st; |
| 344 | int fd; | 342 | int fd; |
| @@ -370,7 +368,7 @@ void print_deps(void) | |||
| 370 | close(fd); | 368 | close(fd); |
| 371 | } | 369 | } |
| 372 | 370 | ||
| 373 | void traps(void) | 371 | static void traps(void) |
| 374 | { | 372 | { |
| 375 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; | 373 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; |
| 376 | int *p = (int *)test; | 374 | int *p = (int *)test; |
diff --git a/scripts/basic/hash.c b/scripts/basic/hash.c index 3299ad7fc8c0..2ef5d3f666b8 100644 --- a/scripts/basic/hash.c +++ b/scripts/basic/hash.c | |||
| @@ -21,7 +21,7 @@ static void usage(void) | |||
| 21 | * http://www.cse.yorku.ca/~oz/hash.html | 21 | * http://www.cse.yorku.ca/~oz/hash.html |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | unsigned int djb2_hash(char *str) | 24 | static unsigned int djb2_hash(char *str) |
| 25 | { | 25 | { |
| 26 | unsigned long hash = 5381; | 26 | unsigned long hash = 5381; |
| 27 | int c; | 27 | int c; |
| @@ -34,7 +34,7 @@ unsigned int djb2_hash(char *str) | |||
| 34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); | 34 | return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | unsigned int r5_hash(char *str) | 37 | static unsigned int r5_hash(char *str) |
| 38 | { | 38 | { |
| 39 | unsigned long hash = 0; | 39 | unsigned long hash = 0; |
| 40 | int c; | 40 | int c; |
diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl index 8e6b716c191c..676ddc07d6fa 100755 --- a/scripts/checkincludes.pl +++ b/scripts/checkincludes.pl | |||
| @@ -1,24 +1,85 @@ | |||
| 1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
| 2 | # | 2 | # |
| 3 | # checkincludes: Find files included more than once in (other) files. | 3 | # checkincludes: find/remove files included more than once |
| 4 | # | ||
| 4 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. | 5 | # Copyright abandoned, 2000, Niels Kristian Bech Jensen <nkbj@image.dk>. |
| 6 | # Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> | ||
| 7 | # | ||
| 8 | # This script checks for duplicate includes. It also has support | ||
| 9 | # to remove them in place. Note that this will not take into | ||
| 10 | # consideration macros so you should run this only if you know | ||
| 11 | # you do have real dups and do not have them under #ifdef's. You | ||
| 12 | # could also just review the results. | ||
| 13 | |||
| 14 | sub usage { | ||
| 15 | print "Usage: checkincludes.pl [-r]\n"; | ||
| 16 | print "By default we just warn of duplicates\n"; | ||
| 17 | print "To remove duplicated includes in place use -r\n"; | ||
| 18 | exit 1; | ||
| 19 | } | ||
| 20 | |||
| 21 | my $remove = 0; | ||
| 22 | |||
| 23 | if ($#ARGV < 0) { | ||
| 24 | usage(); | ||
| 25 | } | ||
| 26 | |||
| 27 | if ($#ARGV >= 1) { | ||
| 28 | if ($ARGV[0] =~ /^-/) { | ||
| 29 | if ($ARGV[0] eq "-r") { | ||
| 30 | $remove = 1; | ||
| 31 | shift; | ||
| 32 | } else { | ||
| 33 | usage(); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 5 | 37 | ||
| 6 | foreach $file (@ARGV) { | 38 | foreach $file (@ARGV) { |
| 7 | open(FILE, $file) or die "Cannot open $file: $!.\n"; | 39 | open(FILE, $file) or die "Cannot open $file: $!.\n"; |
| 8 | 40 | ||
| 9 | my %includedfiles = (); | 41 | my %includedfiles = (); |
| 42 | my @file_lines = (); | ||
| 10 | 43 | ||
| 11 | while (<FILE>) { | 44 | while (<FILE>) { |
| 12 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | 45 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { |
| 13 | ++$includedfiles{$1}; | 46 | ++$includedfiles{$1}; |
| 14 | } | 47 | } |
| 48 | push(@file_lines, $_); | ||
| 15 | } | 49 | } |
| 16 | 50 | ||
| 17 | foreach $filename (keys %includedfiles) { | 51 | close(FILE); |
| 18 | if ($includedfiles{$filename} > 1) { | 52 | |
| 19 | print "$file: $filename is included more than once.\n"; | 53 | if (!$remove) { |
| 54 | foreach $filename (keys %includedfiles) { | ||
| 55 | if ($includedfiles{$filename} > 1) { | ||
| 56 | print "$file: $filename is included more than once.\n"; | ||
| 57 | } | ||
| 20 | } | 58 | } |
| 59 | next; | ||
| 21 | } | 60 | } |
| 22 | 61 | ||
| 62 | open(FILE,">$file") || die("Cannot write to $file: $!"); | ||
| 63 | |||
| 64 | my $dups = 0; | ||
| 65 | foreach (@file_lines) { | ||
| 66 | if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { | ||
| 67 | foreach $filename (keys %includedfiles) { | ||
| 68 | if ($1 eq $filename) { | ||
| 69 | if ($includedfiles{$filename} > 1) { | ||
| 70 | $includedfiles{$filename}--; | ||
| 71 | $dups++; | ||
| 72 | } else { | ||
| 73 | print FILE $_; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } else { | ||
| 78 | print FILE $_; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | if ($dups > 0) { | ||
| 82 | print "$file: removed $dups duplicate includes\n"; | ||
| 83 | } | ||
| 23 | close(FILE); | 84 | close(FILE); |
| 24 | } | 85 | } |
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh index 39677c82747a..46be3c5a62b7 100755 --- a/scripts/checkkconfigsymbols.sh +++ b/scripts/checkkconfigsymbols.sh | |||
| @@ -9,7 +9,7 @@ paths="$@" | |||
| 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. |
| 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" |
| 11 | 11 | ||
| 12 | echo -e "File list \tundefined symbol used" | 12 | /bin/echo -e "File list \tundefined symbol used" |
| 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i |
| 14 | do | 14 | do |
| 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
| @@ -54,6 +54,6 @@ while read symb files; do | |||
| 54 | # beyond the purpose of this script. | 54 | # beyond the purpose of this script. |
| 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` |
| 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then |
| 57 | echo -e "$files: \t$symb" | 57 | /bin/echo -e "$files: \t$symb" |
| 58 | fi | 58 | fi |
| 59 | done|sort | 59 | done|sort |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4c..bc4114f1ab30 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) | 2 | # (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) |
| 3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) | 3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) |
| 4 | # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) | 4 | # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) |
| 5 | # (c) 2008, Andy Whitcroft <apw@canonical.com> | 5 | # (c) 2008,2009, Andy Whitcroft <apw@canonical.com> |
| 6 | # Licensed under the terms of the GNU GPL License version 2 | 6 | # Licensed under the terms of the GNU GPL License version 2 |
| 7 | 7 | ||
| 8 | use strict; | 8 | use strict; |
| @@ -10,7 +10,7 @@ use strict; | |||
| 10 | my $P = $0; | 10 | my $P = $0; |
| 11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
| 12 | 12 | ||
| 13 | my $V = '0.28'; | 13 | my $V = '0.30'; |
| 14 | 14 | ||
| 15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
| 16 | 16 | ||
| @@ -28,6 +28,41 @@ my $mailback = 0; | |||
| 28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
| 29 | my $root; | 29 | my $root; |
| 30 | my %debug; | 30 | my %debug; |
| 31 | my $help = 0; | ||
| 32 | |||
| 33 | sub help { | ||
| 34 | my ($exitcode) = @_; | ||
| 35 | |||
| 36 | print << "EOM"; | ||
| 37 | Usage: $P [OPTION]... [FILE]... | ||
| 38 | Version: $V | ||
| 39 | |||
| 40 | Options: | ||
| 41 | -q, --quiet quiet | ||
| 42 | --no-tree run without a kernel tree | ||
| 43 | --no-signoff do not check for 'Signed-off-by' line | ||
| 44 | --patch treat FILE as patchfile (default) | ||
| 45 | --emacs emacs compile window format | ||
| 46 | --terse one line per report | ||
| 47 | -f, --file treat FILE as regular source file | ||
| 48 | --subjective, --strict enable more subjective tests | ||
| 49 | --root=PATH PATH to the kernel tree root | ||
| 50 | --no-summary suppress the per-file summary | ||
| 51 | --mailback only produce a report in case of warnings/errors | ||
| 52 | --summary-file include the filename in summary | ||
| 53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
| 54 | 'values', 'possible', 'type', and 'attr' (default | ||
| 55 | is all off) | ||
| 56 | --test-only=WORD report only warnings/errors containing WORD | ||
| 57 | literally | ||
| 58 | -h, --help, --version display this help and exit | ||
| 59 | |||
| 60 | When FILE is - read standard input. | ||
| 61 | EOM | ||
| 62 | |||
| 63 | exit($exitcode); | ||
| 64 | } | ||
| 65 | |||
| 31 | GetOptions( | 66 | GetOptions( |
| 32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
| 33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
| @@ -35,7 +70,7 @@ GetOptions( | |||
| 35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
| 36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
| 37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
| 38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
| 39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
| 40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
| 41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
| @@ -45,22 +80,16 @@ GetOptions( | |||
| 45 | 80 | ||
| 46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
| 47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
| 48 | ) or exit; | 83 | 'h|help' => \$help, |
| 84 | 'version' => \$help | ||
| 85 | ) or help(1); | ||
| 86 | |||
| 87 | help(0) if ($help); | ||
| 49 | 88 | ||
| 50 | my $exit = 0; | 89 | my $exit = 0; |
| 51 | 90 | ||
| 52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
| 53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
| 54 | print "version: $V\n"; | ||
| 55 | print "options: -q => quiet\n"; | ||
| 56 | print " --no-tree => run without a kernel tree\n"; | ||
| 57 | print " --terse => one line per report\n"; | ||
| 58 | print " --emacs => emacs compile window format\n"; | ||
| 59 | print " --file => check a source file\n"; | ||
| 60 | print " --strict => enable more subjective tests\n"; | ||
| 61 | print " --root => path to the kernel tree root\n"; | ||
| 62 | print " --no-summary => suppress the per-file summary\n"; | ||
| 63 | print " --summary-file => include the filename in summary\n"; | ||
| 64 | exit(1); | 93 | exit(1); |
| 65 | } | 94 | } |
| 66 | 95 | ||
| @@ -101,7 +130,10 @@ if ($tree) { | |||
| 101 | 130 | ||
| 102 | my $emitted_corrupt = 0; | 131 | my $emitted_corrupt = 0; |
| 103 | 132 | ||
| 104 | our $Ident = qr{[A-Za-z_][A-Za-z\d_]*}; | 133 | our $Ident = qr{ |
| 134 | [A-Za-z_][A-Za-z\d_]* | ||
| 135 | (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* | ||
| 136 | }x; | ||
| 105 | our $Storage = qr{extern|static|asmlinkage}; | 137 | our $Storage = qr{extern|static|asmlinkage}; |
| 106 | our $Sparse = qr{ | 138 | our $Sparse = qr{ |
| 107 | __user| | 139 | __user| |
| @@ -153,7 +185,7 @@ our $UTF8 = qr { | |||
| 153 | }x; | 185 | }x; |
| 154 | 186 | ||
| 155 | our $typeTypedefs = qr{(?x: | 187 | our $typeTypedefs = qr{(?x: |
| 156 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | 188 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
| 157 | atomic_t | 189 | atomic_t |
| 158 | )}; | 190 | )}; |
| 159 | 191 | ||
| @@ -356,6 +388,13 @@ sub sanitise_line { | |||
| 356 | $off++; | 388 | $off++; |
| 357 | next; | 389 | next; |
| 358 | } | 390 | } |
| 391 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
| 392 | $sanitise_quote = '//'; | ||
| 393 | |||
| 394 | substr($res, $off, 2, $sanitise_quote); | ||
| 395 | $off++; | ||
| 396 | next; | ||
| 397 | } | ||
| 359 | 398 | ||
| 360 | # A \ in a string means ignore the next character. | 399 | # A \ in a string means ignore the next character. |
| 361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 400 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
| @@ -379,6 +418,8 @@ sub sanitise_line { | |||
| 379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 418 | #print "c<$c> SQ<$sanitise_quote>\n"; |
| 380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 419 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
| 381 | substr($res, $off, 1, $;); | 420 | substr($res, $off, 1, $;); |
| 421 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
| 422 | substr($res, $off, 1, $;); | ||
| 382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 423 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
| 383 | substr($res, $off, 1, 'X'); | 424 | substr($res, $off, 1, 'X'); |
| 384 | } else { | 425 | } else { |
| @@ -386,6 +427,10 @@ sub sanitise_line { | |||
| 386 | } | 427 | } |
| 387 | } | 428 | } |
| 388 | 429 | ||
| 430 | if ($sanitise_quote eq '//') { | ||
| 431 | $sanitise_quote = ''; | ||
| 432 | } | ||
| 433 | |||
| 389 | # The pathname on a #include may be surrounded by '<' and '>'. | 434 | # The pathname on a #include may be surrounded by '<' and '>'. |
| 390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 435 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
| 391 | my $clean = 'X' x length($1); | 436 | my $clean = 'X' x length($1); |
| @@ -955,23 +1000,25 @@ sub annotate_values { | |||
| 955 | 1000 | ||
| 956 | sub possible { | 1001 | sub possible { |
| 957 | my ($possible, $line) = @_; | 1002 | my ($possible, $line) = @_; |
| 958 | 1003 | my $notPermitted = qr{(?: | |
| 959 | print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
| 960 | if ($possible !~ /(?: | ||
| 961 | ^(?: | 1004 | ^(?: |
| 962 | $Modifier| | 1005 | $Modifier| |
| 963 | $Storage| | 1006 | $Storage| |
| 964 | $Type| | 1007 | $Type| |
| 965 | DEFINE_\S+| | 1008 | DEFINE_\S+ |
| 1009 | )$| | ||
| 1010 | ^(?: | ||
| 966 | goto| | 1011 | goto| |
| 967 | return| | 1012 | return| |
| 968 | case| | 1013 | case| |
| 969 | else| | 1014 | else| |
| 970 | asm|__asm__| | 1015 | asm|__asm__| |
| 971 | do | 1016 | do |
| 972 | )$| | 1017 | )(?:\s|$)| |
| 973 | ^(?:typedef|struct|enum)\b | 1018 | ^(?:typedef|struct|enum)\b |
| 974 | )/x) { | 1019 | )}x; |
| 1020 | warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
| 1021 | if ($possible !~ $notPermitted) { | ||
| 975 | # Check for modifiers. | 1022 | # Check for modifiers. |
| 976 | $possible =~ s/\s*$Storage\s*//g; | 1023 | $possible =~ s/\s*$Storage\s*//g; |
| 977 | $possible =~ s/\s*$Sparse\s*//g; | 1024 | $possible =~ s/\s*$Sparse\s*//g; |
| @@ -980,8 +1027,10 @@ sub possible { | |||
| 980 | } elsif ($possible =~ /\s/) { | 1027 | } elsif ($possible =~ /\s/) { |
| 981 | $possible =~ s/\s*$Type\s*//g; | 1028 | $possible =~ s/\s*$Type\s*//g; |
| 982 | for my $modifier (split(' ', $possible)) { | 1029 | for my $modifier (split(' ', $possible)) { |
| 983 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); | 1030 | if ($modifier !~ $notPermitted) { |
| 984 | push(@modifierList, $modifier); | 1031 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); |
| 1032 | push(@modifierList, $modifier); | ||
| 1033 | } | ||
| 985 | } | 1034 | } |
| 986 | 1035 | ||
| 987 | } else { | 1036 | } else { |
| @@ -1096,6 +1145,7 @@ sub process { | |||
| 1096 | # suppression flags | 1145 | # suppression flags |
| 1097 | my %suppress_ifbraces; | 1146 | my %suppress_ifbraces; |
| 1098 | my %suppress_whiletrailers; | 1147 | my %suppress_whiletrailers; |
| 1148 | my %suppress_export; | ||
| 1099 | 1149 | ||
| 1100 | # Pre-scan the patch sanitizing the lines. | 1150 | # Pre-scan the patch sanitizing the lines. |
| 1101 | # Pre-scan the patch looking for any __setup documentation. | 1151 | # Pre-scan the patch looking for any __setup documentation. |
| @@ -1188,7 +1238,6 @@ sub process { | |||
| 1188 | $linenr++; | 1238 | $linenr++; |
| 1189 | 1239 | ||
| 1190 | my $rawline = $rawlines[$linenr - 1]; | 1240 | my $rawline = $rawlines[$linenr - 1]; |
| 1191 | my $hunk_line = ($realcnt != 0); | ||
| 1192 | 1241 | ||
| 1193 | #extract the line range in the file after the patch is applied | 1242 | #extract the line range in the file after the patch is applied |
| 1194 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 1243 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { |
| @@ -1205,6 +1254,7 @@ sub process { | |||
| 1205 | 1254 | ||
| 1206 | %suppress_ifbraces = (); | 1255 | %suppress_ifbraces = (); |
| 1207 | %suppress_whiletrailers = (); | 1256 | %suppress_whiletrailers = (); |
| 1257 | %suppress_export = (); | ||
| 1208 | next; | 1258 | next; |
| 1209 | 1259 | ||
| 1210 | # track the line number as we move through the hunk, note that | 1260 | # track the line number as we move through the hunk, note that |
| @@ -1228,6 +1278,8 @@ sub process { | |||
| 1228 | $realcnt--; | 1278 | $realcnt--; |
| 1229 | } | 1279 | } |
| 1230 | 1280 | ||
| 1281 | my $hunk_line = ($realcnt != 0); | ||
| 1282 | |||
| 1231 | #make up the handle for any error we report on this line | 1283 | #make up the handle for any error we report on this line |
| 1232 | $prefix = "$filename:$realline: " if ($emacs && $file); | 1284 | $prefix = "$filename:$realline: " if ($emacs && $file); |
| 1233 | $prefix = "$filename:$linenr: " if ($emacs && !$file); | 1285 | $prefix = "$filename:$linenr: " if ($emacs && !$file); |
| @@ -1336,6 +1388,18 @@ sub process { | |||
| 1336 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1388 | WARN("adding a line without newline at end of file\n" . $herecurr); |
| 1337 | } | 1389 | } |
| 1338 | 1390 | ||
| 1391 | # Blackfin: use hi/lo macros | ||
| 1392 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | ||
| 1393 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | ||
| 1394 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
| 1395 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
| 1396 | } | ||
| 1397 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | ||
| 1398 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
| 1399 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | ||
| 1400 | } | ||
| 1401 | } | ||
| 1402 | |||
| 1339 | # check we are in a valid source file C or perl if not then ignore this hunk | 1403 | # check we are in a valid source file C or perl if not then ignore this hunk |
| 1340 | next if ($realfile !~ /\.(h|c|pl)$/); | 1404 | next if ($realfile !~ /\.(h|c|pl)$/); |
| 1341 | 1405 | ||
| @@ -1355,14 +1419,33 @@ sub process { | |||
| 1355 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1419 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
| 1356 | } | 1420 | } |
| 1357 | 1421 | ||
| 1422 | # Blackfin: don't use __builtin_bfin_[cs]sync | ||
| 1423 | if ($line =~ /__builtin_bfin_csync/) { | ||
| 1424 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
| 1425 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
| 1426 | } | ||
| 1427 | if ($line =~ /__builtin_bfin_ssync/) { | ||
| 1428 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
| 1429 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
| 1430 | } | ||
| 1431 | |||
| 1358 | # Check for potential 'bare' types | 1432 | # Check for potential 'bare' types |
| 1359 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); | 1433 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next, |
| 1434 | $realline_next); | ||
| 1360 | if ($realcnt && $line =~ /.\s*\S/) { | 1435 | if ($realcnt && $line =~ /.\s*\S/) { |
| 1361 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = | 1436 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = |
| 1362 | ctx_statement_block($linenr, $realcnt, 0); | 1437 | ctx_statement_block($linenr, $realcnt, 0); |
| 1363 | $stat =~ s/\n./\n /g; | 1438 | $stat =~ s/\n./\n /g; |
| 1364 | $cond =~ s/\n./\n /g; | 1439 | $cond =~ s/\n./\n /g; |
| 1365 | 1440 | ||
| 1441 | # Find the real next line. | ||
| 1442 | $realline_next = $line_nr_next; | ||
| 1443 | if (defined $realline_next && | ||
| 1444 | (!defined $lines[$realline_next - 1] || | ||
| 1445 | substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) { | ||
| 1446 | $realline_next++; | ||
| 1447 | } | ||
| 1448 | |||
| 1366 | my $s = $stat; | 1449 | my $s = $stat; |
| 1367 | $s =~ s/{.*$//s; | 1450 | $s =~ s/{.*$//s; |
| 1368 | 1451 | ||
| @@ -1372,6 +1455,8 @@ sub process { | |||
| 1372 | # Ignore functions being called | 1455 | # Ignore functions being called |
| 1373 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1456 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
| 1374 | 1457 | ||
| 1458 | } elsif ($s =~ /^.\s*else\b/s) { | ||
| 1459 | |||
| 1375 | # declarations always start with types | 1460 | # declarations always start with types |
| 1376 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { | 1461 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { |
| 1377 | my $type = $1; | 1462 | my $type = $1; |
| @@ -1532,8 +1617,9 @@ sub process { | |||
| 1532 | $s =~ /^\s*#\s*?/ || | 1617 | $s =~ /^\s*#\s*?/ || |
| 1533 | $s =~ /^\s*$Ident\s*:/) { | 1618 | $s =~ /^\s*$Ident\s*:/) { |
| 1534 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | 1619 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; |
| 1535 | $s =~ s/^.*?\n//; | 1620 | if ($s =~ s/^.*?\n//) { |
| 1536 | $cond_lines++; | 1621 | $cond_lines++; |
| 1622 | } | ||
| 1537 | } | 1623 | } |
| 1538 | } | 1624 | } |
| 1539 | 1625 | ||
| @@ -1594,8 +1680,8 @@ sub process { | |||
| 1594 | } | 1680 | } |
| 1595 | 1681 | ||
| 1596 | # check for initialisation to aggregates open brace on the next line | 1682 | # check for initialisation to aggregates open brace on the next line |
| 1597 | if ($prevline =~ /$Declare\s*$Ident\s*=\s*$/ && | 1683 | if ($line =~ /^.\s*{/ && |
| 1598 | $line =~ /^.\s*{/) { | 1684 | $prevline =~ /(?:^|[^=])=\s*$/) { |
| 1599 | ERROR("that open brace { should be on the previous line\n" . $hereprev); | 1685 | ERROR("that open brace { should be on the previous line\n" . $hereprev); |
| 1600 | } | 1686 | } |
| 1601 | 1687 | ||
| @@ -1620,21 +1706,40 @@ sub process { | |||
| 1620 | $line =~ s@//.*@@; | 1706 | $line =~ s@//.*@@; |
| 1621 | $opline =~ s@//.*@@; | 1707 | $opline =~ s@//.*@@; |
| 1622 | 1708 | ||
| 1623 | #EXPORT_SYMBOL should immediately follow its function closing }. | 1709 | # EXPORT_SYMBOL should immediately follow the thing it is exporting, consider |
| 1624 | if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || | 1710 | # the whole statement. |
| 1625 | ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | 1711 | #print "APW <$lines[$realline_next - 1]>\n"; |
| 1712 | if (defined $realline_next && | ||
| 1713 | exists $lines[$realline_next - 1] && | ||
| 1714 | !defined $suppress_export{$realline_next} && | ||
| 1715 | ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
| 1716 | $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
| 1626 | my $name = $1; | 1717 | my $name = $1; |
| 1627 | if ($prevline !~ /(?: | 1718 | if ($stat !~ /(?: |
| 1628 | ^.}| | 1719 | \n.}\s*$| |
| 1629 | ^.DEFINE_$Ident\(\Q$name\E\)| | 1720 | ^.DEFINE_$Ident\(\Q$name\E\)| |
| 1630 | ^.DECLARE_$Ident\(\Q$name\E\)| | 1721 | ^.DECLARE_$Ident\(\Q$name\E\)| |
| 1631 | ^.LIST_HEAD\(\Q$name\E\)| | 1722 | ^.LIST_HEAD\(\Q$name\E\)| |
| 1632 | ^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| | 1723 | ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| |
| 1633 | \b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[) | 1724 | \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\() |
| 1634 | )/x) { | 1725 | )/x) { |
| 1635 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | 1726 | #print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n"; |
| 1727 | $suppress_export{$realline_next} = 2; | ||
| 1728 | } else { | ||
| 1729 | $suppress_export{$realline_next} = 1; | ||
| 1636 | } | 1730 | } |
| 1637 | } | 1731 | } |
| 1732 | if (!defined $suppress_export{$linenr} && | ||
| 1733 | $prevline =~ /^.\s*$/ && | ||
| 1734 | ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
| 1735 | $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
| 1736 | #print "FOO B <$lines[$linenr - 1]>\n"; | ||
| 1737 | $suppress_export{$linenr} = 2; | ||
| 1738 | } | ||
| 1739 | if (defined $suppress_export{$linenr} && | ||
| 1740 | $suppress_export{$linenr} == 2) { | ||
| 1741 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | ||
| 1742 | } | ||
| 1638 | 1743 | ||
| 1639 | # check for external initialisers. | 1744 | # check for external initialisers. |
| 1640 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { | 1745 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { |
| @@ -1891,7 +1996,7 @@ sub process { | |||
| 1891 | # A unary '*' may be const | 1996 | # A unary '*' may be const |
| 1892 | 1997 | ||
| 1893 | } elsif ($ctx =~ /.xW/) { | 1998 | } elsif ($ctx =~ /.xW/) { |
| 1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | 1999 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); |
| 1895 | } | 2000 | } |
| 1896 | 2001 | ||
| 1897 | # unary ++ and unary -- are allowed no space on one side. | 2002 | # unary ++ and unary -- are allowed no space on one side. |
| @@ -2243,7 +2348,8 @@ sub process { | |||
| 2243 | DECLARE_PER_CPU| | 2348 | DECLARE_PER_CPU| |
| 2244 | DEFINE_PER_CPU| | 2349 | DEFINE_PER_CPU| |
| 2245 | __typeof__\(| | 2350 | __typeof__\(| |
| 2246 | \.$Ident\s*=\s* | 2351 | \.$Ident\s*=\s*| |
| 2352 | ^\"|\"$ | ||
| 2247 | }x; | 2353 | }x; |
| 2248 | #print "REST<$rest> dstat<$dstat>\n"; | 2354 | #print "REST<$rest> dstat<$dstat>\n"; |
| 2249 | if ($rest ne '') { | 2355 | if ($rest ne '') { |
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c index e0c6891a9ad4..263a44d57fa9 100644 --- a/scripts/conmakehash.c +++ b/scripts/conmakehash.c | |||
| @@ -24,14 +24,14 @@ | |||
| 24 | 24 | ||
| 25 | typedef unsigned short unicode; | 25 | typedef unsigned short unicode; |
| 26 | 26 | ||
| 27 | void usage(char *argv0) | 27 | static void usage(char *argv0) |
| 28 | { | 28 | { |
| 29 | fprintf(stderr, "Usage: \n" | 29 | fprintf(stderr, "Usage: \n" |
| 30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); | 30 | " %s chartable [hashsize] [hashstep] [maxhashlevel]\n", argv0); |
| 31 | exit(EX_USAGE); | 31 | exit(EX_USAGE); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | int getunicode(char **p0) | 34 | static int getunicode(char **p0) |
| 35 | { | 35 | { |
| 36 | char *p = *p0; | 36 | char *p = *p0; |
| 37 | 37 | ||
| @@ -49,7 +49,7 @@ unicode unitable[MAX_FONTLEN][255]; | |||
| 49 | /* Massive overkill, but who cares? */ | 49 | /* Massive overkill, but who cares? */ |
| 50 | int unicount[MAX_FONTLEN]; | 50 | int unicount[MAX_FONTLEN]; |
| 51 | 51 | ||
| 52 | void addpair(int fp, int un) | 52 | static void addpair(int fp, int un) |
| 53 | { | 53 | { |
| 54 | int i; | 54 | int i; |
| 55 | 55 | ||
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb3..de233ff43c1c 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
| @@ -17,6 +17,10 @@ dump_config() { | |||
| 17 | return | 17 | return |
| 18 | fi | 18 | fi |
| 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
| 20 | [ "$?" != "0" ] && end="-1" | ||
| 21 | if [ "$end" -eq "-1" ]; then | ||
| 22 | return | ||
| 23 | fi | ||
| 20 | 24 | ||
| 21 | start=`expr $start + 8` | 25 | start=`expr $start + 8` |
| 22 | size=`expr $end - $start` | 26 | size=`expr $end - $start` |
| @@ -55,6 +59,8 @@ dump_config "$image" | |||
| 55 | GZHDR1="0x1f 0x8b 0x08 0x00" | 59 | GZHDR1="0x1f 0x8b 0x08 0x00" |
| 56 | GZHDR2="0x1f 0x8b 0x08 0x08" | 60 | GZHDR2="0x1f 0x8b 0x08 0x08" |
| 57 | 61 | ||
| 62 | ELFHDR="0x7f 0x45 0x4c 0x46" | ||
| 63 | |||
| 58 | # vmlinux.gz: Check for a compressed images | 64 | # vmlinux.gz: Check for a compressed images |
| 59 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` |
| 60 | [ "$?" != "0" ] && off="-1" | 66 | [ "$?" != "0" ] && off="-1" |
| @@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then | |||
| 69 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ | 75 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ |
| 70 | zcat >"$TMPFILE" | 76 | zcat >"$TMPFILE" |
| 71 | dump_config "$TMPFILE" | 77 | dump_config "$TMPFILE" |
| 78 | |||
| 79 | # check if this is simply an ELF file | ||
| 80 | else | ||
| 81 | off=`$binoffset "$image" $ELFHDR 2>/dev/null` | ||
| 82 | [ "$?" != "0" ] && off="-1" | ||
| 83 | if [ "$off" -eq "0" ]; then | ||
| 84 | dump_config "$image" | ||
| 85 | fi | ||
| 72 | fi | 86 | fi |
| 73 | 87 | ||
| 74 | echo "ERROR: Unable to extract kernel configuration information." | 88 | echo "ERROR: Unable to extract kernel configuration information." |
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 3a8297b5184c..af6b8363a2d5 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
| @@ -176,7 +176,7 @@ static int is_unknown_symbol(struct symbol *sym) | |||
| 176 | strcmp(defn->string, "{") == 0); | 176 | strcmp(defn->string, "{") == 0); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | struct symbol *__add_symbol(const char *name, enum symbol_type type, | 179 | static struct symbol *__add_symbol(const char *name, enum symbol_type type, |
| 180 | struct string_list *defn, int is_extern, | 180 | struct string_list *defn, int is_extern, |
| 181 | int is_reference) | 181 | int is_reference) |
| 182 | { | 182 | { |
| @@ -265,7 +265,7 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
| 265 | return __add_symbol(name, type, defn, is_extern, 0); | 265 | return __add_symbol(name, type, defn, is_extern, 0); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | struct symbol *add_reference_symbol(const char *name, enum symbol_type type, | 268 | static struct symbol *add_reference_symbol(const char *name, enum symbol_type type, |
| 269 | struct string_list *defn, int is_extern) | 269 | struct string_list *defn, int is_extern) |
| 270 | { | 270 | { |
| 271 | return __add_symbol(name, type, defn, is_extern, 1); | 271 | return __add_symbol(name, type, defn, is_extern, 1); |
| @@ -313,7 +313,7 @@ static int equal_list(struct string_list *a, struct string_list *b) | |||
| 313 | 313 | ||
| 314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | 314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
| 315 | 315 | ||
| 316 | struct string_list *read_node(FILE *f) | 316 | static struct string_list *read_node(FILE *f) |
| 317 | { | 317 | { |
| 318 | char buffer[256]; | 318 | char buffer[256]; |
| 319 | struct string_list node = { | 319 | struct string_list node = { |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 278a45bd45a5..102b76608f35 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | use strict; | 13 | use strict; |
| 14 | 14 | ||
| 15 | my $P = $0; | 15 | my $P = $0; |
| 16 | my $V = '0.17'; | 16 | my $V = '0.21'; |
| 17 | 17 | ||
| 18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
| 19 | 19 | ||
| @@ -29,13 +29,17 @@ my $email_git_min_signatures = 1; | |||
| 29 | my $email_git_max_maintainers = 5; | 29 | my $email_git_max_maintainers = 5; |
| 30 | my $email_git_min_percent = 5; | 30 | my $email_git_min_percent = 5; |
| 31 | my $email_git_since = "1-year-ago"; | 31 | my $email_git_since = "1-year-ago"; |
| 32 | my $email_git_blame = 0; | ||
| 33 | my $email_remove_duplicates = 1; | ||
| 32 | my $output_multiline = 1; | 34 | my $output_multiline = 1; |
| 33 | my $output_separator = ", "; | 35 | my $output_separator = ", "; |
| 34 | my $scm = 0; | 36 | my $scm = 0; |
| 35 | my $web = 0; | 37 | my $web = 0; |
| 36 | my $subsystem = 0; | 38 | my $subsystem = 0; |
| 37 | my $status = 0; | 39 | my $status = 0; |
| 40 | my $keywords = 1; | ||
| 38 | my $from_filename = 0; | 41 | my $from_filename = 0; |
| 42 | my $pattern_depth = 0; | ||
| 39 | my $version = 0; | 43 | my $version = 0; |
| 40 | my $help = 0; | 44 | my $help = 0; |
| 41 | 45 | ||
| @@ -68,6 +72,8 @@ if (!GetOptions( | |||
| 68 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 72 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
| 69 | 'git-min-percent=i' => \$email_git_min_percent, | 73 | 'git-min-percent=i' => \$email_git_min_percent, |
| 70 | 'git-since=s' => \$email_git_since, | 74 | 'git-since=s' => \$email_git_since, |
| 75 | 'git-blame!' => \$email_git_blame, | ||
| 76 | 'remove-duplicates!' => \$email_remove_duplicates, | ||
| 71 | 'm!' => \$email_maintainer, | 77 | 'm!' => \$email_maintainer, |
| 72 | 'n!' => \$email_usename, | 78 | 'n!' => \$email_usename, |
| 73 | 'l!' => \$email_list, | 79 | 'l!' => \$email_list, |
| @@ -78,6 +84,8 @@ if (!GetOptions( | |||
| 78 | 'status!' => \$status, | 84 | 'status!' => \$status, |
| 79 | 'scm!' => \$scm, | 85 | 'scm!' => \$scm, |
| 80 | 'web!' => \$web, | 86 | 'web!' => \$web, |
| 87 | 'pattern-depth=i' => \$pattern_depth, | ||
| 88 | 'k|keywords!' => \$keywords, | ||
| 81 | 'f|file' => \$from_filename, | 89 | 'f|file' => \$from_filename, |
| 82 | 'v|version' => \$version, | 90 | 'v|version' => \$version, |
| 83 | 'h|help' => \$help, | 91 | 'h|help' => \$help, |
| @@ -101,14 +109,19 @@ if ($#ARGV < 0) { | |||
| 101 | die "$P: argument missing: patchfile or -f file please\n"; | 109 | die "$P: argument missing: patchfile or -f file please\n"; |
| 102 | } | 110 | } |
| 103 | 111 | ||
| 112 | if ($output_separator ne ", ") { | ||
| 113 | $output_multiline = 0; | ||
| 114 | } | ||
| 115 | |||
| 104 | my $selections = $email + $scm + $status + $subsystem + $web; | 116 | my $selections = $email + $scm + $status + $subsystem + $web; |
| 105 | if ($selections == 0) { | 117 | if ($selections == 0) { |
| 106 | usage(); | 118 | usage(); |
| 107 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | 119 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; |
| 108 | } | 120 | } |
| 109 | 121 | ||
| 110 | if ($email && ($email_maintainer + $email_list + $email_subscriber_list | 122 | if ($email && |
| 111 | + $email_git + $email_git_penguin_chiefs) == 0) { | 123 | ($email_maintainer + $email_list + $email_subscriber_list + |
| 124 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { | ||
| 112 | usage(); | 125 | usage(); |
| 113 | die "$P: Please select at least 1 email option\n"; | 126 | die "$P: Please select at least 1 email option\n"; |
| 114 | } | 127 | } |
| @@ -121,6 +134,8 @@ if (!top_of_kernel_tree($lk_path)) { | |||
| 121 | ## Read MAINTAINERS for type/value pairs | 134 | ## Read MAINTAINERS for type/value pairs |
| 122 | 135 | ||
| 123 | my @typevalue = (); | 136 | my @typevalue = (); |
| 137 | my %keyword_hash; | ||
| 138 | |||
| 124 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; | 139 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; |
| 125 | while (<MAINT>) { | 140 | while (<MAINT>) { |
| 126 | my $line = $_; | 141 | my $line = $_; |
| @@ -138,6 +153,8 @@ while (<MAINT>) { | |||
| 138 | if ((-d $value)) { | 153 | if ((-d $value)) { |
| 139 | $value =~ s@([^/])$@$1/@; | 154 | $value =~ s@([^/])$@$1/@; |
| 140 | } | 155 | } |
| 156 | } elsif ($type eq "K") { | ||
| 157 | $keyword_hash{@typevalue} = $value; | ||
| 141 | } | 158 | } |
| 142 | push(@typevalue, "$type:$value"); | 159 | push(@typevalue, "$type:$value"); |
| 143 | } elsif (!/^(\s)*$/) { | 160 | } elsif (!/^(\s)*$/) { |
| @@ -147,9 +164,37 @@ while (<MAINT>) { | |||
| 147 | } | 164 | } |
| 148 | close(MAINT); | 165 | close(MAINT); |
| 149 | 166 | ||
| 167 | my %mailmap; | ||
| 168 | |||
| 169 | if ($email_remove_duplicates) { | ||
| 170 | open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; | ||
| 171 | while (<MAILMAP>) { | ||
| 172 | my $line = $_; | ||
| 173 | |||
| 174 | next if ($line =~ m/^\s*#/); | ||
| 175 | next if ($line =~ m/^\s*$/); | ||
| 176 | |||
| 177 | my ($name, $address) = parse_email($line); | ||
| 178 | $line = format_email($name, $address); | ||
| 179 | |||
| 180 | next if ($line =~ m/^\s*$/); | ||
| 181 | |||
| 182 | if (exists($mailmap{$name})) { | ||
| 183 | my $obj = $mailmap{$name}; | ||
| 184 | push(@$obj, $address); | ||
| 185 | } else { | ||
| 186 | my @arr = ($address); | ||
| 187 | $mailmap{$name} = \@arr; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | close(MAILMAP); | ||
| 191 | } | ||
| 192 | |||
| 150 | ## use the filenames on the command line or find the filenames in the patchfiles | 193 | ## use the filenames on the command line or find the filenames in the patchfiles |
| 151 | 194 | ||
| 152 | my @files = (); | 195 | my @files = (); |
| 196 | my @range = (); | ||
| 197 | my @keyword_tvi = (); | ||
| 153 | 198 | ||
| 154 | foreach my $file (@ARGV) { | 199 | foreach my $file (@ARGV) { |
| 155 | ##if $file is a directory and it lacks a trailing slash, add one | 200 | ##if $file is a directory and it lacks a trailing slash, add one |
| @@ -160,15 +205,40 @@ foreach my $file (@ARGV) { | |||
| 160 | } | 205 | } |
| 161 | if ($from_filename) { | 206 | if ($from_filename) { |
| 162 | push(@files, $file); | 207 | push(@files, $file); |
| 208 | if (-f $file && $keywords) { | ||
| 209 | open(FILE, "<$file") or die "$P: Can't open ${file}\n"; | ||
| 210 | while (<FILE>) { | ||
| 211 | my $patch_line = $_; | ||
| 212 | foreach my $line (keys %keyword_hash) { | ||
| 213 | if ($patch_line =~ m/^.*$keyword_hash{$line}/x) { | ||
| 214 | push(@keyword_tvi, $line); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } | ||
| 218 | close(FILE); | ||
| 219 | } | ||
| 163 | } else { | 220 | } else { |
| 164 | my $file_cnt = @files; | 221 | my $file_cnt = @files; |
| 222 | my $lastfile; | ||
| 165 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | 223 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; |
| 166 | while (<PATCH>) { | 224 | while (<PATCH>) { |
| 225 | my $patch_line = $_; | ||
| 167 | if (m/^\+\+\+\s+(\S+)/) { | 226 | if (m/^\+\+\+\s+(\S+)/) { |
| 168 | my $filename = $1; | 227 | my $filename = $1; |
| 169 | $filename =~ s@^[^/]*/@@; | 228 | $filename =~ s@^[^/]*/@@; |
| 170 | $filename =~ s@\n@@; | 229 | $filename =~ s@\n@@; |
| 230 | $lastfile = $filename; | ||
| 171 | push(@files, $filename); | 231 | push(@files, $filename); |
| 232 | } elsif (m/^\@\@ -(\d+),(\d+)/) { | ||
| 233 | if ($email_git_blame) { | ||
| 234 | push(@range, "$lastfile:$1:$2"); | ||
| 235 | } | ||
| 236 | } elsif ($keywords) { | ||
| 237 | foreach my $line (keys %keyword_hash) { | ||
| 238 | if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) { | ||
| 239 | push(@keyword_tvi, $line); | ||
| 240 | } | ||
| 241 | } | ||
| 172 | } | 242 | } |
| 173 | } | 243 | } |
| 174 | close(PATCH); | 244 | close(PATCH); |
| @@ -201,6 +271,7 @@ foreach my $file (@files) { | |||
| 201 | if ($type eq 'X') { | 271 | if ($type eq 'X') { |
| 202 | if (file_match_pattern($file, $value)) { | 272 | if (file_match_pattern($file, $value)) { |
| 203 | $exclude = 1; | 273 | $exclude = 1; |
| 274 | last; | ||
| 204 | } | 275 | } |
| 205 | } | 276 | } |
| 206 | } | 277 | } |
| @@ -208,35 +279,52 @@ foreach my $file (@files) { | |||
| 208 | 279 | ||
| 209 | if (!$exclude) { | 280 | if (!$exclude) { |
| 210 | my $tvi = 0; | 281 | my $tvi = 0; |
| 282 | my %hash; | ||
| 211 | foreach my $line (@typevalue) { | 283 | foreach my $line (@typevalue) { |
| 212 | if ($line =~ m/^(\C):\s*(.*)/) { | 284 | if ($line =~ m/^(\C):\s*(.*)/) { |
| 213 | my $type = $1; | 285 | my $type = $1; |
| 214 | my $value = $2; | 286 | my $value = $2; |
| 215 | if ($type eq 'F') { | 287 | if ($type eq 'F') { |
| 216 | if (file_match_pattern($file, $value)) { | 288 | if (file_match_pattern($file, $value)) { |
| 217 | add_categories($tvi); | 289 | my $value_pd = ($value =~ tr@/@@); |
| 290 | my $file_pd = ($file =~ tr@/@@); | ||
| 291 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
| 292 | if ($pattern_depth == 0 || | ||
| 293 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
| 294 | $hash{$tvi} = $value_pd; | ||
| 295 | } | ||
| 218 | } | 296 | } |
| 219 | } | 297 | } |
| 220 | } | 298 | } |
| 221 | $tvi++; | 299 | $tvi++; |
| 222 | } | 300 | } |
| 301 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
| 302 | add_categories($line); | ||
| 303 | } | ||
| 223 | } | 304 | } |
| 224 | 305 | ||
| 225 | if ($email && $email_git) { | 306 | if ($email && $email_git) { |
| 226 | recent_git_signoffs($file); | 307 | recent_git_signoffs($file); |
| 227 | } | 308 | } |
| 228 | 309 | ||
| 310 | if ($email && $email_git_blame) { | ||
| 311 | git_assign_blame($file); | ||
| 312 | } | ||
| 313 | } | ||
| 314 | |||
| 315 | if ($keywords) { | ||
| 316 | @keyword_tvi = sort_and_uniq(@keyword_tvi); | ||
| 317 | foreach my $line (@keyword_tvi) { | ||
| 318 | add_categories($line); | ||
| 319 | } | ||
| 229 | } | 320 | } |
| 230 | 321 | ||
| 231 | if ($email) { | 322 | if ($email) { |
| 232 | foreach my $chief (@penguin_chief) { | 323 | foreach my $chief (@penguin_chief) { |
| 233 | if ($chief =~ m/^(.*):(.*)/) { | 324 | if ($chief =~ m/^(.*):(.*)/) { |
| 234 | my $email_address; | 325 | my $email_address; |
| 235 | if ($email_usename) { | 326 | |
| 236 | $email_address = format_email($1, $2); | 327 | $email_address = format_email($1, $2); |
| 237 | } else { | ||
| 238 | $email_address = $2; | ||
| 239 | } | ||
| 240 | if ($email_git_penguin_chiefs) { | 328 | if ($email_git_penguin_chiefs) { |
| 241 | push(@email_to, $email_address); | 329 | push(@email_to, $email_address); |
| 242 | } else { | 330 | } else { |
| @@ -258,22 +346,22 @@ if ($email || $email_list) { | |||
| 258 | } | 346 | } |
| 259 | 347 | ||
| 260 | if ($scm) { | 348 | if ($scm) { |
| 261 | @scm = sort_and_uniq(@scm); | 349 | @scm = uniq(@scm); |
| 262 | output(@scm); | 350 | output(@scm); |
| 263 | } | 351 | } |
| 264 | 352 | ||
| 265 | if ($status) { | 353 | if ($status) { |
| 266 | @status = sort_and_uniq(@status); | 354 | @status = uniq(@status); |
| 267 | output(@status); | 355 | output(@status); |
| 268 | } | 356 | } |
| 269 | 357 | ||
| 270 | if ($subsystem) { | 358 | if ($subsystem) { |
| 271 | @subsystem = sort_and_uniq(@subsystem); | 359 | @subsystem = uniq(@subsystem); |
| 272 | output(@subsystem); | 360 | output(@subsystem); |
| 273 | } | 361 | } |
| 274 | 362 | ||
| 275 | if ($web) { | 363 | if ($web) { |
| 276 | @web = sort_and_uniq(@web); | 364 | @web = uniq(@web); |
| 277 | output(@web); | 365 | output(@web); |
| 278 | } | 366 | } |
| 279 | 367 | ||
| @@ -311,10 +399,12 @@ MAINTAINER field selection options: | |||
| 311 | --git-max-maintainers => maximum maintainers to add (default: 5) | 399 | --git-max-maintainers => maximum maintainers to add (default: 5) |
| 312 | --git-min-percent => minimum percentage of commits required (default: 5) | 400 | --git-min-percent => minimum percentage of commits required (default: 5) |
| 313 | --git-since => git history to use (default: 1-year-ago) | 401 | --git-since => git history to use (default: 1-year-ago) |
| 402 | --git-blame => use git blame to find modified commits for patch or file | ||
| 314 | --m => include maintainer(s) if any | 403 | --m => include maintainer(s) if any |
| 315 | --n => include name 'Full Name <addr\@domain.tld>' | 404 | --n => include name 'Full Name <addr\@domain.tld>' |
| 316 | --l => include list(s) if any | 405 | --l => include list(s) if any |
| 317 | --s => include subscriber only list(s) if any | 406 | --s => include subscriber only list(s) if any |
| 407 | --remove-duplicates => minimize duplicate email names/addresses | ||
| 318 | --scm => print SCM tree(s) if any | 408 | --scm => print SCM tree(s) if any |
| 319 | --status => print status if any | 409 | --status => print status if any |
| 320 | --subsystem => print subsystem name if any | 410 | --subsystem => print subsystem name if any |
| @@ -322,24 +412,29 @@ MAINTAINER field selection options: | |||
| 322 | 412 | ||
| 323 | Output type options: | 413 | Output type options: |
| 324 | --separator [, ] => separator for multiple entries on 1 line | 414 | --separator [, ] => separator for multiple entries on 1 line |
| 415 | using --separator also sets --nomultiline if --separator is not [, ] | ||
| 325 | --multiline => print 1 entry per line | 416 | --multiline => print 1 entry per line |
| 326 | 417 | ||
| 327 | Default options: | ||
| 328 | [--email --git --m --n --l --multiline] | ||
| 329 | |||
| 330 | Other options: | 418 | Other options: |
| 419 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) | ||
| 420 | --keywords => scan patch for keywords (default: 1 (on)) | ||
| 331 | --version => show version | 421 | --version => show version |
| 332 | --help => show this help information | 422 | --help => show this help information |
| 333 | 423 | ||
| 424 | Default options: | ||
| 425 | [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] | ||
| 426 | |||
| 334 | Notes: | 427 | Notes: |
| 335 | Using "-f directory" may give unexpected results: | 428 | Using "-f directory" may give unexpected results: |
| 336 | 429 | Used with "--git", git signators for _all_ files in and below | |
| 337 | Used with "--git", git signators for _all_ files in and below | 430 | directory are examined as git recurses directories. |
| 338 | directory are examined as git recurses directories. | 431 | Any specified X: (exclude) pattern matches are _not_ ignored. |
| 339 | Any specified X: (exclude) pattern matches are _not_ ignored. | 432 | Used with "--nogit", directory is used as a pattern match, |
| 340 | Used with "--nogit", directory is used as a pattern match, | 433 | no individual file within the directory or subdirectory |
| 341 | no individual file within the directory or subdirectory | 434 | is matched. |
| 342 | is matched. | 435 | Used with "--git-blame", does not iterate all files in directory |
| 436 | Using "--git-blame" is slow and may add old committers and authors | ||
| 437 | that are no longer active maintainers to the output. | ||
| 343 | EOT | 438 | EOT |
| 344 | } | 439 | } |
| 345 | 440 | ||
| @@ -370,30 +465,99 @@ sub top_of_kernel_tree { | |||
| 370 | return 0; | 465 | return 0; |
| 371 | } | 466 | } |
| 372 | 467 | ||
| 373 | sub format_email { | 468 | sub parse_email { |
| 374 | my ($name, $email) = @_; | 469 | my ($formatted_email) = @_; |
| 470 | |||
| 471 | my $name = ""; | ||
| 472 | my $address = ""; | ||
| 473 | |||
| 474 | if ($formatted_email =~ /^([^<]+)<(.+\@.*)>.*$/) { | ||
| 475 | $name = $1; | ||
| 476 | $address = $2; | ||
| 477 | } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { | ||
| 478 | $address = $1; | ||
| 479 | } elsif ($formatted_email =~ /^(.+\@\S*).*$/) { | ||
| 480 | $address = $1; | ||
| 481 | } | ||
| 375 | 482 | ||
| 376 | $name =~ s/^\s+|\s+$//g; | 483 | $name =~ s/^\s+|\s+$//g; |
| 377 | $name =~ s/^\"|\"$//g; | 484 | $name =~ s/^\"|\"$//g; |
| 378 | $email =~ s/^\s+|\s+$//g; | 485 | $address =~ s/^\s+|\s+$//g; |
| 486 | |||
| 487 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | ||
| 488 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
| 489 | $name = "\"$name\""; | ||
| 490 | } | ||
| 491 | |||
| 492 | return ($name, $address); | ||
| 493 | } | ||
| 494 | |||
| 495 | sub format_email { | ||
| 496 | my ($name, $address) = @_; | ||
| 379 | 497 | ||
| 380 | my $formatted_email = ""; | 498 | my $formatted_email; |
| 499 | |||
| 500 | $name =~ s/^\s+|\s+$//g; | ||
| 501 | $name =~ s/^\"|\"$//g; | ||
| 502 | $address =~ s/^\s+|\s+$//g; | ||
| 381 | 503 | ||
| 382 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 504 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars |
| 383 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 505 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
| 384 | $formatted_email = "\"${name}\"\ \<${email}\>"; | 506 | $name = "\"$name\""; |
| 507 | } | ||
| 508 | |||
| 509 | if ($email_usename) { | ||
| 510 | if ("$name" eq "") { | ||
| 511 | $formatted_email = "$address"; | ||
| 512 | } else { | ||
| 513 | $formatted_email = "$name <${address}>"; | ||
| 514 | } | ||
| 385 | } else { | 515 | } else { |
| 386 | $formatted_email = "${name} \<${email}\>"; | 516 | $formatted_email = $address; |
| 387 | } | 517 | } |
| 518 | |||
| 388 | return $formatted_email; | 519 | return $formatted_email; |
| 389 | } | 520 | } |
| 390 | 521 | ||
| 391 | sub add_categories { | 522 | sub find_starting_index { |
| 523 | my ($index) = @_; | ||
| 524 | |||
| 525 | while ($index > 0) { | ||
| 526 | my $tv = $typevalue[$index]; | ||
| 527 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
| 528 | last; | ||
| 529 | } | ||
| 530 | $index--; | ||
| 531 | } | ||
| 532 | |||
| 533 | return $index; | ||
| 534 | } | ||
| 535 | |||
| 536 | sub find_ending_index { | ||
| 392 | my ($index) = @_; | 537 | my ($index) = @_; |
| 393 | 538 | ||
| 394 | $index = $index - 1; | 539 | while ($index < @typevalue) { |
| 395 | while ($index >= 0) { | ||
| 396 | my $tv = $typevalue[$index]; | 540 | my $tv = $typevalue[$index]; |
| 541 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
| 542 | last; | ||
| 543 | } | ||
| 544 | $index++; | ||
| 545 | } | ||
| 546 | |||
| 547 | return $index; | ||
| 548 | } | ||
| 549 | |||
| 550 | sub add_categories { | ||
| 551 | my ($index) = @_; | ||
| 552 | |||
| 553 | my $i; | ||
| 554 | my $start = find_starting_index($index); | ||
| 555 | my $end = find_ending_index($index); | ||
| 556 | |||
| 557 | push(@subsystem, $typevalue[$start]); | ||
| 558 | |||
| 559 | for ($i = $start + 1; $i < $end; $i++) { | ||
| 560 | my $tv = $typevalue[$i]; | ||
| 397 | if ($tv =~ m/^(\C):\s*(.*)/) { | 561 | if ($tv =~ m/^(\C):\s*(.*)/) { |
| 398 | my $ptype = $1; | 562 | my $ptype = $1; |
| 399 | my $pvalue = $2; | 563 | my $pvalue = $2; |
| @@ -414,19 +578,19 @@ sub add_categories { | |||
| 414 | } | 578 | } |
| 415 | } | 579 | } |
| 416 | } elsif ($ptype eq "M") { | 580 | } elsif ($ptype eq "M") { |
| 417 | my $p_used = 0; | 581 | my ($name, $address) = parse_email($pvalue); |
| 418 | if ($index >= 0) { | 582 | if ($name eq "") { |
| 419 | my $tv = $typevalue[$index - 1]; | 583 | if ($i > 0) { |
| 420 | if ($tv =~ m/^(\C):\s*(.*)/) { | 584 | my $tv = $typevalue[$i - 1]; |
| 421 | if ($1 eq "P") { | 585 | if ($tv =~ m/^(\C):\s*(.*)/) { |
| 422 | if ($email_usename) { | 586 | if ($1 eq "P") { |
| 423 | push_email_address(format_email($2, $pvalue)); | 587 | $name = $2; |
| 424 | $p_used = 1; | 588 | $pvalue = format_email($name, $address); |
| 425 | } | 589 | } |
| 426 | } | 590 | } |
| 427 | } | 591 | } |
| 428 | } | 592 | } |
| 429 | if (!$p_used) { | 593 | if ($email_maintainer) { |
| 430 | push_email_addresses($pvalue); | 594 | push_email_addresses($pvalue); |
| 431 | } | 595 | } |
| 432 | } elsif ($ptype eq "T") { | 596 | } elsif ($ptype eq "T") { |
| @@ -436,31 +600,41 @@ sub add_categories { | |||
| 436 | } elsif ($ptype eq "S") { | 600 | } elsif ($ptype eq "S") { |
| 437 | push(@status, $pvalue); | 601 | push(@status, $pvalue); |
| 438 | } | 602 | } |
| 439 | |||
| 440 | $index--; | ||
| 441 | } else { | ||
| 442 | push(@subsystem,$tv); | ||
| 443 | $index = -1; | ||
| 444 | } | 603 | } |
| 445 | } | 604 | } |
| 446 | } | 605 | } |
| 447 | 606 | ||
| 607 | my %email_hash_name; | ||
| 608 | my %email_hash_address; | ||
| 609 | |||
| 610 | sub email_inuse { | ||
| 611 | my ($name, $address) = @_; | ||
| 612 | |||
| 613 | return 1 if (($name eq "") && ($address eq "")); | ||
| 614 | return 1 if (($name ne "") && exists($email_hash_name{$name})); | ||
| 615 | return 1 if (($address ne "") && exists($email_hash_address{$address})); | ||
| 616 | |||
| 617 | return 0; | ||
| 618 | } | ||
| 619 | |||
| 448 | sub push_email_address { | 620 | sub push_email_address { |
| 449 | my ($email_address) = @_; | 621 | my ($line) = @_; |
| 622 | |||
| 623 | my ($name, $address) = parse_email($line); | ||
| 450 | 624 | ||
| 451 | my $email_name = ""; | 625 | if ($address eq "") { |
| 452 | if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { | 626 | return 0; |
| 453 | $email_name = $1; | ||
| 454 | $email_address = $2; | ||
| 455 | } | 627 | } |
| 456 | 628 | ||
| 457 | if ($email_maintainer) { | 629 | if (!$email_remove_duplicates) { |
| 458 | if ($email_usename && $email_name) { | 630 | push(@email_to, format_email($name, $address)); |
| 459 | push(@email_to, format_email($email_name, $email_address)); | 631 | } elsif (!email_inuse($name, $address)) { |
| 460 | } else { | 632 | push(@email_to, format_email($name, $address)); |
| 461 | push(@email_to, $email_address); | 633 | $email_hash_name{$name}++; |
| 462 | } | 634 | $email_hash_address{$address}++; |
| 463 | } | 635 | } |
| 636 | |||
| 637 | return 1; | ||
| 464 | } | 638 | } |
| 465 | 639 | ||
| 466 | sub push_email_addresses { | 640 | sub push_email_addresses { |
| @@ -476,7 +650,9 @@ sub push_email_addresses { | |||
| 476 | push_email_address($entry); | 650 | push_email_address($entry); |
| 477 | } | 651 | } |
| 478 | } else { | 652 | } else { |
| 479 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | 653 | if (!push_email_address($address)) { |
| 654 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | ||
| 655 | } | ||
| 480 | } | 656 | } |
| 481 | } | 657 | } |
| 482 | 658 | ||
| @@ -492,6 +668,32 @@ sub which { | |||
| 492 | return ""; | 668 | return ""; |
| 493 | } | 669 | } |
| 494 | 670 | ||
| 671 | sub mailmap { | ||
| 672 | my @lines = @_; | ||
| 673 | my %hash; | ||
| 674 | |||
| 675 | foreach my $line (@lines) { | ||
| 676 | my ($name, $address) = parse_email($line); | ||
| 677 | if (!exists($hash{$name})) { | ||
| 678 | $hash{$name} = $address; | ||
| 679 | } elsif ($address ne $hash{$name}) { | ||
| 680 | $address = $hash{$name}; | ||
| 681 | $line = format_email($name, $address); | ||
| 682 | } | ||
| 683 | if (exists($mailmap{$name})) { | ||
| 684 | my $obj = $mailmap{$name}; | ||
| 685 | foreach my $map_address (@$obj) { | ||
| 686 | if (($map_address eq $address) && | ||
| 687 | ($map_address ne $hash{$name})) { | ||
| 688 | $line = format_email($name, $hash{$name}); | ||
| 689 | } | ||
| 690 | } | ||
| 691 | } | ||
| 692 | } | ||
| 693 | |||
| 694 | return @lines; | ||
| 695 | } | ||
| 696 | |||
| 495 | sub recent_git_signoffs { | 697 | sub recent_git_signoffs { |
| 496 | my ($file) = @_; | 698 | my ($file) = @_; |
| 497 | 699 | ||
| @@ -500,6 +702,7 @@ sub recent_git_signoffs { | |||
| 500 | my $output = ""; | 702 | my $output = ""; |
| 501 | my $count = 0; | 703 | my $count = 0; |
| 502 | my @lines = (); | 704 | my @lines = (); |
| 705 | my %hash; | ||
| 503 | my $total_sign_offs; | 706 | my $total_sign_offs; |
| 504 | 707 | ||
| 505 | if (which("git") eq "") { | 708 | if (which("git") eq "") { |
| @@ -513,53 +716,120 @@ sub recent_git_signoffs { | |||
| 513 | } | 716 | } |
| 514 | 717 | ||
| 515 | $cmd = "git log --since=${email_git_since} -- ${file}"; | 718 | $cmd = "git log --since=${email_git_since} -- ${file}"; |
| 516 | $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; | ||
| 517 | if (!$email_git_penguin_chiefs) { | ||
| 518 | $cmd .= " | grep -Ev \"${penguin_chiefs}\""; | ||
| 519 | } | ||
| 520 | $cmd .= " | cut -f2- -d\":\""; | ||
| 521 | $cmd .= " | sort | uniq -c | sort -rn"; | ||
| 522 | 719 | ||
| 523 | $output = `${cmd}`; | 720 | $output = `${cmd}`; |
| 524 | $output =~ s/^\s*//gm; | 721 | $output =~ s/^\s*//gm; |
| 525 | 722 | ||
| 526 | @lines = split("\n", $output); | 723 | @lines = split("\n", $output); |
| 527 | 724 | ||
| 528 | $total_sign_offs = 0; | 725 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); |
| 726 | if (!$email_git_penguin_chiefs) { | ||
| 727 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
| 728 | } | ||
| 729 | # cut -f2- -d":" | ||
| 730 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
| 731 | |||
| 732 | $total_sign_offs = @lines; | ||
| 733 | |||
| 734 | if ($email_remove_duplicates) { | ||
| 735 | @lines = mailmap(@lines); | ||
| 736 | } | ||
| 737 | |||
| 738 | @lines = sort(@lines); | ||
| 739 | |||
| 740 | # uniq -c | ||
| 741 | $hash{$_}++ for @lines; | ||
| 742 | |||
| 743 | # sort -rn | ||
| 744 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
| 745 | my $sign_offs = $hash{$line}; | ||
| 746 | $count++; | ||
| 747 | last if ($sign_offs < $email_git_min_signatures || | ||
| 748 | $count > $email_git_max_maintainers || | ||
| 749 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
| 750 | push_email_address($line); | ||
| 751 | } | ||
| 752 | } | ||
| 753 | |||
| 754 | sub save_commits { | ||
| 755 | my ($cmd, @commits) = @_; | ||
| 756 | my $output; | ||
| 757 | my @lines = (); | ||
| 758 | |||
| 759 | $output = `${cmd}`; | ||
| 760 | |||
| 761 | @lines = split("\n", $output); | ||
| 529 | foreach my $line (@lines) { | 762 | foreach my $line (@lines) { |
| 530 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 763 | if ($line =~ m/^(\w+) /) { |
| 531 | $total_sign_offs += $1; | 764 | push (@commits, $1); |
| 532 | } else { | ||
| 533 | die("$P: Unexpected git output: ${line}\n"); | ||
| 534 | } | 765 | } |
| 535 | } | 766 | } |
| 767 | return @commits; | ||
| 768 | } | ||
| 536 | 769 | ||
| 537 | foreach my $line (@lines) { | 770 | sub git_assign_blame { |
| 538 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 771 | my ($file) = @_; |
| 539 | my $sign_offs = $1; | 772 | |
| 540 | $line = $2; | 773 | my @lines = (); |
| 541 | $count++; | 774 | my @commits = (); |
| 542 | if ($sign_offs < $email_git_min_signatures || | 775 | my $cmd; |
| 543 | $count > $email_git_max_maintainers || | 776 | my $output; |
| 544 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { | 777 | my %hash; |
| 545 | last; | 778 | my $total_sign_offs; |
| 546 | } | 779 | my $count; |
| 780 | |||
| 781 | if (@range) { | ||
| 782 | foreach my $file_range_diff (@range) { | ||
| 783 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); | ||
| 784 | my $diff_file = $1; | ||
| 785 | my $diff_start = $2; | ||
| 786 | my $diff_length = $3; | ||
| 787 | next if (!("$file" eq "$diff_file")); | ||
| 788 | $cmd = "git blame -l -L $diff_start,+$diff_length $file"; | ||
| 789 | @commits = save_commits($cmd, @commits); | ||
| 547 | } | 790 | } |
| 548 | if ($line =~ m/(.+)<(.+)>/) { | 791 | } else { |
| 549 | my $git_name = $1; | 792 | if (-f $file) { |
| 550 | my $git_addr = $2; | 793 | $cmd = "git blame -l $file"; |
| 551 | if ($email_usename) { | 794 | @commits = save_commits($cmd, @commits); |
| 552 | push(@email_to, format_email($git_name, $git_addr)); | ||
| 553 | } else { | ||
| 554 | push(@email_to, $git_addr); | ||
| 555 | } | ||
| 556 | } elsif ($line =~ m/<(.+)>/) { | ||
| 557 | my $git_addr = $1; | ||
| 558 | push(@email_to, $git_addr); | ||
| 559 | } else { | ||
| 560 | push(@email_to, $line); | ||
| 561 | } | 795 | } |
| 562 | } | 796 | } |
| 797 | |||
| 798 | $total_sign_offs = 0; | ||
| 799 | @commits = uniq(@commits); | ||
| 800 | foreach my $commit (@commits) { | ||
| 801 | $cmd = "git log -1 ${commit}"; | ||
| 802 | |||
| 803 | $output = `${cmd}`; | ||
| 804 | $output =~ s/^\s*//gm; | ||
| 805 | @lines = split("\n", $output); | ||
| 806 | |||
| 807 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | ||
| 808 | if (!$email_git_penguin_chiefs) { | ||
| 809 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
| 810 | } | ||
| 811 | |||
| 812 | # cut -f2- -d":" | ||
| 813 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
| 814 | |||
| 815 | $total_sign_offs += @lines; | ||
| 816 | |||
| 817 | if ($email_remove_duplicates) { | ||
| 818 | @lines = mailmap(@lines); | ||
| 819 | } | ||
| 820 | |||
| 821 | $hash{$_}++ for @lines; | ||
| 822 | } | ||
| 823 | |||
| 824 | $count = 0; | ||
| 825 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
| 826 | my $sign_offs = $hash{$line}; | ||
| 827 | $count++; | ||
| 828 | last if ($sign_offs < $email_git_min_signatures || | ||
| 829 | $count > $email_git_max_maintainers || | ||
| 830 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
| 831 | push_email_address($line); | ||
| 832 | } | ||
| 563 | } | 833 | } |
| 564 | 834 | ||
| 565 | sub uniq { | 835 | sub uniq { |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index c6ae4052ab43..b89ca2c58fdb 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
| @@ -20,7 +20,7 @@ use strict; | |||
| 20 | 20 | ||
| 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; | 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; |
| 22 | 22 | ||
| 23 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | 23 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; |
| 24 | 24 | ||
| 25 | foreach my $file (@files) { | 25 | foreach my $file (@files) { |
| 26 | local *INFILE; | 26 | local *INFILE; |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 64343cc084b4..86c3896a1e01 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -585,7 +585,7 @@ static int prefix_underscores_count(const char *str) | |||
| 585 | { | 585 | { |
| 586 | const char *tail = str; | 586 | const char *tail = str; |
| 587 | 587 | ||
| 588 | while (*tail != '_') | 588 | while (*tail == '_') |
| 589 | tail++; | 589 | tail++; |
| 590 | 590 | ||
| 591 | return tail - str; | 591 | return tail - str; |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a2..6d69c7ccdcc7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -2,7 +2,8 @@ | |||
| 2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
| 3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
| 4 | 4 | ||
| 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ |
| 6 | localmodconfig localyesconfig | ||
| 6 | 7 | ||
| 7 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
| 8 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
| @@ -28,6 +29,35 @@ oldconfig: $(obj)/conf | |||
| 28 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
| 29 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
| 30 | 31 | ||
| 32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
| 33 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
| 34 | $(Q)if [ -f .config ]; then \ | ||
| 35 | cmp -s .tmp.config .config || \ | ||
| 36 | (mv -f .config .config.old.1; \ | ||
| 37 | mv -f .tmp.config .config; \ | ||
| 38 | $(obj)/conf -s $(Kconfig); \ | ||
| 39 | mv -f .config.old.1 .config.old) \ | ||
| 40 | else \ | ||
| 41 | mv -f .tmp.config .config; \ | ||
| 42 | $(obj)/conf -s $(Kconfig); \ | ||
| 43 | fi | ||
| 44 | $(Q)rm -f .tmp.config | ||
| 45 | |||
| 46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
| 47 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
| 48 | $(Q)sed -i s/=m/=y/ .tmp.config | ||
| 49 | $(Q)if [ -f .config ]; then \ | ||
| 50 | cmp -s .tmp.config .config || \ | ||
| 51 | (mv -f .config .config.old.1; \ | ||
| 52 | mv -f .tmp.config .config; \ | ||
| 53 | $(obj)/conf -s $(Kconfig); \ | ||
| 54 | mv -f .config.old.1 .config.old) \ | ||
| 55 | else \ | ||
| 56 | mv -f .tmp.config .config; \ | ||
| 57 | $(obj)/conf -s $(Kconfig); \ | ||
| 58 | fi | ||
| 59 | $(Q)rm -f .tmp.config | ||
| 60 | |||
| 31 | # Create new linux.pot file | 61 | # Create new linux.pot file |
| 32 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 62 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
| 33 | # The symlink is used to repair a deficiency in arch/um | 63 | # The symlink is used to repair a deficiency in arch/um |
| @@ -83,6 +113,8 @@ help: | |||
| 83 | @echo ' xconfig - Update current config utilising a QT based front-end' | 113 | @echo ' xconfig - Update current config utilising a QT based front-end' |
| 84 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 114 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
| 85 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 115 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
| 116 | @echo ' localmodconfig - Update current config disabling modules not loaded' | ||
| 117 | @echo ' localyesconfig - Update current config converting local mods to core' | ||
| 86 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 118 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
| 87 | @echo ' randconfig - New config with random answer to all options' | 119 | @echo ' randconfig - New config with random answer to all options' |
| 88 | @echo ' defconfig - New config with default answer to all options' | 120 | @echo ' defconfig - New config with default answer to all options' |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 3baaaecd6b13..9960d1c303f8 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -38,14 +38,14 @@ static int conf_cnt; | |||
| 38 | static char line[128]; | 38 | static char line[128]; |
| 39 | static struct menu *rootEntry; | 39 | static struct menu *rootEntry; |
| 40 | 40 | ||
| 41 | static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); | 41 | static void print_help(struct menu *menu) |
| 42 | |||
| 43 | static const char *get_help(struct menu *menu) | ||
| 44 | { | 42 | { |
| 45 | if (menu_has_help(menu)) | 43 | struct gstr help = str_new(); |
| 46 | return _(menu_get_help(menu)); | 44 | |
| 47 | else | 45 | menu_get_ext_help(menu, &help); |
| 48 | return nohelp_text; | 46 | |
| 47 | printf("\n%s\n", str_get(&help)); | ||
| 48 | str_free(&help); | ||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static void strip(char *str) | 51 | static void strip(char *str) |
| @@ -121,7 +121,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
| 121 | return 1; | 121 | return 1; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | int conf_string(struct menu *menu) | 124 | static int conf_string(struct menu *menu) |
| 125 | { | 125 | { |
| 126 | struct symbol *sym = menu->sym; | 126 | struct symbol *sym = menu->sym; |
| 127 | const char *def; | 127 | const char *def; |
| @@ -140,7 +140,7 @@ int conf_string(struct menu *menu) | |||
| 140 | case '?': | 140 | case '?': |
| 141 | /* print help */ | 141 | /* print help */ |
| 142 | if (line[1] == '\n') { | 142 | if (line[1] == '\n') { |
| 143 | printf("\n%s\n", get_help(menu)); | 143 | print_help(menu); |
| 144 | def = NULL; | 144 | def = NULL; |
| 145 | break; | 145 | break; |
| 146 | } | 146 | } |
| @@ -220,7 +220,7 @@ static int conf_sym(struct menu *menu) | |||
| 220 | if (sym_set_tristate_value(sym, newval)) | 220 | if (sym_set_tristate_value(sym, newval)) |
| 221 | return 0; | 221 | return 0; |
| 222 | help: | 222 | help: |
| 223 | printf("\n%s\n", get_help(menu)); | 223 | print_help(menu); |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| @@ -307,7 +307,7 @@ static int conf_choice(struct menu *menu) | |||
| 307 | fgets(line, 128, stdin); | 307 | fgets(line, 128, stdin); |
| 308 | strip(line); | 308 | strip(line); |
| 309 | if (line[0] == '?') { | 309 | if (line[0] == '?') { |
| 310 | printf("\n%s\n", get_help(menu)); | 310 | print_help(menu); |
| 311 | continue; | 311 | continue; |
| 312 | } | 312 | } |
| 313 | if (!line[0]) | 313 | if (!line[0]) |
| @@ -331,7 +331,7 @@ static int conf_choice(struct menu *menu) | |||
| 331 | if (!child) | 331 | if (!child) |
| 332 | continue; | 332 | continue; |
| 333 | if (line[strlen(line) - 1] == '?') { | 333 | if (line[strlen(line) - 1] == '?') { |
| 334 | printf("\n%s\n", get_help(child)); | 334 | print_help(child); |
| 335 | continue; | 335 | continue; |
| 336 | } | 336 | } |
| 337 | sym_set_choice_value(sym, child->sym); | 337 | sym_set_choice_value(sym, child->sym); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index a04da3459f0f..b55e72ff2fc6 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -560,7 +560,7 @@ int conf_write(const char *name) | |||
| 560 | return 0; | 560 | return 0; |
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | int conf_split_config(void) | 563 | static int conf_split_config(void) |
| 564 | { | 564 | { |
| 565 | const char *name; | 565 | const char *name; |
| 566 | char path[128]; | 566 | char path[128]; |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 579ece4fa584..edd3f39a080a 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
| @@ -348,7 +348,7 @@ struct expr *expr_trans_bool(struct expr *e) | |||
| 348 | /* | 348 | /* |
| 349 | * e1 || e2 -> ? | 349 | * e1 || e2 -> ? |
| 350 | */ | 350 | */ |
| 351 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | 351 | static struct expr *expr_join_or(struct expr *e1, struct expr *e2) |
| 352 | { | 352 | { |
| 353 | struct expr *tmp; | 353 | struct expr *tmp; |
| 354 | struct symbol *sym1, *sym2; | 354 | struct symbol *sym1, *sym2; |
| @@ -412,7 +412,7 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) | |||
| 412 | return NULL; | 412 | return NULL; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | 415 | static struct expr *expr_join_and(struct expr *e1, struct expr *e2) |
| 416 | { | 416 | { |
| 417 | struct expr *tmp; | 417 | struct expr *tmp; |
| 418 | struct symbol *sym1, *sym2; | 418 | struct symbol *sym1, *sym2; |
| @@ -1098,6 +1098,8 @@ void expr_fprint(struct expr *e, FILE *out) | |||
| 1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) | 1098 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
| 1099 | { | 1099 | { |
| 1100 | str_append((struct gstr*)data, str); | 1100 | str_append((struct gstr*)data, str); |
| 1101 | if (sym) | ||
| 1102 | str_printf((struct gstr*)data, " [=%s]", sym_get_string_value(sym)); | ||
| 1101 | } | 1103 | } |
| 1102 | 1104 | ||
| 1103 | void expr_gstr_print(struct expr *e, struct gstr *gs) | 1105 | void expr_gstr_print(struct expr *e, struct gstr *gs) |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 199b22bb49e2..65464366fe38 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
| @@ -456,19 +456,9 @@ static void text_insert_help(struct menu *menu) | |||
| 456 | GtkTextBuffer *buffer; | 456 | GtkTextBuffer *buffer; |
| 457 | GtkTextIter start, end; | 457 | GtkTextIter start, end; |
| 458 | const char *prompt = _(menu_get_prompt(menu)); | 458 | const char *prompt = _(menu_get_prompt(menu)); |
| 459 | gchar *name; | 459 | struct gstr help = str_new(); |
| 460 | const char *help; | ||
| 461 | 460 | ||
| 462 | help = menu_get_help(menu); | 461 | menu_get_ext_help(menu, &help); |
| 463 | |||
| 464 | /* Gettextize if the help text not empty */ | ||
| 465 | if ((help != 0) && (help[0] != 0)) | ||
| 466 | help = _(help); | ||
| 467 | |||
| 468 | if (menu->sym && menu->sym->name) | ||
| 469 | name = g_strdup_printf(menu->sym->name); | ||
| 470 | else | ||
| 471 | name = g_strdup(""); | ||
| 472 | 462 | ||
| 473 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 463 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
| 474 | gtk_text_buffer_get_bounds(buffer, &start, &end); | 464 | gtk_text_buffer_get_bounds(buffer, &start, &end); |
| @@ -478,14 +468,11 @@ static void text_insert_help(struct menu *menu) | |||
| 478 | gtk_text_buffer_get_end_iter(buffer, &end); | 468 | gtk_text_buffer_get_end_iter(buffer, &end); |
| 479 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | 469 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, |
| 480 | NULL); | 470 | NULL); |
| 481 | gtk_text_buffer_insert_at_cursor(buffer, " ", 1); | ||
| 482 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 483 | gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, | ||
| 484 | NULL); | ||
| 485 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | 471 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); |
| 486 | gtk_text_buffer_get_end_iter(buffer, &end); | 472 | gtk_text_buffer_get_end_iter(buffer, &end); |
| 487 | gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, | 473 | gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, |
| 488 | NULL); | 474 | NULL); |
| 475 | str_free(&help); | ||
| 489 | } | 476 | } |
| 490 | 477 | ||
| 491 | 478 | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index 803233fdd6dd..b1c86c19292c 100644 --- a/scripts/kconfig/gconf.glade +++ b/scripts/kconfig/gconf.glade | |||
| @@ -547,7 +547,7 @@ | |||
| 547 | <property name="headers_visible">True</property> | 547 | <property name="headers_visible">True</property> |
| 548 | <property name="rules_hint">False</property> | 548 | <property name="rules_hint">False</property> |
| 549 | <property name="reorderable">False</property> | 549 | <property name="reorderable">False</property> |
| 550 | <property name="enable_search">True</property> | 550 | <property name="enable_search">False</property> |
| 551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | 551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> |
| 552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | 552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> |
| 553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | 553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> |
| @@ -582,7 +582,7 @@ | |||
| 582 | <property name="headers_visible">True</property> | 582 | <property name="headers_visible">True</property> |
| 583 | <property name="rules_hint">False</property> | 583 | <property name="rules_hint">False</property> |
| 584 | <property name="reorderable">False</property> | 584 | <property name="reorderable">False</property> |
| 585 | <property name="enable_search">True</property> | 585 | <property name="enable_search">False</property> |
| 586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | 586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> |
| 587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | 587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> |
| 588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | 588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> |
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 8d9ce22b0fc5..dcc3fcc0cc9a 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
| @@ -166,7 +166,7 @@ static int message__add(const char *msg, char *option, char *file, int lineno) | |||
| 166 | return rc; | 166 | return rc; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | void menu_build_message_list(struct menu *menu) | 169 | static void menu_build_message_list(struct menu *menu) |
| 170 | { | 170 | { |
| 171 | struct menu *child; | 171 | struct menu *child; |
| 172 | 172 | ||
| @@ -211,7 +211,7 @@ static void message__print_gettext_msgid_msgstr(struct message *self) | |||
| 211 | "msgstr \"\"\n", self->msg); | 211 | "msgstr \"\"\n", self->msg); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | void menu__xgettext(void) | 214 | static void menu__xgettext(void) |
| 215 | { | 215 | { |
| 216 | struct message *m = message__list; | 216 | struct message *m = message__list; |
| 217 | 217 | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 8e69461313d1..ffeb532b2cff 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
| @@ -17,6 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
| 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
| 18 | P(menu_has_help,bool,(struct menu *menu)); | 18 | P(menu_has_help,bool,(struct menu *menu)); |
| 19 | P(menu_get_help,const char *,(struct menu *menu)); | 19 | P(menu_get_help,const char *,(struct menu *menu)); |
| 20 | P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); | ||
| 21 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | ||
| 20 | 22 | ||
| 21 | /* symbol.c */ | 23 | /* symbol.c */ |
| 22 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | 24 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 25b60bc117f7..d82953573588 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -199,8 +199,6 @@ inputbox_instructions_string[] = N_( | |||
| 199 | setmod_text[] = N_( | 199 | setmod_text[] = N_( |
| 200 | "This feature depends on another which has been configured as a module.\n" | 200 | "This feature depends on another which has been configured as a module.\n" |
| 201 | "As a result, this feature will be built as a module."), | 201 | "As a result, this feature will be built as a module."), |
| 202 | nohelp_text[] = N_( | ||
| 203 | "There is no help available for this kernel option.\n"), | ||
| 204 | load_config_text[] = N_( | 202 | load_config_text[] = N_( |
| 205 | "Enter the name of the configuration file you wish to load. " | 203 | "Enter the name of the configuration file you wish to load. " |
| 206 | "Accept the name shown to restore the configuration you " | 204 | "Accept the name shown to restore the configuration you " |
| @@ -284,66 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); | |||
| 284 | static void show_helptext(const char *title, const char *text); | 282 | static void show_helptext(const char *title, const char *text); |
| 285 | static void show_help(struct menu *menu); | 283 | static void show_help(struct menu *menu); |
| 286 | 284 | ||
| 287 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
| 288 | { | ||
| 289 | int i, j; | ||
| 290 | struct menu *submenu[8], *menu; | ||
| 291 | |||
| 292 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
| 293 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
| 294 | prop->menu->lineno); | ||
| 295 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 296 | str_append(r, _(" Depends on: ")); | ||
| 297 | expr_gstr_print(prop->visible.expr, r); | ||
| 298 | str_append(r, "\n"); | ||
| 299 | } | ||
| 300 | menu = prop->menu->parent; | ||
| 301 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
| 302 | submenu[i++] = menu; | ||
| 303 | if (i > 0) { | ||
| 304 | str_printf(r, _(" Location:\n")); | ||
| 305 | for (j = 4; --i >= 0; j += 2) { | ||
| 306 | menu = submenu[i]; | ||
| 307 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
| 308 | if (menu->sym) { | ||
| 309 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
| 310 | menu->sym->name : _("<choice>"), | ||
| 311 | sym_get_string_value(menu->sym)); | ||
| 312 | } | ||
| 313 | str_append(r, "\n"); | ||
| 314 | } | ||
| 315 | } | ||
| 316 | } | ||
| 317 | |||
| 318 | static void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
| 319 | { | ||
| 320 | bool hit; | ||
| 321 | struct property *prop; | ||
| 322 | |||
| 323 | if (sym && sym->name) | ||
| 324 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
| 325 | sym_get_string_value(sym)); | ||
| 326 | for_all_prompts(sym, prop) | ||
| 327 | get_prompt_str(r, prop); | ||
| 328 | hit = false; | ||
| 329 | for_all_properties(sym, prop, P_SELECT) { | ||
| 330 | if (!hit) { | ||
| 331 | str_append(r, " Selects: "); | ||
| 332 | hit = true; | ||
| 333 | } else | ||
| 334 | str_printf(r, " && "); | ||
| 335 | expr_gstr_print(prop->expr, r); | ||
| 336 | } | ||
| 337 | if (hit) | ||
| 338 | str_append(r, "\n"); | ||
| 339 | if (sym->rev_dep.expr) { | ||
| 340 | str_append(r, _(" Selected by: ")); | ||
| 341 | expr_gstr_print(sym->rev_dep.expr, r); | ||
| 342 | str_append(r, "\n"); | ||
| 343 | } | ||
| 344 | str_append(r, "\n\n"); | ||
| 345 | } | ||
| 346 | |||
| 347 | static struct gstr get_relations_str(struct symbol **sym_arr) | 285 | static struct gstr get_relations_str(struct symbol **sym_arr) |
| 348 | { | 286 | { |
| 349 | struct symbol *sym; | 287 | struct symbol *sym; |
| @@ -699,19 +637,9 @@ static void show_helptext(const char *title, const char *text) | |||
| 699 | static void show_help(struct menu *menu) | 637 | static void show_help(struct menu *menu) |
| 700 | { | 638 | { |
| 701 | struct gstr help = str_new(); | 639 | struct gstr help = str_new(); |
| 702 | struct symbol *sym = menu->sym; | 640 | |
| 703 | 641 | menu_get_ext_help(menu, &help); | |
| 704 | if (menu_has_help(menu)) | 642 | |
| 705 | { | ||
| 706 | if (sym->name) { | ||
| 707 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | ||
| 708 | str_append(&help, _(menu_get_help(menu))); | ||
| 709 | str_append(&help, "\n"); | ||
| 710 | } | ||
| 711 | } else { | ||
| 712 | str_append(&help, nohelp_text); | ||
| 713 | } | ||
| 714 | get_symbol_str(&help, sym); | ||
| 715 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); | 643 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); |
| 716 | str_free(&help); | 644 | str_free(&help); |
| 717 | } | 645 | } |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 07ff8d105c9d..059a2465c574 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
| @@ -9,6 +9,9 @@ | |||
| 9 | #define LKC_DIRECT_LINK | 9 | #define LKC_DIRECT_LINK |
| 10 | #include "lkc.h" | 10 | #include "lkc.h" |
| 11 | 11 | ||
| 12 | static const char nohelp_text[] = N_( | ||
| 13 | "There is no help available for this kernel option.\n"); | ||
| 14 | |||
| 12 | struct menu rootmenu; | 15 | struct menu rootmenu; |
| 13 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
| 14 | 17 | ||
| @@ -74,7 +77,7 @@ void menu_end_menu(void) | |||
| 74 | current_menu = current_menu->parent; | 77 | current_menu = current_menu->parent; |
| 75 | } | 78 | } |
| 76 | 79 | ||
| 77 | struct expr *menu_check_dep(struct expr *e) | 80 | static struct expr *menu_check_dep(struct expr *e) |
| 78 | { | 81 | { |
| 79 | if (!e) | 82 | if (!e) |
| 80 | return e; | 83 | return e; |
| @@ -184,7 +187,7 @@ static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | |||
| 184 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | 187 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); |
| 185 | } | 188 | } |
| 186 | 189 | ||
| 187 | void sym_check_prop(struct symbol *sym) | 190 | static void sym_check_prop(struct symbol *sym) |
| 188 | { | 191 | { |
| 189 | struct property *prop; | 192 | struct property *prop; |
| 190 | struct symbol *sym2; | 193 | struct symbol *sym2; |
| @@ -451,3 +454,80 @@ const char *menu_get_help(struct menu *menu) | |||
| 451 | else | 454 | else |
| 452 | return ""; | 455 | return ""; |
| 453 | } | 456 | } |
| 457 | |||
| 458 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
| 459 | { | ||
| 460 | int i, j; | ||
| 461 | struct menu *submenu[8], *menu; | ||
| 462 | |||
| 463 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
| 464 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
| 465 | prop->menu->lineno); | ||
| 466 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 467 | str_append(r, _(" Depends on: ")); | ||
| 468 | expr_gstr_print(prop->visible.expr, r); | ||
| 469 | str_append(r, "\n"); | ||
| 470 | } | ||
| 471 | menu = prop->menu->parent; | ||
| 472 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
| 473 | submenu[i++] = menu; | ||
| 474 | if (i > 0) { | ||
| 475 | str_printf(r, _(" Location:\n")); | ||
| 476 | for (j = 4; --i >= 0; j += 2) { | ||
| 477 | menu = submenu[i]; | ||
| 478 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
| 479 | if (menu->sym) { | ||
| 480 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
| 481 | menu->sym->name : _("<choice>"), | ||
| 482 | sym_get_string_value(menu->sym)); | ||
| 483 | } | ||
| 484 | str_append(r, "\n"); | ||
| 485 | } | ||
| 486 | } | ||
| 487 | } | ||
| 488 | |||
| 489 | void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
| 490 | { | ||
| 491 | bool hit; | ||
| 492 | struct property *prop; | ||
| 493 | |||
| 494 | if (sym && sym->name) | ||
| 495 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
| 496 | sym_get_string_value(sym)); | ||
| 497 | for_all_prompts(sym, prop) | ||
| 498 | get_prompt_str(r, prop); | ||
| 499 | hit = false; | ||
| 500 | for_all_properties(sym, prop, P_SELECT) { | ||
| 501 | if (!hit) { | ||
| 502 | str_append(r, " Selects: "); | ||
| 503 | hit = true; | ||
| 504 | } else | ||
| 505 | str_printf(r, " && "); | ||
| 506 | expr_gstr_print(prop->expr, r); | ||
| 507 | } | ||
| 508 | if (hit) | ||
| 509 | str_append(r, "\n"); | ||
| 510 | if (sym->rev_dep.expr) { | ||
| 511 | str_append(r, _(" Selected by: ")); | ||
| 512 | expr_gstr_print(sym->rev_dep.expr, r); | ||
| 513 | str_append(r, "\n"); | ||
| 514 | } | ||
| 515 | str_append(r, "\n\n"); | ||
| 516 | } | ||
| 517 | |||
| 518 | void menu_get_ext_help(struct menu *menu, struct gstr *help) | ||
| 519 | { | ||
| 520 | struct symbol *sym = menu->sym; | ||
| 521 | |||
| 522 | if (menu_has_help(menu)) { | ||
| 523 | if (sym->name) { | ||
| 524 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | ||
| 525 | str_append(help, _(menu_get_help(menu))); | ||
| 526 | str_append(help, "\n"); | ||
| 527 | } | ||
| 528 | } else { | ||
| 529 | str_append(help, nohelp_text); | ||
| 530 | } | ||
| 531 | if (sym) | ||
| 532 | get_symbol_str(help, sym); | ||
| 533 | } | ||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ce7d508c7520..00c51507cfcc 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
| @@ -1042,12 +1042,10 @@ void ConfigInfoView::menuInfo(void) | |||
| 1042 | if (showDebug()) | 1042 | if (showDebug()) |
| 1043 | debug = debug_info(sym); | 1043 | debug = debug_info(sym); |
| 1044 | 1044 | ||
| 1045 | help = menu_get_help(menu); | 1045 | struct gstr help_gstr = str_new(); |
| 1046 | /* Gettextize if the help text not empty */ | 1046 | menu_get_ext_help(menu, &help_gstr); |
| 1047 | if (help.isEmpty()) | 1047 | help = print_filter(str_get(&help_gstr)); |
| 1048 | help = print_filter(menu_get_help(menu)); | 1048 | str_free(&help_gstr); |
| 1049 | else | ||
| 1050 | help = print_filter(_(menu_get_help(menu))); | ||
| 1051 | } else if (menu->prompt) { | 1049 | } else if (menu->prompt) { |
| 1052 | head += "<big><b>"; | 1050 | head += "<big><b>"; |
| 1053 | head += print_filter(_(menu->prompt->text)); | 1051 | head += print_filter(_(menu->prompt->text)); |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 000000000000..95984db8e1e0 --- /dev/null +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -0,0 +1,366 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # Copywrite 2005-2009 - Steven Rostedt | ||
| 4 | # Licensed under the terms of the GNU GPL License version 2 | ||
| 5 | # | ||
| 6 | # It's simple enough to figure out how this works. | ||
| 7 | # If not, then you can ask me at stripconfig@goodmis.org | ||
| 8 | # | ||
| 9 | # What it does? | ||
| 10 | # | ||
| 11 | # If you have installed a Linux kernel from a distribution | ||
| 12 | # that turns on way too many modules than you need, and | ||
| 13 | # you only want the modules you use, then this program | ||
| 14 | # is perfect for you. | ||
| 15 | # | ||
| 16 | # It gives you the ability to turn off all the modules that are | ||
| 17 | # not loaded on your system. | ||
| 18 | # | ||
| 19 | # Howto: | ||
| 20 | # | ||
| 21 | # 1. Boot up the kernel that you want to stream line the config on. | ||
| 22 | # 2. Change directory to the directory holding the source of the | ||
| 23 | # kernel that you just booted. | ||
| 24 | # 3. Copy the configuraton file to this directory as .config | ||
| 25 | # 4. Have all your devices that you need modules for connected and | ||
| 26 | # operational (make sure that their corresponding modules are loaded) | ||
| 27 | # 5. Run this script redirecting the output to some other file | ||
| 28 | # like config_strip. | ||
| 29 | # 6. Back up your old config (if you want too). | ||
| 30 | # 7. copy the config_strip file to .config | ||
| 31 | # 8. Run "make oldconfig" | ||
| 32 | # | ||
| 33 | # Now your kernel is ready to be built with only the modules that | ||
| 34 | # are loaded. | ||
| 35 | # | ||
| 36 | # Here's what I did with my Debian distribution. | ||
| 37 | # | ||
| 38 | # cd /usr/src/linux-2.6.10 | ||
| 39 | # cp /boot/config-2.6.10-1-686-smp .config | ||
| 40 | # ~/bin/streamline_config > config_strip | ||
| 41 | # mv .config config_sav | ||
| 42 | # mv config_strip .config | ||
| 43 | # make oldconfig | ||
| 44 | # | ||
| 45 | my $config = ".config"; | ||
| 46 | my $linuxpath = "."; | ||
| 47 | |||
| 48 | my $uname = `uname -r`; | ||
| 49 | chomp $uname; | ||
| 50 | |||
| 51 | my @searchconfigs = ( | ||
| 52 | { | ||
| 53 | "file" => ".config", | ||
| 54 | "exec" => "cat", | ||
| 55 | }, | ||
| 56 | { | ||
| 57 | "file" => "/proc/config.gz", | ||
| 58 | "exec" => "zcat", | ||
| 59 | }, | ||
| 60 | { | ||
| 61 | "file" => "/boot/config-$uname", | ||
| 62 | "exec" => "cat", | ||
| 63 | }, | ||
| 64 | { | ||
| 65 | "file" => "/boot/vmlinuz-$uname", | ||
| 66 | "exec" => "scripts/extract-ikconfig", | ||
| 67 | "test" => "scripts/extract-ikconfig", | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | "file" => "vmlinux", | ||
| 71 | "exec" => "scripts/extract-ikconfig", | ||
| 72 | "test" => "scripts/extract-ikconfig", | ||
| 73 | }, | ||
| 74 | { | ||
| 75 | "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", | ||
| 76 | "exec" => "scripts/extract-ikconfig", | ||
| 77 | "test" => "scripts/extract-ikconfig", | ||
| 78 | }, | ||
| 79 | { | ||
| 80 | "file" => "kernel/configs.ko", | ||
| 81 | "exec" => "scripts/extract-ikconfig", | ||
| 82 | "test" => "scripts/extract-ikconfig", | ||
| 83 | }, | ||
| 84 | { | ||
| 85 | "file" => "kernel/configs.o", | ||
| 86 | "exec" => "scripts/extract-ikconfig", | ||
| 87 | "test" => "scripts/extract-ikconfig", | ||
| 88 | }, | ||
| 89 | ); | ||
| 90 | |||
| 91 | sub find_config { | ||
| 92 | foreach my $conf (@searchconfigs) { | ||
| 93 | my $file = $conf->{"file"}; | ||
| 94 | |||
| 95 | next if ( ! -f "$file"); | ||
| 96 | |||
| 97 | if (defined($conf->{"test"})) { | ||
| 98 | `$conf->{"test"} $conf->{"file"} 2>/dev/null`; | ||
| 99 | next if ($?); | ||
| 100 | } | ||
| 101 | |||
| 102 | my $exec = $conf->{"exec"}; | ||
| 103 | |||
| 104 | print STDERR "using config: '$file'\n"; | ||
| 105 | |||
| 106 | open(CIN, "$exec $file |") || die "Failed to run $exec $file"; | ||
| 107 | return; | ||
| 108 | } | ||
| 109 | die "No config file found"; | ||
| 110 | } | ||
| 111 | |||
| 112 | find_config; | ||
| 113 | |||
| 114 | my @makefiles = `find $linuxpath -name Makefile`; | ||
| 115 | my %depends; | ||
| 116 | my %selects; | ||
| 117 | my %prompts; | ||
| 118 | my %objects; | ||
| 119 | my $var; | ||
| 120 | my $cont = 0; | ||
| 121 | |||
| 122 | # Get the top level Kconfig file (passed in) | ||
| 123 | my $kconfig = $ARGV[0]; | ||
| 124 | |||
| 125 | # prevent recursion | ||
| 126 | my %read_kconfigs; | ||
| 127 | |||
| 128 | sub read_kconfig { | ||
| 129 | my ($kconfig) = @_; | ||
| 130 | |||
| 131 | my $state = "NONE"; | ||
| 132 | my $config; | ||
| 133 | my @kconfigs; | ||
| 134 | |||
| 135 | open(KIN, $kconfig) || die "Can't open $kconfig"; | ||
| 136 | while (<KIN>) { | ||
| 137 | chomp; | ||
| 138 | |||
| 139 | # collect any Kconfig sources | ||
| 140 | if (/^source\s*"(.*)"/) { | ||
| 141 | $kconfigs[$#kconfigs+1] = $1; | ||
| 142 | } | ||
| 143 | |||
| 144 | # configs found | ||
| 145 | if (/^\s*config\s+(\S+)\s*$/) { | ||
| 146 | $state = "NEW"; | ||
| 147 | $config = $1; | ||
| 148 | |||
| 149 | # collect the depends for the config | ||
| 150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | ||
| 151 | $state = "DEP"; | ||
| 152 | $depends{$config} = $1; | ||
| 153 | } elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) { | ||
| 154 | $depends{$config} .= " " . $1; | ||
| 155 | |||
| 156 | # Get the configs that select this config | ||
| 157 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | ||
| 158 | if (defined($selects{$1})) { | ||
| 159 | $selects{$1} .= " " . $config; | ||
| 160 | } else { | ||
| 161 | $selects{$1} = $config; | ||
| 162 | } | ||
| 163 | |||
| 164 | # configs without prompts must be selected | ||
| 165 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | ||
| 166 | # note if the config has a prompt | ||
| 167 | $prompt{$config} = 1; | ||
| 168 | |||
| 169 | # stop on "help" | ||
| 170 | } elsif (/^\s*help\s*$/) { | ||
| 171 | $state = "NONE"; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | close(KIN); | ||
| 175 | |||
| 176 | # read in any configs that were found. | ||
| 177 | foreach $kconfig (@kconfigs) { | ||
| 178 | if (!defined($read_kconfigs{$kconfig})) { | ||
| 179 | $read_kconfigs{$kconfig} = 1; | ||
| 180 | read_kconfig($kconfig); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | if ($kconfig) { | ||
| 186 | read_kconfig($kconfig); | ||
| 187 | } | ||
| 188 | |||
| 189 | # Read all Makefiles to map the configs to the objects | ||
| 190 | foreach my $makefile (@makefiles) { | ||
| 191 | chomp $makefile; | ||
| 192 | |||
| 193 | open(MIN,$makefile) || die "Can't open $makefile"; | ||
| 194 | while (<MIN>) { | ||
| 195 | my $objs; | ||
| 196 | |||
| 197 | # is this a line after a line with a backslash? | ||
| 198 | if ($cont && /(\S.*)$/) { | ||
| 199 | $objs = $1; | ||
| 200 | } | ||
| 201 | $cont = 0; | ||
| 202 | |||
| 203 | # collect objects after obj-$(CONFIG_FOO_BAR) | ||
| 204 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { | ||
| 205 | $var = $1; | ||
| 206 | $objs = $2; | ||
| 207 | } | ||
| 208 | if (defined($objs)) { | ||
| 209 | # test if the line ends with a backslash | ||
| 210 | if ($objs =~ m,(.*)\\$,) { | ||
| 211 | $objs = $1; | ||
| 212 | $cont = 1; | ||
| 213 | } | ||
| 214 | |||
| 215 | foreach my $obj (split /\s+/,$objs) { | ||
| 216 | $obj =~ s/-/_/g; | ||
| 217 | if ($obj =~ /(.*)\.o$/) { | ||
| 218 | # Objects may bes enabled by more than one config. | ||
| 219 | # Store configs in an array. | ||
| 220 | my @arr; | ||
| 221 | |||
| 222 | if (defined($objects{$1})) { | ||
| 223 | @arr = @{$objects{$1}}; | ||
| 224 | } | ||
| 225 | |||
| 226 | $arr[$#arr+1] = $var; | ||
| 227 | |||
| 228 | # The objects have a hash mapping to a reference | ||
| 229 | # of an array of configs. | ||
| 230 | $objects{$1} = \@arr; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | } | ||
| 234 | } | ||
| 235 | close(MIN); | ||
| 236 | } | ||
| 237 | |||
| 238 | my %modules; | ||
| 239 | |||
| 240 | # see what modules are loaded on this system | ||
| 241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | ||
| 242 | while (<LIN>) { | ||
| 243 | next if (/^Module/); # Skip the first line. | ||
| 244 | if (/^(\S+)/) { | ||
| 245 | $modules{$1} = 1; | ||
| 246 | } | ||
| 247 | } | ||
| 248 | close (LIN); | ||
| 249 | |||
| 250 | # add to the configs hash all configs that are needed to enable | ||
| 251 | # a loaded module. | ||
| 252 | my %configs; | ||
| 253 | foreach my $module (keys(%modules)) { | ||
| 254 | if (defined($objects{$module})) { | ||
| 255 | @arr = @{$objects{$module}}; | ||
| 256 | foreach my $conf (@arr) { | ||
| 257 | $configs{$conf} = $module; | ||
| 258 | } | ||
| 259 | } else { | ||
| 260 | # Most likely, someone has a custom (binary?) module loaded. | ||
| 261 | print STDERR "$module config not found!!\n"; | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | my $valid = "A-Za-z_0-9"; | ||
| 266 | my $repeat = 1; | ||
| 267 | |||
| 268 | # | ||
| 269 | # Note, we do not care about operands (like: &&, ||, !) we want to add any | ||
| 270 | # config that is in the depend list of another config. This script does | ||
| 271 | # not enable configs that are not already enabled. If we come across a | ||
| 272 | # config A that depends on !B, we can still add B to the list of depends | ||
| 273 | # to keep on. If A was on in the original config, B would not have been | ||
| 274 | # and B would not be turned on by this script. | ||
| 275 | # | ||
| 276 | sub parse_config_dep_select | ||
| 277 | { | ||
| 278 | my ($p) = @_; | ||
| 279 | |||
| 280 | while ($p =~ /[$valid]/) { | ||
| 281 | |||
| 282 | if ($p =~ /^[^$valid]*([$valid]+)/) { | ||
| 283 | my $conf = "CONFIG_" . $1; | ||
| 284 | |||
| 285 | $p =~ s/^[^$valid]*[$valid]+//; | ||
| 286 | |||
| 287 | if (!defined($configs{$conf})) { | ||
| 288 | # We must make sure that this config has its | ||
| 289 | # dependencies met. | ||
| 290 | $repeat = 1; # do again | ||
| 291 | $configs{$conf} = 1; | ||
| 292 | } | ||
| 293 | } else { | ||
| 294 | die "this should never happen"; | ||
| 295 | } | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | while ($repeat) { | ||
| 300 | $repeat = 0; | ||
| 301 | |||
| 302 | foreach my $config (keys %configs) { | ||
| 303 | $config =~ s/^CONFIG_//; | ||
| 304 | |||
| 305 | if (defined($depends{$config})) { | ||
| 306 | # This config has dependencies. Make sure they are also included | ||
| 307 | parse_config_dep_select $depends{$config}; | ||
| 308 | } | ||
| 309 | |||
| 310 | if (defined($prompt{$config}) || !defined($selects{$config})) { | ||
| 311 | next; | ||
| 312 | } | ||
| 313 | |||
| 314 | # config has no prompt and must be selected. | ||
| 315 | parse_config_dep_select $selects{$config}; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | my %setconfigs; | ||
| 320 | |||
| 321 | # Finally, read the .config file and turn off any module enabled that | ||
| 322 | # we could not find a reason to keep enabled. | ||
| 323 | while(<CIN>) { | ||
| 324 | |||
| 325 | if (/CONFIG_IKCONFIG/) { | ||
| 326 | if (/# CONFIG_IKCONFIG is not set/) { | ||
| 327 | # enable IKCONFIG at least as a module | ||
| 328 | print "CONFIG_IKCONFIG=m\n"; | ||
| 329 | # don't ask about PROC | ||
| 330 | print "# CONFIG_IKCONFIG_PROC is not set\n"; | ||
| 331 | } else { | ||
| 332 | print; | ||
| 333 | } | ||
| 334 | next; | ||
| 335 | } | ||
| 336 | |||
| 337 | if (/^(CONFIG.*)=(m|y)/) { | ||
| 338 | if (defined($configs{$1})) { | ||
| 339 | $setconfigs{$1} = $2; | ||
| 340 | } elsif ($2 eq "m") { | ||
| 341 | print "# $1 is not set\n"; | ||
| 342 | next; | ||
| 343 | } | ||
| 344 | } | ||
| 345 | print; | ||
| 346 | } | ||
| 347 | close(CIN); | ||
| 348 | |||
| 349 | # Integrity check, make sure all modules that we want enabled do | ||
| 350 | # indeed have their configs set. | ||
| 351 | loop: | ||
| 352 | foreach my $module (keys(%modules)) { | ||
| 353 | if (defined($objects{$module})) { | ||
| 354 | my @arr = @{$objects{$module}}; | ||
| 355 | foreach my $conf (@arr) { | ||
| 356 | if (defined($setconfigs{$conf})) { | ||
| 357 | next loop; | ||
| 358 | } | ||
| 359 | } | ||
| 360 | print STDERR "module $module did not have configs"; | ||
| 361 | foreach my $conf (@arr) { | ||
| 362 | print STDERR " " , $conf; | ||
| 363 | } | ||
| 364 | print STDERR "\n"; | ||
| 365 | } | ||
| 366 | } | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 18f3e5c33634..6c8fbbb66ebc 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
| @@ -36,7 +36,7 @@ tristate modules_val; | |||
| 36 | 36 | ||
| 37 | struct expr *sym_env_list; | 37 | struct expr *sym_env_list; |
| 38 | 38 | ||
| 39 | void sym_add_default(struct symbol *sym, const char *def) | 39 | static void sym_add_default(struct symbol *sym, const char *def) |
| 40 | { | 40 | { |
| 41 | struct property *prop = prop_alloc(P_DEFAULT, sym); | 41 | struct property *prop = prop_alloc(P_DEFAULT, sym); |
| 42 | 42 | ||
| @@ -125,7 +125,7 @@ struct property *sym_get_default_prop(struct symbol *sym) | |||
| 125 | return NULL; | 125 | return NULL; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | struct property *sym_get_range_prop(struct symbol *sym) | 128 | static struct property *sym_get_range_prop(struct symbol *sym) |
| 129 | { | 129 | { |
| 130 | struct property *prop; | 130 | struct property *prop; |
| 131 | 131 | ||
| @@ -943,7 +943,7 @@ const char *prop_get_type_name(enum prop_type type) | |||
| 943 | return "unknown"; | 943 | return "unknown"; |
| 944 | } | 944 | } |
| 945 | 945 | ||
| 946 | void prop_add_env(const char *env) | 946 | static void prop_add_env(const char *env) |
| 947 | { | 947 | { |
| 948 | struct symbol *sym, *sym2; | 948 | struct symbol *sym, *sym2; |
| 949 | struct property *prop; | 949 | struct property *prop; |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index b52d340d759d..ea9f8a58678f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -1995,6 +1995,7 @@ sub process_file($) { | |||
| 1995 | my $identifier; | 1995 | my $identifier; |
| 1996 | my $func; | 1996 | my $func; |
| 1997 | my $descr; | 1997 | my $descr; |
| 1998 | my $in_purpose = 0; | ||
| 1998 | my $initial_section_counter = $section_counter; | 1999 | my $initial_section_counter = $section_counter; |
| 1999 | 2000 | ||
| 2000 | if (defined($ENV{'SRCTREE'})) { | 2001 | if (defined($ENV{'SRCTREE'})) { |
| @@ -2044,6 +2045,7 @@ sub process_file($) { | |||
| 2044 | $descr =~ s/\s*$//; | 2045 | $descr =~ s/\s*$//; |
| 2045 | $descr =~ s/\s+/ /; | 2046 | $descr =~ s/\s+/ /; |
| 2046 | $declaration_purpose = xml_escape($descr); | 2047 | $declaration_purpose = xml_escape($descr); |
| 2048 | $in_purpose = 1; | ||
| 2047 | } else { | 2049 | } else { |
| 2048 | $declaration_purpose = ""; | 2050 | $declaration_purpose = ""; |
| 2049 | } | 2051 | } |
| @@ -2090,6 +2092,7 @@ sub process_file($) { | |||
| 2090 | } | 2092 | } |
| 2091 | 2093 | ||
| 2092 | $in_doc_sect = 1; | 2094 | $in_doc_sect = 1; |
| 2095 | $in_purpose = 0; | ||
| 2093 | $contents = $newcontents; | 2096 | $contents = $newcontents; |
| 2094 | if ($contents ne "") { | 2097 | if ($contents ne "") { |
| 2095 | while ((substr($contents, 0, 1) eq " ") || | 2098 | while ((substr($contents, 0, 1) eq " ") || |
| @@ -2119,11 +2122,19 @@ sub process_file($) { | |||
| 2119 | } elsif (/$doc_content/) { | 2122 | } elsif (/$doc_content/) { |
| 2120 | # miguel-style comment kludge, look for blank lines after | 2123 | # miguel-style comment kludge, look for blank lines after |
| 2121 | # @parameter line to signify start of description | 2124 | # @parameter line to signify start of description |
| 2122 | if ($1 eq "" && | 2125 | if ($1 eq "") { |
| 2123 | ($section =~ m/^@/ || $section eq $section_context)) { | 2126 | if ($section =~ m/^@/ || $section eq $section_context) { |
| 2124 | dump_section($file, $section, xml_escape($contents)); | 2127 | dump_section($file, $section, xml_escape($contents)); |
| 2125 | $section = $section_default; | 2128 | $section = $section_default; |
| 2126 | $contents = ""; | 2129 | $contents = ""; |
| 2130 | } else { | ||
| 2131 | $contents .= "\n"; | ||
| 2132 | } | ||
| 2133 | $in_purpose = 0; | ||
| 2134 | } elsif ($in_purpose == 1) { | ||
| 2135 | # Continued declaration purpose | ||
| 2136 | chomp($declaration_purpose); | ||
| 2137 | $declaration_purpose .= " " . xml_escape($1); | ||
| 2127 | } else { | 2138 | } else { |
| 2128 | $contents .= $1 . "\n"; | 2139 | $contents .= $1 . "\n"; |
| 2129 | } | 2140 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 89774011965d..5f0fcb712e29 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
| @@ -184,10 +184,7 @@ if ($target eq "0") { | |||
| 184 | 184 | ||
| 185 | # if it's a module, we need to find the .ko file and calculate a load offset | 185 | # if it's a module, we need to find the .ko file and calculate a load offset |
| 186 | if ($module ne "") { | 186 | if ($module ne "") { |
| 187 | my $dir = dirname($filename); | 187 | my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`; |
| 188 | $dir = $dir . "/"; | ||
| 189 | my $mod = $module . ".ko"; | ||
| 190 | my $modulefile = `find $dir -name $mod | head -1`; | ||
| 191 | chomp($modulefile); | 188 | chomp($modulefile); |
| 192 | $filename = $modulefile; | 189 | $filename = $modulefile; |
| 193 | if ($filename eq "") { | 190 | if ($filename eq "") { |
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..bce3d0fe6fbd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 1 | TARGET=$1 | 3 | TARGET=$1 |
| 2 | ARCH=$2 | 4 | ARCH=$2 |
| 3 | SMP=$3 | 5 | SMP=$3 |
| @@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" | |||
| 50 | # Truncate to maximum length | 52 | # Truncate to maximum length |
| 51 | 53 | ||
| 52 | UTS_LEN=64 | 54 | UTS_LEN=64 |
| 53 | UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | 55 | UTS_TRUNCATE="cut -b -$UTS_LEN" |
| 54 | 56 | ||
| 55 | # Generate a temporary compile.h | 57 | # Generate a temporary compile.h |
| 56 | 58 | ||
| @@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | |||
| 66 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" | 68 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" |
| 67 | 69 | ||
| 68 | if [ -x /bin/dnsdomainname ]; then | 70 | if [ -x /bin/dnsdomainname ]; then |
| 69 | echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" | 71 | domain=`dnsdomainname 2> /dev/null` |
| 70 | elif [ -x /bin/domainname ]; then | 72 | elif [ -x /bin/domainname ]; then |
| 71 | echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" | 73 | domain=`domainname 2> /dev/null` |
| 74 | fi | ||
| 75 | |||
| 76 | if [ -n "$domain" ]; then | ||
| 77 | echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\" | ||
| 72 | else | 78 | else |
| 73 | echo \#define LINUX_COMPILE_DOMAIN | 79 | echo \#define LINUX_COMPILE_DOMAIN |
| 74 | fi | 80 | fi |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 40e0045876ee..62a9025cdcc7 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
| 657 | return 1; | 657 | return 1; |
| 658 | } | 658 | } |
| 659 | 659 | ||
| 660 | /* Looks like: spi:S */ | ||
| 661 | static int do_spi_entry(const char *filename, struct spi_device_id *id, | ||
| 662 | char *alias) | ||
| 663 | { | ||
| 664 | sprintf(alias, SPI_MODULE_PREFIX "%s", id->name); | ||
| 665 | |||
| 666 | return 1; | ||
| 667 | } | ||
| 668 | |||
| 660 | static const struct dmifield { | 669 | static const struct dmifield { |
| 661 | const char *prefix; | 670 | const char *prefix; |
| 662 | int field; | 671 | int field; |
| @@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 853 | do_table(symval, sym->st_size, | 862 | do_table(symval, sym->st_size, |
| 854 | sizeof(struct i2c_device_id), "i2c", | 863 | sizeof(struct i2c_device_id), "i2c", |
| 855 | do_i2c_entry, mod); | 864 | do_i2c_entry, mod); |
| 865 | else if (sym_is(symname, "__mod_spi_device_table")) | ||
| 866 | do_table(symval, sym->st_size, | ||
| 867 | sizeof(struct spi_device_id), "spi", | ||
| 868 | do_spi_entry, mod); | ||
| 856 | else if (sym_is(symname, "__mod_dmi_device_table")) | 869 | else if (sym_is(symname, "__mod_dmi_device_table")) |
| 857 | do_table(symval, sym->st_size, | 870 | do_table(symval, sym->st_size, |
| 858 | sizeof(struct dmi_system_id), "dmi", | 871 | sizeof(struct dmi_system_id), "dmi", |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 4522948a012e..801a16a17545 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -691,7 +691,7 @@ static int number_prefix(const char *sym) | |||
| 691 | * The $ syntax is for sections where ld append a dot number | 691 | * The $ syntax is for sections where ld append a dot number |
| 692 | * to make section name unique. | 692 | * to make section name unique. |
| 693 | */ | 693 | */ |
| 694 | int match(const char *sym, const char * const pat[]) | 694 | static int match(const char *sym, const char * const pat[]) |
| 695 | { | 695 | { |
| 696 | const char *p; | 696 | const char *p; |
| 697 | while (*pat) { | 697 | while (*pat) { |
| @@ -1746,7 +1746,7 @@ static void add_header(struct buffer *b, struct module *mod) | |||
| 1746 | buf_printf(b, "};\n"); | 1746 | buf_printf(b, "};\n"); |
| 1747 | } | 1747 | } |
| 1748 | 1748 | ||
| 1749 | void add_staging_flag(struct buffer *b, const char *name) | 1749 | static void add_staging_flag(struct buffer *b, const char *name) |
| 1750 | { | 1750 | { |
| 1751 | static const char *staging_dir = "drivers/staging"; | 1751 | static const char *staging_dir = "drivers/staging"; |
| 1752 | 1752 | ||
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index aadc5223dcdb..ecf9c7dc1825 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
| @@ -334,8 +334,6 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
| 334 | deps_drivers/net/dummy.o := \ | 334 | deps_drivers/net/dummy.o := \ |
| 335 | drivers/net/dummy.c \ | 335 | drivers/net/dummy.c \ |
| 336 | $(wildcard include/config/net/fastroute.h) \ | 336 | $(wildcard include/config/net/fastroute.h) \ |
| 337 | include/linux/config.h \ | ||
| 338 | $(wildcard include/config/h.h) \ | ||
| 339 | include/linux/module.h \ | 337 | include/linux/module.h \ |
| 340 | 338 | ||
| 341 | Sum all files in the same dir or subdirs. | 339 | Sum all files in the same dir or subdirs. |
diff --git a/scripts/module-common.lds b/scripts/module-common.lds new file mode 100644 index 000000000000..47a1f9ae0ede --- /dev/null +++ b/scripts/module-common.lds | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | /* | ||
| 2 | * Common module linker script, always used when linking a module. | ||
| 3 | * Archs are free to supply their own linker scripts. ld will | ||
| 4 | * combine them automatically. | ||
| 5 | */ | ||
| 6 | SECTIONS { | ||
| 7 | /DISCARD/ : { *(.discard) } | ||
| 8 | } | ||
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fa4a0a17b7e0..f67cc885c807 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -18,6 +18,9 @@ | |||
| 18 | # e) generate the rpm files, based on kernel.spec | 18 | # e) generate the rpm files, based on kernel.spec |
| 19 | # - Use /. to avoid tar packing just the symlink | 19 | # - Use /. to avoid tar packing just the symlink |
| 20 | 20 | ||
| 21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, | ||
| 22 | # but the binrpm-pkg target can; for some reason O= gets ignored. | ||
| 23 | |||
| 21 | # Do we have rpmbuild, otherwise fall back to the older rpm | 24 | # Do we have rpmbuild, otherwise fall back to the older rpm |
| 22 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | 25 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ |
| 23 | else echo rpm; fi) | 26 | else echo rpm; fi) |
| @@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
| 33 | $(CONFIG_SHELL) $(MKSPEC) > $@ | 36 | $(CONFIG_SHELL) $(MKSPEC) > $@ |
| 34 | 37 | ||
| 35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 38 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
| 39 | @if test -n "$(KBUILD_OUTPUT)"; then \ | ||
| 40 | echo "Building source + binary RPM is not possible outside the"; \ | ||
| 41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
| 42 | echo "binrpm-pkg target instead."; \ | ||
| 43 | false; \ | ||
| 44 | fi | ||
| 36 | $(MAKE) clean | 45 | $(MAKE) clean |
| 37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
| 38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | 47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion |
| @@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE | |||
| 61 | set -e; \ | 70 | set -e; \ |
| 62 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 71 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
| 63 | 72 | ||
| 64 | $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ | 73 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
| 65 | $(UTS_MACHINE) -bb $< | 74 | $(UTS_MACHINE) -bb $< |
| 66 | 75 | ||
| 67 | clean-files += $(objtree)/binkernel.spec | 76 | clean-files += $(objtree)/binkernel.spec |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 3d93f8c81252..47bdd2f99b78 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
| @@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | |||
| 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' | 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' |
| 71 | echo "%endif" | 71 | echo "%endif" |
| 72 | 72 | ||
| 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' | 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install' |
| 74 | echo "%ifarch ia64" | 74 | echo "%ifarch ia64" |
| 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
| 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 911ba7ffab84..090d300d7394 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
| @@ -57,7 +57,6 @@ | |||
| 57 | # call mcount (offset: 0x5) | 57 | # call mcount (offset: 0x5) |
| 58 | # [...] | 58 | # [...] |
| 59 | # ret | 59 | # ret |
| 60 | # .globl my_func | ||
| 61 | # other_func: | 60 | # other_func: |
| 62 | # [...] | 61 | # [...] |
| 63 | # call mcount (offset: 0x1b) | 62 | # call mcount (offset: 0x1b) |
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c index ca757d486187..b4ced8562587 100644 --- a/scripts/selinux/mdp/mdp.c +++ b/scripts/selinux/mdp/mdp.c | |||
| @@ -31,13 +31,13 @@ | |||
| 31 | 31 | ||
| 32 | #include "flask.h" | 32 | #include "flask.h" |
| 33 | 33 | ||
| 34 | void usage(char *name) | 34 | static void usage(char *name) |
| 35 | { | 35 | { |
| 36 | printf("usage: %s [-m] policy_file context_file\n", name); | 36 | printf("usage: %s [-m] policy_file context_file\n", name); |
| 37 | exit(1); | 37 | exit(1); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void find_common_name(char *cname, char *dest, int len) | 40 | static void find_common_name(char *cname, char *dest, int len) |
| 41 | { | 41 | { |
| 42 | char *start, *end; | 42 | char *start, *end; |
| 43 | 43 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 4a34ec591e8c..d52f7a01557c 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -101,7 +101,8 @@ exuberant() | |||
| 101 | -I ____cacheline_aligned_in_smp \ | 101 | -I ____cacheline_aligned_in_smp \ |
| 102 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
| 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
| 104 | --extra=+f --c-kinds=+px \ | 104 | -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ |
| 105 | --extra=+f --c-kinds=-px \ | ||
| 105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ | 106 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
| 106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | 107 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' |
| 107 | 108 | ||
diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl deleted file mode 100644 index 4f729b3501e0..000000000000 --- a/scripts/tracing/power.pl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # Copyright 2008, Intel Corporation | ||
| 4 | # | ||
| 5 | # This file is part of the Linux kernel | ||
| 6 | # | ||
| 7 | # This program file is free software; you can redistribute it and/or modify it | ||
| 8 | # under the terms of the GNU General Public License as published by the | ||
| 9 | # Free Software Foundation; version 2 of the License. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | # for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License | ||
| 17 | # along with this program in a file named COPYING; if not, write to the | ||
| 18 | # Free Software Foundation, Inc., | ||
| 19 | # 51 Franklin Street, Fifth Floor, | ||
| 20 | # Boston, MA 02110-1301 USA | ||
| 21 | # | ||
| 22 | # Authors: | ||
| 23 | # Arjan van de Ven <arjan@linux.intel.com> | ||
| 24 | |||
| 25 | |||
| 26 | # | ||
| 27 | # This script turns a cstate ftrace output into a SVG graphic that shows | ||
| 28 | # historic C-state information | ||
| 29 | # | ||
| 30 | # | ||
| 31 | # cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg | ||
| 32 | # | ||
| 33 | |||
| 34 | my @styles; | ||
| 35 | my $base = 0; | ||
| 36 | |||
| 37 | my @pstate_last; | ||
| 38 | my @pstate_level; | ||
| 39 | |||
| 40 | $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 41 | $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 42 | $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 43 | $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 44 | $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 45 | $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 46 | $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 47 | $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 48 | $styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
| 49 | |||
| 50 | |||
| 51 | print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; | ||
| 52 | print "<svg width=\"10000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; | ||
| 53 | |||
| 54 | my $scale = 30000.0; | ||
| 55 | while (<>) { | ||
| 56 | my $line = $_; | ||
| 57 | if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) { | ||
| 58 | if ($base == 0) { | ||
| 59 | $base = $1; | ||
| 60 | } | ||
| 61 | my $time = $1 - $base; | ||
| 62 | $time = $time * $scale; | ||
| 63 | my $C = $2; | ||
| 64 | my $cpu = $3; | ||
| 65 | my $y = 400 * $cpu; | ||
| 66 | my $duration = $4 * $scale; | ||
| 67 | my $msec = int($4 * 100000)/100.0; | ||
| 68 | my $height = $C * 20; | ||
| 69 | $style = $styles[$C]; | ||
| 70 | |||
| 71 | $y = $y + 140 - $height; | ||
| 72 | |||
| 73 | $x2 = $time + 4; | ||
| 74 | $y2 = $y + 4; | ||
| 75 | |||
| 76 | |||
| 77 | print "<rect x=\"$time\" width=\"$duration\" y=\"$y\" height=\"$height\" style=\"$style\"/>\n"; | ||
| 78 | print "<text transform=\"translate($x2,$y2) rotate(90)\">C$C $msec</text>\n"; | ||
| 79 | } | ||
| 80 | if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) { | ||
| 81 | my $time = $1 - $base; | ||
| 82 | my $state = $2; | ||
| 83 | my $cpu = $3; | ||
| 84 | |||
| 85 | if (defined($pstate_last[$cpu])) { | ||
| 86 | my $from = $pstate_last[$cpu]; | ||
| 87 | my $oldstate = $pstate_state[$cpu]; | ||
| 88 | my $duration = ($time-$from) * $scale; | ||
| 89 | |||
| 90 | $from = $from * $scale; | ||
| 91 | my $to = $from + $duration; | ||
| 92 | my $height = 140 - ($oldstate * (140/8)); | ||
| 93 | |||
| 94 | my $y = 400 * $cpu + 200 + $height; | ||
| 95 | my $y2 = $y+4; | ||
| 96 | my $style = $styles[8]; | ||
| 97 | |||
| 98 | print "<rect x=\"$from\" y=\"$y\" width=\"$duration\" height=\"5\" style=\"$style\"/>\n"; | ||
| 99 | print "<text transform=\"translate($from,$y2)\">P$oldstate (cpu $cpu)</text>\n"; | ||
| 100 | }; | ||
| 101 | |||
| 102 | $pstate_last[$cpu] = $time; | ||
| 103 | $pstate_state[$cpu] = $state; | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | |||
| 108 | print "</svg>\n"; | ||
