diff options
Diffstat (limited to 'scripts')
42 files changed, 1521 insertions, 705 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 06ba4a70bd4d..25f216a841d5 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -7,15 +7,15 @@ | |||
7 | # | 7 | # |
8 | # ========================================================================== | 8 | # ========================================================================== |
9 | 9 | ||
10 | # called may set destination dir (when installing to asm/) | ||
11 | _dst := $(or $(destination-y),$(dst),$(obj)) | ||
12 | |||
13 | # generated header directory | 10 | # generated header directory |
14 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) | 11 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) |
15 | 12 | ||
16 | kbuild-file := $(srctree)/$(obj)/Kbuild | 13 | kbuild-file := $(srctree)/$(obj)/Kbuild |
17 | include $(kbuild-file) | 14 | include $(kbuild-file) |
18 | 15 | ||
16 | # called may set destination dir (when installing to asm/) | ||
17 | _dst := $(or $(destination-y),$(dst),$(obj)) | ||
18 | |||
19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild | 19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild |
20 | ifneq ($(wildcard $(old-kbuild-file)),) | 20 | ifneq ($(wildcard $(old-kbuild-file)),) |
21 | include $(old-kbuild-file) | 21 | include $(old-kbuild-file) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index bdf42fdf64c9..07125e697d7a 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -156,6 +156,11 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | |||
156 | 156 | ||
157 | ld_flags = $(LDFLAGS) $(ldflags-y) | 157 | ld_flags = $(LDFLAGS) $(ldflags-y) |
158 | 158 | ||
159 | dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \ | ||
160 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ | ||
161 | -I$(srctree)/arch/$(SRCARCH)/include/dts \ | ||
162 | -undef -D__DTS__ | ||
163 | |||
159 | # Finds the multi-part object the current object will be linked into | 164 | # Finds the multi-part object the current object will be linked into |
160 | modname-multi = $(sort $(foreach m,$(multi-used),\ | 165 | modname-multi = $(sort $(foreach m,$(multi-used),\ |
161 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) | 166 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) |
@@ -269,6 +274,15 @@ cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile | |||
269 | $(obj)/%.dtb: $(src)/%.dts FORCE | 274 | $(obj)/%.dtb: $(src)/%.dts FORCE |
270 | $(call if_changed_dep,dtc) | 275 | $(call if_changed_dep,dtc) |
271 | 276 | ||
277 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts) | ||
278 | |||
279 | quiet_cmd_dtc_cpp = DTC+CPP $@ | ||
280 | cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ | ||
281 | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp) | ||
282 | |||
283 | $(obj)/%.dtb: $(src)/%.dtsp FORCE | ||
284 | $(call if_changed_dep,dtc_cpp) | ||
285 | |||
272 | # Bzip2 | 286 | # Bzip2 |
273 | # --------------------------------------------------------------------------- | 287 | # --------------------------------------------------------------------------- |
274 | 288 | ||
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index a1cb0222ebe6..cf82c832458f 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -66,10 +66,6 @@ modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) | |||
66 | # Stop after building .o files if NOFINAL is set. Makes compile tests quicker | 66 | # Stop after building .o files if NOFINAL is set. Makes compile tests quicker |
67 | _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) | 67 | _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) |
68 | 68 | ||
69 | ifneq ($(KBUILD_BUILDHOST),$(ARCH)) | ||
70 | cross_build := 1 | ||
71 | endif | ||
72 | |||
73 | # Step 2), invoke modpost | 69 | # Step 2), invoke modpost |
74 | # Includes step 3,4 | 70 | # Includes step 3,4 |
75 | modpost = scripts/mod/modpost \ | 71 | modpost = scripts/mod/modpost \ |
@@ -80,8 +76,7 @@ modpost = scripts/mod/modpost \ | |||
80 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ | 76 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ |
81 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 77 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
82 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 78 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
83 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ | 79 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) |
84 | $(if $(cross_build),-c) | ||
85 | 80 | ||
86 | quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules | 81 | quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules |
87 | cmd_modpost = $(modpost) -s | 82 | cmd_modpost = $(modpost) -s |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index cb1f50cf12e3..7f6425e24ce3 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -409,7 +409,7 @@ static void traps(void) | |||
409 | int *p = (int *)test; | 409 | int *p = (int *)test; |
410 | 410 | ||
411 | if (*p != INT_CONF) { | 411 | if (*p != INT_CONF) { |
412 | fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", | 412 | fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n", |
413 | *p); | 413 | *p); |
414 | exit(2); | 414 | exit(2); |
415 | } | 415 | } |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4d2c7dfdaabd..747bcd768da0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -230,12 +230,12 @@ our $Inline = qr{inline|__always_inline|noinline}; | |||
230 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; | 230 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; |
231 | our $Lval = qr{$Ident(?:$Member)*}; | 231 | our $Lval = qr{$Ident(?:$Member)*}; |
232 | 232 | ||
233 | our $Float_hex = qr{(?i:0x[0-9a-f]+p-?[0-9]+[fl]?)}; | 233 | our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; |
234 | our $Float_dec = qr{(?i:((?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?))}; | 234 | our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; |
235 | our $Float_int = qr{(?i:[0-9]+e-?[0-9]+[fl]?)}; | 235 | our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; |
236 | our $Float = qr{$Float_hex|$Float_dec|$Float_int}; | 236 | our $Float = qr{$Float_hex|$Float_dec|$Float_int}; |
237 | our $Constant = qr{(?:$Float|(?i:(?:0x[0-9a-f]+|[0-9]+)[ul]*))}; | 237 | our $Constant = qr{$Float|(?i)(?:0x[0-9a-f]+|[0-9]+)[ul]*}; |
238 | our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)}; | 238 | our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=}; |
239 | our $Compare = qr{<=|>=|==|!=|<|>}; | 239 | our $Compare = qr{<=|>=|==|!=|<|>}; |
240 | our $Operators = qr{ | 240 | our $Operators = qr{ |
241 | <=|>=|==|!=| | 241 | <=|>=|==|!=| |
@@ -1931,6 +1931,12 @@ sub process { | |||
1931 | "use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | 1931 | "use the SSYNC() macro in asm/blackfin.h\n" . $herevet); |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | # check for old HOTPLUG __dev<foo> section markings | ||
1935 | if ($line =~ /\b(__dev(init|exit)(data|const|))\b/) { | ||
1936 | WARN("HOTPLUG_SECTION", | ||
1937 | "Using $1 is unnecessary\n" . $herecurr); | ||
1938 | } | ||
1939 | |||
1934 | # Check for potential 'bare' types | 1940 | # Check for potential 'bare' types |
1935 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next, | 1941 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next, |
1936 | $realline_next); | 1942 | $realline_next); |
@@ -2430,6 +2436,15 @@ sub process { | |||
2430 | "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); | 2436 | "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); |
2431 | } | 2437 | } |
2432 | 2438 | ||
2439 | if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { | ||
2440 | my $orig = $1; | ||
2441 | my $level = lc($orig); | ||
2442 | $level = "warn" if ($level eq "warning"); | ||
2443 | $level = "dbg" if ($level eq "debug"); | ||
2444 | WARN("PREFER_DEV_LEVEL", | ||
2445 | "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); | ||
2446 | } | ||
2447 | |||
2433 | # function brace can't be on same line, except for #defines of do while, | 2448 | # function brace can't be on same line, except for #defines of do while, |
2434 | # or if closed on same line | 2449 | # or if closed on same line |
2435 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and | 2450 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and |
@@ -2915,6 +2930,7 @@ sub process { | |||
2915 | my $var = $1; | 2930 | my $var = $1; |
2916 | if ($var !~ /$Constant/ && | 2931 | if ($var !~ /$Constant/ && |
2917 | $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ && | 2932 | $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ && |
2933 | $var !~ /^Page[A-Z]/ && | ||
2918 | !defined $camelcase{$var}) { | 2934 | !defined $camelcase{$var}) { |
2919 | $camelcase{$var} = 1; | 2935 | $camelcase{$var} = 1; |
2920 | WARN("CAMELCASE", | 2936 | WARN("CAMELCASE", |
@@ -3237,9 +3253,9 @@ sub process { | |||
3237 | } | 3253 | } |
3238 | 3254 | ||
3239 | # prefer usleep_range over udelay | 3255 | # prefer usleep_range over udelay |
3240 | if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) { | 3256 | if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { |
3241 | # ignore udelay's < 10, however | 3257 | # ignore udelay's < 10, however |
3242 | if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) { | 3258 | if (! ($1 < 10) ) { |
3243 | CHK("USLEEP_RANGE", | 3259 | CHK("USLEEP_RANGE", |
3244 | "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); | 3260 | "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); |
3245 | } | 3261 | } |
@@ -3460,6 +3476,12 @@ sub process { | |||
3460 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); | 3476 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); |
3461 | } | 3477 | } |
3462 | 3478 | ||
3479 | # check for alloc argument mismatch | ||
3480 | if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { | ||
3481 | WARN("ALLOC_ARRAY_ARGS", | ||
3482 | "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr); | ||
3483 | } | ||
3484 | |||
3463 | # check for multiple semicolons | 3485 | # check for multiple semicolons |
3464 | if ($line =~ /;\s*;\s*$/) { | 3486 | if ($line =~ /;\s*;\s*$/) { |
3465 | WARN("ONE_SEMICOLON", | 3487 | WARN("ONE_SEMICOLON", |
diff --git a/scripts/coccicheck b/scripts/coccicheck index 1a49d1c7ecfe..85d31899ad98 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
@@ -2,6 +2,15 @@ | |||
2 | 2 | ||
3 | SPATCH="`which ${SPATCH:=spatch}`" | 3 | SPATCH="`which ${SPATCH:=spatch}`" |
4 | 4 | ||
5 | # The verbosity may be set by the environmental parameter V= | ||
6 | # as for example with 'make V=1 coccicheck' | ||
7 | |||
8 | if [ -n "$V" -a "$V" != "0" ]; then | ||
9 | VERBOSE=1 | ||
10 | else | ||
11 | VERBOSE=0 | ||
12 | fi | ||
13 | |||
5 | if [ "$C" = "1" -o "$C" = "2" ]; then | 14 | if [ "$C" = "1" -o "$C" = "2" ]; then |
6 | ONLINE=1 | 15 | ONLINE=1 |
7 | 16 | ||
@@ -46,6 +55,14 @@ if [ "$ONLINE" = "0" ] ; then | |||
46 | echo '' | 55 | echo '' |
47 | fi | 56 | fi |
48 | 57 | ||
58 | run_cmd() { | ||
59 | if [ $VERBOSE -ne 0 ] ; then | ||
60 | echo "Running: $@" | ||
61 | fi | ||
62 | eval $@ | ||
63 | } | ||
64 | |||
65 | |||
49 | coccinelle () { | 66 | coccinelle () { |
50 | COCCI="$1" | 67 | COCCI="$1" |
51 | 68 | ||
@@ -55,7 +72,7 @@ coccinelle () { | |||
55 | # | 72 | # |
56 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null | 73 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null |
57 | 74 | ||
58 | if [ "$ONLINE" = "0" ] ; then | 75 | if [ $VERBOSE -ne 0 ] ; then |
59 | 76 | ||
60 | FILE=`echo $COCCI | sed "s|$srctree/||"` | 77 | FILE=`echo $COCCI | sed "s|$srctree/||"` |
61 | 78 | ||
@@ -91,15 +108,21 @@ coccinelle () { | |||
91 | fi | 108 | fi |
92 | 109 | ||
93 | if [ "$MODE" = "chain" ] ; then | 110 | if [ "$MODE" = "chain" ] ; then |
94 | $SPATCH -D patch $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 111 | run_cmd $SPATCH -D patch \ |
95 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ | 112 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ |
96 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 113 | run_cmd $SPATCH -D report \ |
97 | $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 | 114 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ |
115 | run_cmd $SPATCH -D context \ | ||
116 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | ||
117 | run_cmd $SPATCH -D org \ | ||
118 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 | ||
98 | elif [ "$MODE" = "rep+ctxt" ] ; then | 119 | elif [ "$MODE" = "rep+ctxt" ] ; then |
99 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ | 120 | run_cmd $SPATCH -D report \ |
100 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 121 | $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ |
122 | run_cmd $SPATCH -D context \ | ||
123 | $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | ||
101 | else | 124 | else |
102 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 125 | run_cmd $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 |
103 | fi | 126 | fi |
104 | 127 | ||
105 | } | 128 | } |
diff --git a/scripts/coccinelle/api/devm_ioremap_resource.cocci b/scripts/coccinelle/api/devm_ioremap_resource.cocci new file mode 100644 index 000000000000..495daa3dbf77 --- /dev/null +++ b/scripts/coccinelle/api/devm_ioremap_resource.cocci | |||
@@ -0,0 +1,90 @@ | |||
1 | virtual patch | ||
2 | virtual report | ||
3 | |||
4 | @depends on patch@ | ||
5 | expression base, dev, res; | ||
6 | @@ | ||
7 | |||
8 | -base = devm_request_and_ioremap(dev, res); | ||
9 | +base = devm_ioremap_resource(dev, res); | ||
10 | ... | ||
11 | if ( | ||
12 | -base == NULL | ||
13 | +IS_ERR(base) | ||
14 | || ...) { | ||
15 | <... | ||
16 | - return ...; | ||
17 | + return PTR_ERR(base); | ||
18 | ...> | ||
19 | } | ||
20 | |||
21 | @depends on patch@ | ||
22 | expression e, E, ret; | ||
23 | identifier l; | ||
24 | @@ | ||
25 | |||
26 | e = devm_ioremap_resource(...); | ||
27 | ... | ||
28 | if (IS_ERR(e) || ...) { | ||
29 | ... when any | ||
30 | - ret = E; | ||
31 | + ret = PTR_ERR(e); | ||
32 | ... | ||
33 | ( | ||
34 | return ret; | ||
35 | | | ||
36 | goto l; | ||
37 | ) | ||
38 | } | ||
39 | |||
40 | @depends on patch@ | ||
41 | expression e; | ||
42 | @@ | ||
43 | |||
44 | e = devm_ioremap_resource(...); | ||
45 | ... | ||
46 | if (IS_ERR(e) || ...) { | ||
47 | ... | ||
48 | - \(dev_dbg\|dev_err\|pr_debug\|pr_err\|DRM_ERROR\)(...); | ||
49 | ... | ||
50 | } | ||
51 | |||
52 | @depends on patch@ | ||
53 | expression e; | ||
54 | identifier l; | ||
55 | @@ | ||
56 | |||
57 | e = devm_ioremap_resource(...); | ||
58 | ... | ||
59 | if (IS_ERR(e) || ...) | ||
60 | -{ | ||
61 | ( | ||
62 | return ...; | ||
63 | | | ||
64 | goto l; | ||
65 | ) | ||
66 | -} | ||
67 | |||
68 | @r depends on report@ | ||
69 | expression e; | ||
70 | identifier l; | ||
71 | position p1; | ||
72 | @@ | ||
73 | |||
74 | *e = devm_request_and_ioremap@p1(...); | ||
75 | ... | ||
76 | if (e == NULL || ...) { | ||
77 | ... | ||
78 | ( | ||
79 | return ...; | ||
80 | | | ||
81 | goto l; | ||
82 | ) | ||
83 | } | ||
84 | |||
85 | @script:python depends on r@ | ||
86 | p1 << r.p1; | ||
87 | @@ | ||
88 | |||
89 | msg = "ERROR: deprecated devm_request_and_ioremap() API used on line %s" % (p1[0].line) | ||
90 | coccilib.report.print_report(p1[0], msg) | ||
diff --git a/scripts/coccinelle/misc/memcpy-assign.cocci b/scripts/coccinelle/misc/memcpy-assign.cocci new file mode 100644 index 000000000000..afd058be497f --- /dev/null +++ b/scripts/coccinelle/misc/memcpy-assign.cocci | |||
@@ -0,0 +1,103 @@ | |||
1 | // | ||
2 | // Replace memcpy with struct assignment. | ||
3 | // | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. | ||
6 | // URL: http://coccinelle.lip6.fr/ | ||
7 | // Comments: | ||
8 | // Options: --no-includes --include-headers | ||
9 | |||
10 | virtual patch | ||
11 | virtual report | ||
12 | virtual context | ||
13 | virtual org | ||
14 | |||
15 | @r1 depends on !patch@ | ||
16 | identifier struct_name; | ||
17 | struct struct_name to; | ||
18 | struct struct_name from; | ||
19 | struct struct_name *top; | ||
20 | struct struct_name *fromp; | ||
21 | position p; | ||
22 | @@ | ||
23 | memcpy@p(\(&(to)\|top\), \(&(from)\|fromp\), \(sizeof(to)\|sizeof(from)\|sizeof(struct struct_name)\|sizeof(*top)\|sizeof(*fromp)\)) | ||
24 | |||
25 | @script:python depends on report@ | ||
26 | p << r1.p; | ||
27 | @@ | ||
28 | coccilib.report.print_report(p[0],"Replace memcpy with struct assignment") | ||
29 | |||
30 | @depends on context@ | ||
31 | position r1.p; | ||
32 | @@ | ||
33 | *memcpy@p(...); | ||
34 | |||
35 | @script:python depends on org@ | ||
36 | p << r1.p; | ||
37 | @@ | ||
38 | cocci.print_main("Replace memcpy with struct assignment",p) | ||
39 | |||
40 | @depends on patch@ | ||
41 | identifier struct_name; | ||
42 | struct struct_name to; | ||
43 | struct struct_name from; | ||
44 | @@ | ||
45 | ( | ||
46 | -memcpy(&(to), &(from), sizeof(to)); | ||
47 | +to = from; | ||
48 | | | ||
49 | -memcpy(&(to), &(from), sizeof(from)); | ||
50 | +to = from; | ||
51 | | | ||
52 | -memcpy(&(to), &(from), sizeof(struct struct_name)); | ||
53 | +to = from; | ||
54 | ) | ||
55 | |||
56 | @depends on patch@ | ||
57 | identifier struct_name; | ||
58 | struct struct_name to; | ||
59 | struct struct_name *from; | ||
60 | @@ | ||
61 | ( | ||
62 | -memcpy(&(to), from, sizeof(to)); | ||
63 | +to = *from; | ||
64 | | | ||
65 | -memcpy(&(to), from, sizeof(*from)); | ||
66 | +to = *from; | ||
67 | | | ||
68 | -memcpy(&(to), from, sizeof(struct struct_name)); | ||
69 | +to = *from; | ||
70 | ) | ||
71 | |||
72 | @depends on patch@ | ||
73 | identifier struct_name; | ||
74 | struct struct_name *to; | ||
75 | struct struct_name from; | ||
76 | @@ | ||
77 | ( | ||
78 | -memcpy(to, &(from), sizeof(*to)); | ||
79 | + *to = from; | ||
80 | | | ||
81 | -memcpy(to, &(from), sizeof(from)); | ||
82 | + *to = from; | ||
83 | | | ||
84 | -memcpy(to, &(from), sizeof(struct struct_name)); | ||
85 | + *to = from; | ||
86 | ) | ||
87 | |||
88 | @depends on patch@ | ||
89 | identifier struct_name; | ||
90 | struct struct_name *to; | ||
91 | struct struct_name *from; | ||
92 | @@ | ||
93 | ( | ||
94 | -memcpy(to, from, sizeof(*to)); | ||
95 | + *to = *from; | ||
96 | | | ||
97 | -memcpy(to, from, sizeof(*from)); | ||
98 | + *to = *from; | ||
99 | | | ||
100 | -memcpy(to, from, sizeof(struct struct_name)); | ||
101 | + *to = *from; | ||
102 | ) | ||
103 | |||
diff --git a/scripts/coccinelle/misc/orplus.cocci b/scripts/coccinelle/misc/orplus.cocci new file mode 100644 index 000000000000..4a28cef1484e --- /dev/null +++ b/scripts/coccinelle/misc/orplus.cocci | |||
@@ -0,0 +1,55 @@ | |||
1 | /// Check for constants that are added but are used elsewhere as bitmasks | ||
2 | /// The results should be checked manually to ensure that the nonzero | ||
3 | /// bits in the two constants are actually disjoint. | ||
4 | /// | ||
5 | // Confidence: Moderate | ||
6 | // Copyright: (C) 2013 Julia Lawall, INRIA/LIP6. GPLv2. | ||
7 | // Copyright: (C) 2013 Gilles Muller, INRIA/LIP6. GPLv2. | ||
8 | // URL: http://coccinelle.lip6.fr/ | ||
9 | // Comments: | ||
10 | // Options: -no_includes -include_headers | ||
11 | |||
12 | virtual org | ||
13 | virtual report | ||
14 | virtual context | ||
15 | |||
16 | @r@ | ||
17 | constant c; | ||
18 | identifier i; | ||
19 | expression e; | ||
20 | @@ | ||
21 | |||
22 | ( | ||
23 | e | c@i | ||
24 | | | ||
25 | e & c@i | ||
26 | | | ||
27 | e |= c@i | ||
28 | | | ||
29 | e &= c@i | ||
30 | ) | ||
31 | |||
32 | @s@ | ||
33 | constant r.c,c1; | ||
34 | identifier i1; | ||
35 | position p; | ||
36 | @@ | ||
37 | |||
38 | ( | ||
39 | c1 + c - 1 | ||
40 | | | ||
41 | *c1@i1 +@p c | ||
42 | ) | ||
43 | |||
44 | @script:python depends on org@ | ||
45 | p << s.p; | ||
46 | @@ | ||
47 | |||
48 | cocci.print_main("sum of probable bitmasks, consider |",p) | ||
49 | |||
50 | @script:python depends on report@ | ||
51 | p << s.p; | ||
52 | @@ | ||
53 | |||
54 | msg = "WARNING: sum of probable bitmasks, consider |" | ||
55 | coccilib.report.print_report(p[0],msg) | ||
diff --git a/scripts/coccinelle/misc/semicolon.cocci b/scripts/coccinelle/misc/semicolon.cocci new file mode 100644 index 000000000000..a47eba2edc9e --- /dev/null +++ b/scripts/coccinelle/misc/semicolon.cocci | |||
@@ -0,0 +1,83 @@ | |||
1 | /// | ||
2 | /// Removes unneeded semicolon. | ||
3 | /// | ||
4 | // Confidence: Moderate | ||
5 | // Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. | ||
6 | // URL: http://coccinelle.lip6.fr/ | ||
7 | // Comments: Some false positives on empty default cases in switch statements. | ||
8 | // Options: --no-includes --include-headers | ||
9 | |||
10 | virtual patch | ||
11 | virtual report | ||
12 | virtual context | ||
13 | virtual org | ||
14 | |||
15 | @r_default@ | ||
16 | position p; | ||
17 | @@ | ||
18 | switch (...) | ||
19 | { | ||
20 | default: ...;@p | ||
21 | } | ||
22 | |||
23 | @r_case@ | ||
24 | position p; | ||
25 | @@ | ||
26 | ( | ||
27 | switch (...) | ||
28 | { | ||
29 | case ...:;@p | ||
30 | } | ||
31 | | | ||
32 | switch (...) | ||
33 | { | ||
34 | case ...:... | ||
35 | case ...:;@p | ||
36 | } | ||
37 | | | ||
38 | switch (...) | ||
39 | { | ||
40 | case ...:... | ||
41 | case ...: | ||
42 | case ...:;@p | ||
43 | } | ||
44 | ) | ||
45 | |||
46 | @r1@ | ||
47 | statement S; | ||
48 | position p1; | ||
49 | position p != {r_default.p, r_case.p}; | ||
50 | identifier label; | ||
51 | @@ | ||
52 | ( | ||
53 | label:; | ||
54 | | | ||
55 | S@p1;@p | ||
56 | ) | ||
57 | |||
58 | @script:python@ | ||
59 | p << r1.p; | ||
60 | p1 << r1.p1; | ||
61 | @@ | ||
62 | if p[0].line != p1[0].line_end: | ||
63 | cocci.include_match(False) | ||
64 | |||
65 | @depends on patch@ | ||
66 | position r1.p; | ||
67 | @@ | ||
68 | -;@p | ||
69 | |||
70 | @script:python depends on report@ | ||
71 | p << r1.p; | ||
72 | @@ | ||
73 | coccilib.report.print_report(p[0],"Unneeded semicolon") | ||
74 | |||
75 | @depends on context@ | ||
76 | position r1.p; | ||
77 | @@ | ||
78 | *;@p | ||
79 | |||
80 | @script:python depends on org@ | ||
81 | p << r1.p; | ||
82 | @@ | ||
83 | cocci.print_main("Unneeded semicolon",p) | ||
diff --git a/scripts/depmod.sh b/scripts/depmod.sh index 2ae481703141..122599b1c13b 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh | |||
@@ -2,16 +2,36 @@ | |||
2 | # | 2 | # |
3 | # A depmod wrapper used by the toplevel Makefile | 3 | # A depmod wrapper used by the toplevel Makefile |
4 | 4 | ||
5 | if test $# -ne 2; then | 5 | if test $# -ne 3; then |
6 | echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2 | 6 | echo "Usage: $0 /sbin/depmod <kernelrelease> <symbolprefix>" >&2 |
7 | exit 1 | 7 | exit 1 |
8 | fi | 8 | fi |
9 | DEPMOD=$1 | 9 | DEPMOD=$1 |
10 | KERNELRELEASE=$2 | 10 | KERNELRELEASE=$2 |
11 | SYMBOL_PREFIX=$3 | ||
11 | 12 | ||
12 | if ! test -r System.map -a -x "$DEPMOD"; then | 13 | if ! test -r System.map -a -x "$DEPMOD"; then |
13 | exit 0 | 14 | exit 0 |
14 | fi | 15 | fi |
16 | |||
17 | # older versions of depmod don't support -P <symbol-prefix> | ||
18 | # support was added in module-init-tools 3.13 | ||
19 | if test -n "$SYMBOL_PREFIX"; then | ||
20 | release=$("$DEPMOD" --version) | ||
21 | package=$(echo "$release" | cut -d' ' -f 1) | ||
22 | if test "$package" = "module-init-tools"; then | ||
23 | version=$(echo "$release" | cut -d' ' -f 2) | ||
24 | later=$(printf '%s\n' "$version" "3.13" | sort -V | tail -n 1) | ||
25 | if test "$later" != "$version"; then | ||
26 | # module-init-tools < 3.13, drop the symbol prefix | ||
27 | SYMBOL_PREFIX="" | ||
28 | fi | ||
29 | fi | ||
30 | if test -n "$SYMBOL_PREFIX"; then | ||
31 | SYMBOL_PREFIX="-P $SYMBOL_PREFIX" | ||
32 | fi | ||
33 | fi | ||
34 | |||
15 | # older versions of depmod require the version string to start with three | 35 | # older versions of depmod require the version string to start with three |
16 | # numbers, so we cheat with a symlink here | 36 | # numbers, so we cheat with a symlink here |
17 | depmod_hack_needed=true | 37 | depmod_hack_needed=true |
@@ -34,7 +54,7 @@ set -- -ae -F System.map | |||
34 | if test -n "$INSTALL_MOD_PATH"; then | 54 | if test -n "$INSTALL_MOD_PATH"; then |
35 | set -- "$@" -b "$INSTALL_MOD_PATH" | 55 | set -- "$@" -b "$INSTALL_MOD_PATH" |
36 | fi | 56 | fi |
37 | "$DEPMOD" "$@" "$KERNELRELEASE" | 57 | "$DEPMOD" "$@" "$KERNELRELEASE" $SYMBOL_PREFIX |
38 | ret=$? | 58 | ret=$? |
39 | 59 | ||
40 | if $depmod_hack_needed; then | 60 | if $depmod_hack_needed; then |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 8b673dd4627f..18d4ab55606b 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -433,7 +433,7 @@ foreach my $file (@ARGV) { | |||
433 | 433 | ||
434 | while (<$patch>) { | 434 | while (<$patch>) { |
435 | my $patch_line = $_; | 435 | my $patch_line = $_; |
436 | if (m/^\+\+\+\s+(\S+)/) { | 436 | if (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) { |
437 | my $filename = $1; | 437 | my $filename = $1; |
438 | $filename =~ s@^[^/]*/@@; | 438 | $filename =~ s@^[^/]*/@@; |
439 | $filename =~ s@\n@@; | 439 | $filename =~ s@\n@@; |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 3091794e9354..231b4759c714 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -11,6 +11,9 @@ else | |||
11 | Kconfig := Kconfig | 11 | Kconfig := Kconfig |
12 | endif | 12 | endif |
13 | 13 | ||
14 | # We need this, in case the user has it in its environment | ||
15 | unexport CONFIG_ | ||
16 | |||
14 | xconfig: $(obj)/qconf | 17 | xconfig: $(obj)/qconf |
15 | $< $(Kconfig) | 18 | $< $(Kconfig) |
16 | 19 | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 4da3b4adfad2..e39fcd8143ea 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -36,6 +36,7 @@ enum input_mode { | |||
36 | } input_mode = oldaskconfig; | 36 | } input_mode = oldaskconfig; |
37 | 37 | ||
38 | static int indent = 1; | 38 | static int indent = 1; |
39 | static int tty_stdio; | ||
39 | static int valid_stdin = 1; | 40 | static int valid_stdin = 1; |
40 | static int sync_kconfig; | 41 | static int sync_kconfig; |
41 | static int conf_cnt; | 42 | static int conf_cnt; |
@@ -108,6 +109,8 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
108 | case oldaskconfig: | 109 | case oldaskconfig: |
109 | fflush(stdout); | 110 | fflush(stdout); |
110 | xfgets(line, 128, stdin); | 111 | xfgets(line, 128, stdin); |
112 | if (!tty_stdio) | ||
113 | printf("\n"); | ||
111 | return 1; | 114 | return 1; |
112 | default: | 115 | default: |
113 | break; | 116 | break; |
@@ -495,6 +498,8 @@ int main(int ac, char **av) | |||
495 | bindtextdomain(PACKAGE, LOCALEDIR); | 498 | bindtextdomain(PACKAGE, LOCALEDIR); |
496 | textdomain(PACKAGE); | 499 | textdomain(PACKAGE); |
497 | 500 | ||
501 | tty_stdio = isatty(0) && isatty(1) && isatty(2); | ||
502 | |||
498 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { | 503 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
499 | input_mode = (enum input_mode)opt; | 504 | input_mode = (enum input_mode)opt; |
500 | switch (opt) { | 505 | switch (opt) { |
@@ -621,7 +626,7 @@ int main(int ac, char **av) | |||
621 | return 1; | 626 | return 1; |
622 | } | 627 | } |
623 | } | 628 | } |
624 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | 629 | valid_stdin = tty_stdio; |
625 | } | 630 | } |
626 | 631 | ||
627 | switch (input_mode) { | 632 | switch (input_mode) { |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 290ce41f8ba4..d6626521f9b9 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | struct expr *expr_alloc_symbol(struct symbol *sym) | 14 | struct expr *expr_alloc_symbol(struct symbol *sym) |
15 | { | 15 | { |
16 | struct expr *e = calloc(1, sizeof(*e)); | 16 | struct expr *e = xcalloc(1, sizeof(*e)); |
17 | e->type = E_SYMBOL; | 17 | e->type = E_SYMBOL; |
18 | e->left.sym = sym; | 18 | e->left.sym = sym; |
19 | return e; | 19 | return e; |
@@ -21,7 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) | |||
21 | 21 | ||
22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | 22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) |
23 | { | 23 | { |
24 | struct expr *e = calloc(1, sizeof(*e)); | 24 | struct expr *e = xcalloc(1, sizeof(*e)); |
25 | e->type = type; | 25 | e->type = type; |
26 | e->left.expr = ce; | 26 | e->left.expr = ce; |
27 | return e; | 27 | return e; |
@@ -29,7 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | |||
29 | 29 | ||
30 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | 30 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) |
31 | { | 31 | { |
32 | struct expr *e = calloc(1, sizeof(*e)); | 32 | struct expr *e = xcalloc(1, sizeof(*e)); |
33 | e->type = type; | 33 | e->type = type; |
34 | e->left.expr = e1; | 34 | e->left.expr = e1; |
35 | e->right.expr = e2; | 35 | e->right.expr = e2; |
@@ -38,7 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e | |||
38 | 38 | ||
39 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | 39 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) |
40 | { | 40 | { |
41 | struct expr *e = calloc(1, sizeof(*e)); | 41 | struct expr *e = xcalloc(1, sizeof(*e)); |
42 | e->type = type; | 42 | e->type = type; |
43 | e->left.sym = s1; | 43 | e->left.sym = s1; |
44 | e->right.sym = s2; | 44 | e->right.sym = s2; |
@@ -66,7 +66,7 @@ struct expr *expr_copy(const struct expr *org) | |||
66 | if (!org) | 66 | if (!org) |
67 | return NULL; | 67 | return NULL; |
68 | 68 | ||
69 | e = malloc(sizeof(*org)); | 69 | e = xmalloc(sizeof(*org)); |
70 | memcpy(e, org, sizeof(*org)); | 70 | memcpy(e, org, sizeof(*org)); |
71 | switch (org->type) { | 71 | switch (org->type) { |
72 | case E_SYMBOL: | 72 | case E_SYMBOL: |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index adc230638c5b..f2bee70e26f4 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -10,6 +10,7 @@ | |||
10 | # include <config.h> | 10 | # include <config.h> |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #include <stdlib.h> | ||
13 | #include "lkc.h" | 14 | #include "lkc.h" |
14 | #include "images.c" | 15 | #include "images.c" |
15 | 16 | ||
@@ -22,7 +23,6 @@ | |||
22 | #include <string.h> | 23 | #include <string.h> |
23 | #include <unistd.h> | 24 | #include <unistd.h> |
24 | #include <time.h> | 25 | #include <time.h> |
25 | #include <stdlib.h> | ||
26 | 26 | ||
27 | //#define DEBUG | 27 | //#define DEBUG |
28 | 28 | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index c18f2bd9c095..f8aee5fc6d5e 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -39,6 +39,12 @@ extern "C" { | |||
39 | #ifndef CONFIG_ | 39 | #ifndef CONFIG_ |
40 | #define CONFIG_ "CONFIG_" | 40 | #define CONFIG_ "CONFIG_" |
41 | #endif | 41 | #endif |
42 | static inline const char *CONFIG_prefix(void) | ||
43 | { | ||
44 | return getenv( "CONFIG_" ) ?: CONFIG_; | ||
45 | } | ||
46 | #undef CONFIG_ | ||
47 | #define CONFIG_ CONFIG_prefix() | ||
42 | 48 | ||
43 | #define TF_COMMAND 0x0001 | 49 | #define TF_COMMAND 0x0001 |
44 | #define TF_PARAM 0x0002 | 50 | #define TF_PARAM 0x0002 |
@@ -116,6 +122,8 @@ void menu_set_type(int type); | |||
116 | /* util.c */ | 122 | /* util.c */ |
117 | struct file *file_lookup(const char *name); | 123 | struct file *file_lookup(const char *name); |
118 | int file_write_dep(const char *name); | 124 | int file_write_dep(const char *name); |
125 | void *xmalloc(size_t size); | ||
126 | void *xcalloc(size_t nmemb, size_t size); | ||
119 | 127 | ||
120 | struct gstr { | 128 | struct gstr { |
121 | size_t len; | 129 | size_t len; |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index c8e8a7154753..80788137c670 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -21,6 +21,7 @@ ccflags() | |||
21 | { | 21 | { |
22 | if [ -f /usr/include/ncursesw/curses.h ]; then | 22 | if [ -f /usr/include/ncursesw/curses.h ]; then |
23 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' | 23 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' |
24 | echo ' -DNCURSES_WIDECHAR=1' | ||
24 | elif [ -f /usr/include/ncurses/ncurses.h ]; then | 25 | elif [ -f /usr/include/ncurses/ncurses.h ]; then |
25 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' | 26 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' |
26 | elif [ -f /usr/include/ncurses/curses.h ]; then | 27 | elif [ -f /usr/include/ncurses/curses.h ]; then |
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index ee17a5264d5b..307022a8beef 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -221,7 +221,6 @@ int dialog_menu(const char *title, const char *prompt, | |||
221 | const void *selected, int *s_scroll); | 221 | const void *selected, int *s_scroll); |
222 | int dialog_checklist(const char *title, const char *prompt, int height, | 222 | int dialog_checklist(const char *title, const char *prompt, int height, |
223 | int width, int list_height); | 223 | int width, int list_height); |
224 | extern char dialog_input_result[]; | ||
225 | int dialog_inputbox(const char *title, const char *prompt, int height, | 224 | int dialog_inputbox(const char *title, const char *prompt, int height, |
226 | int width, const char *init); | 225 | int width, const char *init); |
227 | 226 | ||
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index dd8e587c50e2..21404a04d7c3 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
@@ -45,7 +45,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
45 | const char *init) | 45 | const char *init) |
46 | { | 46 | { |
47 | int i, x, y, box_y, box_x, box_width; | 47 | int i, x, y, box_y, box_x, box_width; |
48 | int input_x = 0, scroll = 0, key = 0, button = -1; | 48 | int input_x = 0, key = 0, button = -1; |
49 | int show_x, len, pos; | ||
49 | char *instr = dialog_input_result; | 50 | char *instr = dialog_input_result; |
50 | WINDOW *dialog; | 51 | WINDOW *dialog; |
51 | 52 | ||
@@ -97,14 +98,17 @@ do_resize: | |||
97 | wmove(dialog, box_y, box_x); | 98 | wmove(dialog, box_y, box_x); |
98 | wattrset(dialog, dlg.inputbox.atr); | 99 | wattrset(dialog, dlg.inputbox.atr); |
99 | 100 | ||
100 | input_x = strlen(instr); | 101 | len = strlen(instr); |
102 | pos = len; | ||
101 | 103 | ||
102 | if (input_x >= box_width) { | 104 | if (len >= box_width) { |
103 | scroll = input_x - box_width + 1; | 105 | show_x = len - box_width + 1; |
104 | input_x = box_width - 1; | 106 | input_x = box_width - 1; |
105 | for (i = 0; i < box_width - 1; i++) | 107 | for (i = 0; i < box_width - 1; i++) |
106 | waddch(dialog, instr[scroll + i]); | 108 | waddch(dialog, instr[show_x + i]); |
107 | } else { | 109 | } else { |
110 | show_x = 0; | ||
111 | input_x = len; | ||
108 | waddstr(dialog, instr); | 112 | waddstr(dialog, instr); |
109 | } | 113 | } |
110 | 114 | ||
@@ -121,45 +125,104 @@ do_resize: | |||
121 | case KEY_UP: | 125 | case KEY_UP: |
122 | case KEY_DOWN: | 126 | case KEY_DOWN: |
123 | break; | 127 | break; |
124 | case KEY_LEFT: | ||
125 | continue; | ||
126 | case KEY_RIGHT: | ||
127 | continue; | ||
128 | case KEY_BACKSPACE: | 128 | case KEY_BACKSPACE: |
129 | case 127: | 129 | case 127: |
130 | if (input_x || scroll) { | 130 | if (pos) { |
131 | wattrset(dialog, dlg.inputbox.atr); | 131 | wattrset(dialog, dlg.inputbox.atr); |
132 | if (!input_x) { | 132 | if (input_x == 0) { |
133 | scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); | 133 | show_x--; |
134 | wmove(dialog, box_y, box_x); | ||
135 | for (i = 0; i < box_width; i++) | ||
136 | waddch(dialog, | ||
137 | instr[scroll + input_x + i] ? | ||
138 | instr[scroll + input_x + i] : ' '); | ||
139 | input_x = strlen(instr) - scroll; | ||
140 | } else | 134 | } else |
141 | input_x--; | 135 | input_x--; |
142 | instr[scroll + input_x] = '\0'; | 136 | |
143 | mvwaddch(dialog, box_y, input_x + box_x, ' '); | 137 | if (pos < len) { |
138 | for (i = pos - 1; i < len; i++) { | ||
139 | instr[i] = instr[i+1]; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | pos--; | ||
144 | len--; | ||
145 | instr[len] = '\0'; | ||
146 | wmove(dialog, box_y, box_x); | ||
147 | for (i = 0; i < box_width; i++) { | ||
148 | if (!instr[show_x + i]) { | ||
149 | waddch(dialog, ' '); | ||
150 | break; | ||
151 | } | ||
152 | waddch(dialog, instr[show_x + i]); | ||
153 | } | ||
144 | wmove(dialog, box_y, input_x + box_x); | 154 | wmove(dialog, box_y, input_x + box_x); |
145 | wrefresh(dialog); | 155 | wrefresh(dialog); |
146 | } | 156 | } |
147 | continue; | 157 | continue; |
158 | case KEY_LEFT: | ||
159 | if (pos > 0) { | ||
160 | if (input_x > 0) { | ||
161 | wmove(dialog, box_y, --input_x + box_x); | ||
162 | } else if (input_x == 0) { | ||
163 | show_x--; | ||
164 | wmove(dialog, box_y, box_x); | ||
165 | for (i = 0; i < box_width; i++) { | ||
166 | if (!instr[show_x + i]) { | ||
167 | waddch(dialog, ' '); | ||
168 | break; | ||
169 | } | ||
170 | waddch(dialog, instr[show_x + i]); | ||
171 | } | ||
172 | wmove(dialog, box_y, box_x); | ||
173 | } | ||
174 | pos--; | ||
175 | } | ||
176 | continue; | ||
177 | case KEY_RIGHT: | ||
178 | if (pos < len) { | ||
179 | if (input_x < box_width - 1) { | ||
180 | wmove(dialog, box_y, ++input_x + box_x); | ||
181 | } else if (input_x == box_width - 1) { | ||
182 | show_x++; | ||
183 | wmove(dialog, box_y, box_x); | ||
184 | for (i = 0; i < box_width; i++) { | ||
185 | if (!instr[show_x + i]) { | ||
186 | waddch(dialog, ' '); | ||
187 | break; | ||
188 | } | ||
189 | waddch(dialog, instr[show_x + i]); | ||
190 | } | ||
191 | wmove(dialog, box_y, input_x + box_x); | ||
192 | } | ||
193 | pos++; | ||
194 | } | ||
195 | continue; | ||
148 | default: | 196 | default: |
149 | if (key < 0x100 && isprint(key)) { | 197 | if (key < 0x100 && isprint(key)) { |
150 | if (scroll + input_x < MAX_LEN) { | 198 | if (len < MAX_LEN) { |
151 | wattrset(dialog, dlg.inputbox.atr); | 199 | wattrset(dialog, dlg.inputbox.atr); |
152 | instr[scroll + input_x] = key; | 200 | if (pos < len) { |
153 | instr[scroll + input_x + 1] = '\0'; | 201 | for (i = len; i > pos; i--) |
202 | instr[i] = instr[i-1]; | ||
203 | instr[pos] = key; | ||
204 | } else { | ||
205 | instr[len] = key; | ||
206 | } | ||
207 | pos++; | ||
208 | len++; | ||
209 | instr[len] = '\0'; | ||
210 | |||
154 | if (input_x == box_width - 1) { | 211 | if (input_x == box_width - 1) { |
155 | scroll++; | 212 | show_x++; |
156 | wmove(dialog, box_y, box_x); | ||
157 | for (i = 0; i < box_width - 1; i++) | ||
158 | waddch(dialog, instr [scroll + i]); | ||
159 | } else { | 213 | } else { |
160 | wmove(dialog, box_y, input_x++ + box_x); | 214 | input_x++; |
161 | waddch(dialog, key); | 215 | } |
216 | |||
217 | wmove(dialog, box_y, box_x); | ||
218 | for (i = 0; i < box_width; i++) { | ||
219 | if (!instr[show_x + i]) { | ||
220 | waddch(dialog, ' '); | ||
221 | break; | ||
222 | } | ||
223 | waddch(dialog, instr[show_x + i]); | ||
162 | } | 224 | } |
225 | wmove(dialog, box_y, input_x + box_x); | ||
163 | wrefresh(dialog); | 226 | wrefresh(dialog); |
164 | } else | 227 | } else |
165 | flash(); /* Alarm user about overflow */ | 228 | flash(); /* Alarm user about overflow */ |
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 1d604738fa13..48d382e7e374 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | * *) A bugfix for the Page-Down problem | 27 | * *) A bugfix for the Page-Down problem |
28 | * | 28 | * |
29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | 29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set |
30 | * to the first position in the menu box. Now lxdialog is a bit | 30 | * to the first position in the menu box. Now lxdialog is a bit |
31 | * smarter and works more like other menu systems (just have a look at | 31 | * smarter and works more like other menu systems (just have a look at |
32 | * it). | 32 | * it). |
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, | |||
154 | */ | 154 | */ |
155 | static void print_buttons(WINDOW * win, int height, int width, int selected) | 155 | static void print_buttons(WINDOW * win, int height, int width, int selected) |
156 | { | 156 | { |
157 | int x = width / 2 - 16; | 157 | int x = width / 2 - 28; |
158 | int y = height - 2; | 158 | int y = height - 2; |
159 | 159 | ||
160 | print_button(win, gettext("Select"), y, x, selected == 0); | 160 | print_button(win, gettext("Select"), y, x, selected == 0); |
161 | print_button(win, gettext(" Exit "), y, x + 12, selected == 1); | 161 | print_button(win, gettext(" Exit "), y, x + 12, selected == 1); |
162 | print_button(win, gettext(" Help "), y, x + 24, selected == 2); | 162 | print_button(win, gettext(" Help "), y, x + 24, selected == 2); |
163 | print_button(win, gettext(" Save "), y, x + 36, selected == 3); | ||
164 | print_button(win, gettext(" Load "), y, x + 48, selected == 4); | ||
163 | 165 | ||
164 | wmove(win, y, x + 1 + 12 * selected); | 166 | wmove(win, y, x + 1 + 12 * selected); |
165 | wrefresh(win); | 167 | wrefresh(win); |
@@ -372,7 +374,7 @@ do_resize: | |||
372 | case TAB: | 374 | case TAB: |
373 | case KEY_RIGHT: | 375 | case KEY_RIGHT: |
374 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | 376 | button = ((key == KEY_LEFT ? --button : ++button) < 0) |
375 | ? 2 : (button > 2 ? 0 : button); | 377 | ? 4 : (button > 4 ? 0 : button); |
376 | 378 | ||
377 | print_buttons(dialog, height, width, button); | 379 | print_buttons(dialog, height, width, button); |
378 | wrefresh(menu); | 380 | wrefresh(menu); |
@@ -399,17 +401,17 @@ do_resize: | |||
399 | return 2; | 401 | return 2; |
400 | case 's': | 402 | case 's': |
401 | case 'y': | 403 | case 'y': |
402 | return 3; | 404 | return 5; |
403 | case 'n': | 405 | case 'n': |
404 | return 4; | 406 | return 6; |
405 | case 'm': | 407 | case 'm': |
406 | return 5; | 408 | return 7; |
407 | case ' ': | 409 | case ' ': |
408 | return 6; | 410 | return 8; |
409 | case '/': | 411 | case '/': |
410 | return 7; | 412 | return 9; |
411 | case 'z': | 413 | case 'z': |
412 | return 8; | 414 | return 10; |
413 | case '\n': | 415 | case '\n': |
414 | return button; | 416 | return button; |
415 | } | 417 | } |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 53975cf87608..566288a76370 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -280,6 +280,7 @@ static struct menu *current_menu; | |||
280 | static int child_count; | 280 | static int child_count; |
281 | static int single_menu_mode; | 281 | static int single_menu_mode; |
282 | static int show_all_options; | 282 | static int show_all_options; |
283 | static int save_and_exit; | ||
283 | 284 | ||
284 | static void conf(struct menu *menu, struct menu *active_menu); | 285 | static void conf(struct menu *menu, struct menu *active_menu); |
285 | static void conf_choice(struct menu *menu); | 286 | static void conf_choice(struct menu *menu); |
@@ -348,15 +349,19 @@ static void search_conf(void) | |||
348 | { | 349 | { |
349 | struct symbol **sym_arr; | 350 | struct symbol **sym_arr; |
350 | struct gstr res; | 351 | struct gstr res; |
352 | struct gstr title; | ||
351 | char *dialog_input; | 353 | char *dialog_input; |
352 | int dres, vscroll = 0, hscroll = 0; | 354 | int dres, vscroll = 0, hscroll = 0; |
353 | bool again; | 355 | bool again; |
354 | 356 | ||
357 | title = str_new(); | ||
358 | str_printf( &title, _("Enter %s (sub)string to search for " | ||
359 | "(with or without \"%s\")"), CONFIG_, CONFIG_); | ||
360 | |||
355 | again: | 361 | again: |
356 | dialog_clear(); | 362 | dialog_clear(); |
357 | dres = dialog_inputbox(_("Search Configuration Parameter"), | 363 | dres = dialog_inputbox(_("Search Configuration Parameter"), |
358 | _("Enter " CONFIG_ " (sub)string to search for " | 364 | str_get(&title), |
359 | "(with or without \"" CONFIG_ "\")"), | ||
360 | 10, 75, ""); | 365 | 10, 75, ""); |
361 | switch (dres) { | 366 | switch (dres) { |
362 | case 0: | 367 | case 0: |
@@ -365,6 +370,7 @@ again: | |||
365 | show_helptext(_("Search Configuration"), search_help); | 370 | show_helptext(_("Search Configuration"), search_help); |
366 | goto again; | 371 | goto again; |
367 | default: | 372 | default: |
373 | str_free(&title); | ||
368 | return; | 374 | return; |
369 | } | 375 | } |
370 | 376 | ||
@@ -398,6 +404,7 @@ again: | |||
398 | str_free(&res); | 404 | str_free(&res); |
399 | } while (again); | 405 | } while (again); |
400 | free(sym_arr); | 406 | free(sym_arr); |
407 | str_free(&title); | ||
401 | } | 408 | } |
402 | 409 | ||
403 | static void build_conf(struct menu *menu) | 410 | static void build_conf(struct menu *menu) |
@@ -592,14 +599,6 @@ static void conf(struct menu *menu, struct menu *active_menu) | |||
592 | build_conf(menu); | 599 | build_conf(menu); |
593 | if (!child_count) | 600 | if (!child_count) |
594 | break; | 601 | break; |
595 | if (menu == &rootmenu) { | ||
596 | item_make("--- "); | ||
597 | item_set_tag(':'); | ||
598 | item_make(_(" Load an Alternate Configuration File")); | ||
599 | item_set_tag('L'); | ||
600 | item_make(_(" Save an Alternate Configuration File")); | ||
601 | item_set_tag('S'); | ||
602 | } | ||
603 | dialog_clear(); | 602 | dialog_clear(); |
604 | res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), | 603 | res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), |
605 | _(menu_instructions), | 604 | _(menu_instructions), |
@@ -636,12 +635,6 @@ static void conf(struct menu *menu, struct menu *active_menu) | |||
636 | case 's': | 635 | case 's': |
637 | conf_string(submenu); | 636 | conf_string(submenu); |
638 | break; | 637 | break; |
639 | case 'L': | ||
640 | conf_load(); | ||
641 | break; | ||
642 | case 'S': | ||
643 | conf_save(); | ||
644 | break; | ||
645 | } | 638 | } |
646 | break; | 639 | break; |
647 | case 2: | 640 | case 2: |
@@ -651,6 +644,12 @@ static void conf(struct menu *menu, struct menu *active_menu) | |||
651 | show_helptext(_("README"), _(mconf_readme)); | 644 | show_helptext(_("README"), _(mconf_readme)); |
652 | break; | 645 | break; |
653 | case 3: | 646 | case 3: |
647 | conf_save(); | ||
648 | break; | ||
649 | case 4: | ||
650 | conf_load(); | ||
651 | break; | ||
652 | case 5: | ||
654 | if (item_is_tag('t')) { | 653 | if (item_is_tag('t')) { |
655 | if (sym_set_tristate_value(sym, yes)) | 654 | if (sym_set_tristate_value(sym, yes)) |
656 | break; | 655 | break; |
@@ -658,24 +657,24 @@ static void conf(struct menu *menu, struct menu *active_menu) | |||
658 | show_textbox(NULL, setmod_text, 6, 74); | 657 | show_textbox(NULL, setmod_text, 6, 74); |
659 | } | 658 | } |
660 | break; | 659 | break; |
661 | case 4: | 660 | case 6: |
662 | if (item_is_tag('t')) | 661 | if (item_is_tag('t')) |
663 | sym_set_tristate_value(sym, no); | 662 | sym_set_tristate_value(sym, no); |
664 | break; | 663 | break; |
665 | case 5: | 664 | case 7: |
666 | if (item_is_tag('t')) | 665 | if (item_is_tag('t')) |
667 | sym_set_tristate_value(sym, mod); | 666 | sym_set_tristate_value(sym, mod); |
668 | break; | 667 | break; |
669 | case 6: | 668 | case 8: |
670 | if (item_is_tag('t')) | 669 | if (item_is_tag('t')) |
671 | sym_toggle_tristate_value(sym); | 670 | sym_toggle_tristate_value(sym); |
672 | else if (item_is_tag('m')) | 671 | else if (item_is_tag('m')) |
673 | conf(submenu, NULL); | 672 | conf(submenu, NULL); |
674 | break; | 673 | break; |
675 | case 7: | 674 | case 9: |
676 | search_conf(); | 675 | search_conf(); |
677 | break; | 676 | break; |
678 | case 8: | 677 | case 10: |
679 | show_all_options = !show_all_options; | 678 | show_all_options = !show_all_options; |
680 | break; | 679 | break; |
681 | } | 680 | } |
@@ -702,6 +701,17 @@ static void show_helptext(const char *title, const char *text) | |||
702 | show_textbox(title, text, 0, 0); | 701 | show_textbox(title, text, 0, 0); |
703 | } | 702 | } |
704 | 703 | ||
704 | static void conf_message_callback(const char *fmt, va_list ap) | ||
705 | { | ||
706 | char buf[PATH_MAX+1]; | ||
707 | |||
708 | vsnprintf(buf, sizeof(buf), fmt, ap); | ||
709 | if (save_and_exit) | ||
710 | printf("%s", buf); | ||
711 | else | ||
712 | show_textbox(NULL, buf, 6, 60); | ||
713 | } | ||
714 | |||
705 | static void show_help(struct menu *menu) | 715 | static void show_help(struct menu *menu) |
706 | { | 716 | { |
707 | struct gstr help = str_new(); | 717 | struct gstr help = str_new(); |
@@ -870,6 +880,7 @@ static int handle_exit(void) | |||
870 | { | 880 | { |
871 | int res; | 881 | int res; |
872 | 882 | ||
883 | save_and_exit = 1; | ||
873 | dialog_clear(); | 884 | dialog_clear(); |
874 | if (conf_get_changed()) | 885 | if (conf_get_changed()) |
875 | res = dialog_yesno(NULL, | 886 | res = dialog_yesno(NULL, |
@@ -941,6 +952,7 @@ int main(int ac, char **av) | |||
941 | } | 952 | } |
942 | 953 | ||
943 | set_config_filename(conf_get_configname()); | 954 | set_config_filename(conf_get_configname()); |
955 | conf_set_message_callback(conf_message_callback); | ||
944 | do { | 956 | do { |
945 | conf(&rootmenu, NULL); | 957 | conf(&rootmenu, NULL); |
946 | res = handle_exit(); | 958 | res = handle_exit(); |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index e98a05c8e508..f3bffa309333 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -48,7 +48,7 @@ void menu_add_entry(struct symbol *sym) | |||
48 | { | 48 | { |
49 | struct menu *menu; | 49 | struct menu *menu; |
50 | 50 | ||
51 | menu = malloc(sizeof(*menu)); | 51 | menu = xmalloc(sizeof(*menu)); |
52 | memset(menu, 0, sizeof(*menu)); | 52 | memset(menu, 0, sizeof(*menu)); |
53 | menu->sym = sym; | 53 | menu->sym = sym; |
54 | menu->parent = current_menu; | 54 | menu->parent = current_menu; |
@@ -531,7 +531,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, | |||
531 | location = menu; | 531 | location = menu; |
532 | } | 532 | } |
533 | if (head && location) { | 533 | if (head && location) { |
534 | jump = malloc(sizeof(struct jump_key)); | 534 | jump = xmalloc(sizeof(struct jump_key)); |
535 | 535 | ||
536 | if (menu_is_visible(prop->menu)) { | 536 | if (menu_is_visible(prop->menu)) { |
537 | /* | 537 | /* |
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 974d5cb7e30a..05274fccb88e 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
@@ -32,11 +32,13 @@ usage() { | |||
32 | echo " -m only merge the fragments, do not execute the make command" | 32 | echo " -m only merge the fragments, do not execute the make command" |
33 | echo " -n use allnoconfig instead of alldefconfig" | 33 | echo " -n use allnoconfig instead of alldefconfig" |
34 | echo " -r list redundant entries when merging fragments" | 34 | echo " -r list redundant entries when merging fragments" |
35 | echo " -O dir to put generated output files" | ||
35 | } | 36 | } |
36 | 37 | ||
37 | MAKE=true | 38 | MAKE=true |
38 | ALLTARGET=alldefconfig | 39 | ALLTARGET=alldefconfig |
39 | WARNREDUN=false | 40 | WARNREDUN=false |
41 | OUTPUT=. | ||
40 | 42 | ||
41 | while true; do | 43 | while true; do |
42 | case $1 in | 44 | case $1 in |
@@ -59,6 +61,16 @@ while true; do | |||
59 | shift | 61 | shift |
60 | continue | 62 | continue |
61 | ;; | 63 | ;; |
64 | "-O") | ||
65 | if [ -d $2 ];then | ||
66 | OUTPUT=$(echo $2 | sed 's/\/*$//') | ||
67 | else | ||
68 | echo "output directory $2 does not exist" 1>&2 | ||
69 | exit 1 | ||
70 | fi | ||
71 | shift 2 | ||
72 | continue | ||
73 | ;; | ||
62 | *) | 74 | *) |
63 | break | 75 | break |
64 | ;; | 76 | ;; |
@@ -100,9 +112,9 @@ for MERGE_FILE in $MERGE_LIST ; do | |||
100 | done | 112 | done |
101 | 113 | ||
102 | if [ "$MAKE" = "false" ]; then | 114 | if [ "$MAKE" = "false" ]; then |
103 | cp $TMP_FILE .config | 115 | cp $TMP_FILE $OUTPUT/.config |
104 | echo "#" | 116 | echo "#" |
105 | echo "# merged configuration written to .config (needs make)" | 117 | echo "# merged configuration written to $OUTPUT/.config (needs make)" |
106 | echo "#" | 118 | echo "#" |
107 | clean_up | 119 | clean_up |
108 | exit | 120 | exit |
@@ -111,14 +123,14 @@ fi | |||
111 | # Use the merged file as the starting point for: | 123 | # Use the merged file as the starting point for: |
112 | # alldefconfig: Fills in any missing symbols with Kconfig default | 124 | # alldefconfig: Fills in any missing symbols with Kconfig default |
113 | # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set | 125 | # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set |
114 | make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET | 126 | make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET |
115 | 127 | ||
116 | 128 | ||
117 | # Check all specified config values took (might have missed-dependency issues) | 129 | # Check all specified config values took (might have missed-dependency issues) |
118 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do | 130 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do |
119 | 131 | ||
120 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) | 132 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) |
121 | ACTUAL_VAL=$(grep -w -e "$CFG" .config) | 133 | ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config) |
122 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then | 134 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then |
123 | echo "Value requested for $CFG not in final .config" | 135 | echo "Value requested for $CFG not in final .config" |
124 | echo "Requested value: $REQUESTED_VAL" | 136 | echo "Requested value: $REQUESTED_VAL" |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 87d4b15da951..dbf31edd22b2 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -7,215 +7,208 @@ | |||
7 | */ | 7 | */ |
8 | #define _GNU_SOURCE | 8 | #define _GNU_SOURCE |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #include <stdlib.h> | ||
10 | 11 | ||
11 | #include "lkc.h" | 12 | #include "lkc.h" |
12 | #include "nconf.h" | 13 | #include "nconf.h" |
13 | #include <ctype.h> | 14 | #include <ctype.h> |
14 | 15 | ||
15 | static const char nconf_readme[] = N_( | 16 | static const char nconf_global_help[] = N_( |
16 | "Overview\n" | 17 | "Help windows\n" |
17 | "--------\n" | 18 | "------------\n" |
18 | "This interface let you select features and parameters for the build.\n" | 19 | "o Global help: Unless in a data entry window, pressing <F1> will give \n" |
19 | "Features can either be built-in, modularized, or ignored. Parameters\n" | 20 | " you the global help window, which you are just reading.\n" |
20 | "must be entered in as decimal or hexadecimal numbers or text.\n" | ||
21 | "\n" | 21 | "\n" |
22 | "Menu items beginning with following braces represent features that\n" | 22 | "o A short version of the global help is available by pressing <F3>.\n" |
23 | " [ ] can be built in or removed\n" | ||
24 | " < > can be built in, modularized or removed\n" | ||
25 | " { } can be built in or modularized (selected by other feature)\n" | ||
26 | " - - are selected by other feature,\n" | ||
27 | " XXX cannot be selected. Use Symbol Info to find out why,\n" | ||
28 | "while *, M or whitespace inside braces means to build in, build as\n" | ||
29 | "a module or to exclude the feature respectively.\n" | ||
30 | "\n" | 23 | "\n" |
31 | "To change any of these features, highlight it with the cursor\n" | 24 | "o Local help: To get help related to the current menu entry, use any\n" |
32 | "keys and press <Y> to build it in, <M> to make it a module or\n" | 25 | " of <?> <h>, or if in a data entry window then press <F1>.\n" |
33 | "<N> to removed it. You may also press the <Space Bar> to cycle\n" | ||
34 | "through the available options (ie. Y->N->M->Y).\n" | ||
35 | "\n" | 26 | "\n" |
36 | "Some additional keyboard hints:\n" | ||
37 | "\n" | 27 | "\n" |
38 | "Menus\n" | 28 | "Menu entries\n" |
39 | "----------\n" | 29 | "------------\n" |
40 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | 30 | "This interface lets you select features and parameters for the kernel\n" |
41 | " you wish to change use <Enter> or <Space>. Goto submenu by \n" | 31 | "build. Kernel features can either be built-in, modularized, or removed.\n" |
42 | " pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n" | 32 | "Parameters must be entered as text or decimal or hexadecimal numbers.\n" |
43 | " Submenus are designated by \"--->\".\n" | ||
44 | "\n" | ||
45 | " Searching: pressing '/' triggers interactive search mode.\n" | ||
46 | " nconfig performs a case insensitive search for the string\n" | ||
47 | " in the menu prompts (no regex support).\n" | ||
48 | " Pressing the up/down keys highlights the previous/next\n" | ||
49 | " matching item. Backspace removes one character from the\n" | ||
50 | " match string. Pressing either '/' again or ESC exits\n" | ||
51 | " search mode. All other keys behave normally.\n" | ||
52 | "\n" | 33 | "\n" |
53 | " You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" | 34 | "Menu entries beginning with following braces represent features that\n" |
54 | " unseen options into view.\n" | 35 | " [ ] can be built in or removed\n" |
36 | " < > can be built in, modularized or removed\n" | ||
37 | " { } can be built in or modularized, are selected by another feature\n" | ||
38 | " - - are selected by another feature\n" | ||
39 | " XXX cannot be selected. Symbol Info <F2> tells you why.\n" | ||
40 | "*, M or whitespace inside braces means to build in, build as a module\n" | ||
41 | "or to exclude the feature respectively.\n" | ||
55 | "\n" | 42 | "\n" |
56 | "o To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n" | 43 | "To change any of these features, highlight it with the movement keys\n" |
44 | "listed below and press <y> to build it in, <m> to make it a module or\n" | ||
45 | "<n> to remove it. You may press the <Space> key to cycle through the\n" | ||
46 | "available options.\n" | ||
57 | "\n" | 47 | "\n" |
58 | "o To get help with an item, press <F1>\n" | 48 | "A trailing \"--->\" designates a submenu.\n" |
59 | " Shortcut: Press <h> or <?>.\n" | ||
60 | "\n" | 49 | "\n" |
61 | "\n" | 50 | "\n" |
62 | "Radiolists (Choice lists)\n" | 51 | "Menu navigation keys\n" |
63 | "-----------\n" | 52 | "----------------------------------------------------------------------\n" |
64 | "o Use the cursor keys to select the option you wish to set and press\n" | 53 | "Linewise up <Up>\n" |
65 | " <S> or the <SPACE BAR>.\n" | 54 | "Linewise down <Down>\n" |
55 | "Pagewise up <Page Up>\n" | ||
56 | "Pagewise down <Page Down>\n" | ||
57 | "First entry <Home>\n" | ||
58 | "Last entry <End>\n" | ||
59 | "Enter a submenu <Right> <Enter>\n" | ||
60 | "Go back to parent menu <Left> <Esc> <F5>\n" | ||
61 | "Close a help window <Enter> <Esc> <F5>\n" | ||
62 | "Close entry window, apply <Enter>\n" | ||
63 | "Close entry window, forget <Esc> <F5>\n" | ||
64 | "Start incremental, case-insensitive search for STRING in menu entries,\n" | ||
65 | " no regex support, STRING is displayed in upper left corner\n" | ||
66 | " </>STRING\n" | ||
67 | " Remove last character <Backspace>\n" | ||
68 | " Jump to next hit <Down>\n" | ||
69 | " Jump to previous hit <Up>\n" | ||
70 | "Exit menu search mode </> <Esc>\n" | ||
71 | "Search for configuration variables with or without leading CONFIG_\n" | ||
72 | " <F8>RegExpr<Enter>\n" | ||
73 | "Verbose search help <F8><F1>\n" | ||
74 | "----------------------------------------------------------------------\n" | ||
66 | "\n" | 75 | "\n" |
67 | " Shortcut: Press the first letter of the option you wish to set then\n" | 76 | "Unless in a data entry window, key <1> may be used instead of <F1>,\n" |
68 | " press <S> or <SPACE BAR>.\n" | 77 | "<2> instead of <F2>, etc.\n" |
69 | "\n" | 78 | "\n" |
70 | "o To see available help for the item, press <F1>\n" | ||
71 | " Shortcut: Press <H> or <?>.\n" | ||
72 | "\n" | 79 | "\n" |
80 | "Radiolist (Choice list)\n" | ||
81 | "-----------------------\n" | ||
82 | "Use the movement keys listed above to select the option you wish to set\n" | ||
83 | "and press <Space>.\n" | ||
73 | "\n" | 84 | "\n" |
74 | "Data Entry\n" | ||
75 | "-----------\n" | ||
76 | "o Enter the requested information and press <ENTER>\n" | ||
77 | " If you are entering hexadecimal values, it is not necessary to\n" | ||
78 | " add the '0x' prefix to the entry.\n" | ||
79 | "\n" | 85 | "\n" |
80 | "o For help, press <F1>.\n" | 86 | "Data entry\n" |
87 | "----------\n" | ||
88 | "Enter the requested information and press <Enter>. Hexadecimal values\n" | ||
89 | "may be entered without the \"0x\" prefix.\n" | ||
81 | "\n" | 90 | "\n" |
82 | "\n" | 91 | "\n" |
83 | "Text Box (Help Window)\n" | 92 | "Text Box (Help Window)\n" |
84 | "--------\n" | 93 | "----------------------\n" |
85 | "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" | 94 | "Use movement keys as listed in table above.\n" |
86 | " keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n" | ||
87 | " those who are familiar with less and lynx.\n" | ||
88 | "\n" | 95 | "\n" |
89 | "o Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n" | 96 | "Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n" |
90 | "\n" | 97 | "\n" |
91 | "\n" | 98 | "\n" |
92 | "Alternate Configuration Files\n" | 99 | "Alternate configuration files\n" |
93 | "-----------------------------\n" | 100 | "-----------------------------\n" |
94 | "nconfig supports the use of alternate configuration files for\n" | 101 | "nconfig supports switching between different configurations.\n" |
95 | "those who, for various reasons, find it necessary to switch\n" | 102 | "Press <F6> to save your current configuration. Press <F7> and enter\n" |
96 | "between different configurations.\n" | 103 | "a file name to load a previously saved configuration.\n" |
97 | "\n" | 104 | "\n" |
98 | "At the end of the main menu you will find two options. One is\n" | ||
99 | "for saving the current configuration to a file of your choosing.\n" | ||
100 | "The other option is for loading a previously saved alternate\n" | ||
101 | "configuration.\n" | ||
102 | "\n" | 105 | "\n" |
103 | "Even if you don't use alternate configuration files, but you\n" | 106 | "Terminal configuration\n" |
104 | "find during a nconfig session that you have completely messed\n" | 107 | "----------------------\n" |
105 | "up your settings, you may use the \"Load Alternate...\" option to\n" | 108 | "If you use nconfig in a xterm window, make sure your TERM environment\n" |
106 | "restore your previously saved settings from \".config\" without\n" | 109 | "variable specifies a terminal configuration which supports at least\n" |
107 | "restarting nconfig.\n" | 110 | "16 colors. Otherwise nconfig will look rather bad.\n" |
108 | "\n" | 111 | "\n" |
109 | "Other information\n" | 112 | "If the \"stty size\" command reports the current terminalsize correctly,\n" |
110 | "-----------------\n" | 113 | "nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n" |
111 | "If you use nconfig in an XTERM window make sure you have your\n" | 114 | "and display longer menus properly.\n" |
112 | "$TERM variable set to point to a xterm definition which supports color.\n" | ||
113 | "Otherwise, nconfig will look rather bad. nconfig will not\n" | ||
114 | "display correctly in a RXVT window because rxvt displays only one\n" | ||
115 | "intensity of color, bright.\n" | ||
116 | "\n" | 115 | "\n" |
117 | "nconfig will display larger menus on screens or xterms which are\n" | ||
118 | "set to display more than the standard 25 row by 80 column geometry.\n" | ||
119 | "In order for this to work, the \"stty size\" command must be able to\n" | ||
120 | "display the screen's current row and column geometry. I STRONGLY\n" | ||
121 | "RECOMMEND that you make sure you do NOT have the shell variables\n" | ||
122 | "LINES and COLUMNS exported into your environment. Some distributions\n" | ||
123 | "export those variables via /etc/profile. Some ncurses programs can\n" | ||
124 | "become confused when those variables (LINES & COLUMNS) don't reflect\n" | ||
125 | "the true screen size.\n" | ||
126 | "\n" | 116 | "\n" |
127 | "Optional personality available\n" | 117 | "Single menu mode\n" |
128 | "------------------------------\n" | 118 | "----------------\n" |
129 | "If you prefer to have all of the options listed in a single menu, rather\n" | 119 | "If you prefer to have all of the menu entries listed in a single menu,\n" |
130 | "than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n" | 120 | "rather than the default multimenu hierarchy, run nconfig with\n" |
131 | "environment variable set to single_menu. Example:\n" | 121 | "NCONFIG_MODE environment variable set to single_menu. Example:\n" |
132 | "\n" | 122 | "\n" |
133 | "make NCONFIG_MODE=single_menu nconfig\n" | 123 | "make NCONFIG_MODE=single_menu nconfig\n" |
134 | "\n" | 124 | "\n" |
135 | "<Enter> will then unroll the appropriate category, or enfold it if it\n" | 125 | "<Enter> will then unfold the appropriate category, or fold it if it\n" |
136 | "is already unrolled.\n" | 126 | "is already unfolded. Folded menu entries will be designated by a\n" |
127 | "leading \"++>\" and unfolded entries by a leading \"-->\".\n" | ||
137 | "\n" | 128 | "\n" |
138 | "Note that this mode can eventually be a little more CPU expensive\n" | 129 | "Note that this mode can eventually be a little more CPU expensive than\n" |
139 | "(especially with a larger number of unrolled categories) than the\n" | 130 | "the default mode, especially with a larger number of unfolded submenus.\n" |
140 | "default mode.\n" | ||
141 | "\n"), | 131 | "\n"), |
142 | menu_no_f_instructions[] = N_( | 132 | menu_no_f_instructions[] = N_( |
143 | " You do not have function keys support. Please follow the\n" | 133 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" |
144 | " following instructions:\n" | 134 | "Submenus are designated by a trailing \"--->\".\n" |
145 | " Arrow keys navigate the menu.\n" | 135 | "\n" |
146 | " <Enter> or <right-arrow> selects submenus --->.\n" | 136 | "Use the following keys to navigate the menus:\n" |
147 | " Capital Letters are hotkeys.\n" | 137 | "Move up or down with <Up> and <Down>.\n" |
148 | " Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" | 138 | "Enter a submenu with <Enter> or <Right>.\n" |
149 | " Pressing SpaceBar toggles between the above options.\n" | 139 | "Exit a submenu to its parent menu with <Esc> or <Left>.\n" |
150 | " Press <Esc> or <left-arrow> to go back one menu,\n" | 140 | "Pressing <y> includes, <n> excludes, <m> modularizes features.\n" |
151 | " <?> or <h> for Help, </> for Search.\n" | 141 | "Pressing <Space> cycles through the available options.\n" |
152 | " <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" | 142 | "To search for menu entries press </>.\n" |
153 | " Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | 143 | "<Esc> always leaves the current window.\n" |
154 | " <Esc> always leaves the current window.\n"), | 144 | "\n" |
145 | "You do not have function keys support.\n" | ||
146 | "Press <1> instead of <F1>, <2> instead of <F2>, etc.\n" | ||
147 | "For verbose global help use key <1>.\n" | ||
148 | "For help related to the current menu entry press <?> or <h>.\n"), | ||
155 | menu_instructions[] = N_( | 149 | menu_instructions[] = N_( |
156 | " Arrow keys navigate the menu.\n" | 150 | "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" |
157 | " <Enter> or <right-arrow> selects submenus --->.\n" | 151 | "Submenus are designated by a trailing \"--->\".\n" |
158 | " Capital Letters are hotkeys.\n" | 152 | "\n" |
159 | " Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" | 153 | "Use the following keys to navigate the menus:\n" |
160 | " Pressing SpaceBar toggles between the above options\n" | 154 | "Move up or down with <Up> or <Down>.\n" |
161 | " Press <Esc>, <F5> or <left-arrow> to go back one menu,\n" | 155 | "Enter a submenu with <Enter> or <Right>.\n" |
162 | " <?>, <F1> or <h> for Help, </> for Search.\n" | 156 | "Exit a submenu to its parent menu with <Esc> or <Left>.\n" |
163 | " <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" | 157 | "Pressing <y> includes, <n> excludes, <m> modularizes features.\n" |
164 | " Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | 158 | "Pressing <Space> cycles through the available options.\n" |
165 | " <Esc> always leaves the current window\n"), | 159 | "To search for menu entries press </>.\n" |
160 | "<Esc> always leaves the current window.\n" | ||
161 | "\n" | ||
162 | "Pressing <1> may be used instead of <F1>, <2> instead of <F2>, etc.\n" | ||
163 | "For verbose global help press <F1>.\n" | ||
164 | "For help related to the current menu entry press <?> or <h>.\n"), | ||
166 | radiolist_instructions[] = N_( | 165 | radiolist_instructions[] = N_( |
167 | " Use the arrow keys to navigate this window or\n" | 166 | "Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n" |
168 | " press the hotkey of the item you wish to select\n" | 167 | "with <Space>.\n" |
169 | " followed by the <SPACE BAR>.\n" | 168 | "For help related to the current entry press <?> or <h>.\n" |
170 | " Press <?>, <F1> or <h> for additional information about this option.\n"), | 169 | "For global help press <F1>.\n"), |
171 | inputbox_instructions_int[] = N_( | 170 | inputbox_instructions_int[] = N_( |
172 | "Please enter a decimal value.\n" | 171 | "Please enter a decimal value.\n" |
173 | "Fractions will not be accepted.\n" | 172 | "Fractions will not be accepted.\n" |
174 | "Press <RETURN> to accept, <ESC> to cancel."), | 173 | "Press <Enter> to apply, <Esc> to cancel."), |
175 | inputbox_instructions_hex[] = N_( | 174 | inputbox_instructions_hex[] = N_( |
176 | "Please enter a hexadecimal value.\n" | 175 | "Please enter a hexadecimal value.\n" |
177 | "Press <RETURN> to accept, <ESC> to cancel."), | 176 | "Press <Enter> to apply, <Esc> to cancel."), |
178 | inputbox_instructions_string[] = N_( | 177 | inputbox_instructions_string[] = N_( |
179 | "Please enter a string value.\n" | 178 | "Please enter a string value.\n" |
180 | "Press <RETURN> to accept, <ESC> to cancel."), | 179 | "Press <Enter> to apply, <Esc> to cancel."), |
181 | setmod_text[] = N_( | 180 | setmod_text[] = N_( |
182 | "This feature depends on another which\n" | 181 | "This feature depends on another feature which has been configured as a\n" |
183 | "has been configured as a module.\n" | 182 | "module. As a result, the current feature will be built as a module too."), |
184 | "As a result, this feature will be built as a module."), | ||
185 | load_config_text[] = N_( | 183 | load_config_text[] = N_( |
186 | "Enter the name of the configuration file you wish to load.\n" | 184 | "Enter the name of the configuration file you wish to load.\n" |
187 | "Accept the name shown to restore the configuration you\n" | 185 | "Accept the name shown to restore the configuration you last\n" |
188 | "last retrieved. Leave blank to abort."), | 186 | "retrieved. Leave empty to abort."), |
189 | load_config_help[] = N_( | 187 | load_config_help[] = N_( |
190 | "\n" | ||
191 | "For various reasons, one may wish to keep several different\n" | 188 | "For various reasons, one may wish to keep several different\n" |
192 | "configurations available on a single machine.\n" | 189 | "configurations available on a single machine.\n" |
193 | "\n" | 190 | "\n" |
194 | "If you have saved a previous configuration in a file other than the\n" | 191 | "If you have saved a previous configuration in a file other than the\n" |
195 | "default one, entering its name here will allow you to modify that\n" | 192 | "default one, entering its name here will allow you to load and modify\n" |
196 | "configuration.\n" | 193 | "that configuration.\n" |
197 | "\n" | 194 | "\n" |
198 | "If you are uncertain, then you have probably never used alternate\n" | 195 | "Leave empty to abort.\n"), |
199 | "configuration files. You should therefor leave this blank to abort.\n"), | ||
200 | save_config_text[] = N_( | 196 | save_config_text[] = N_( |
201 | "Enter a filename to which this configuration should be saved\n" | 197 | "Enter a filename to which this configuration should be saved\n" |
202 | "as an alternate. Leave blank to abort."), | 198 | "as an alternate. Leave empty to abort."), |
203 | save_config_help[] = N_( | 199 | save_config_help[] = N_( |
204 | "\n" | 200 | "For various reasons, one may wish to keep several different\n" |
205 | "For various reasons, one may wish to keep different configurations\n" | 201 | "configurations available on a single machine.\n" |
206 | "available on a single machine.\n" | ||
207 | "\n" | 202 | "\n" |
208 | "Entering a file name here will allow you to later retrieve, modify\n" | 203 | "Entering a file name here will allow you to later retrieve, modify\n" |
209 | "and use the current configuration as an alternate to whatever\n" | 204 | "and use the current configuration as an alternate to whatever\n" |
210 | "configuration options you have selected at that time.\n" | 205 | "configuration options you have selected at that time.\n" |
211 | "\n" | 206 | "\n" |
212 | "If you are uncertain what all this means then you should probably\n" | 207 | "Leave empty to abort.\n"), |
213 | "leave this blank.\n"), | ||
214 | search_help[] = N_( | 208 | search_help[] = N_( |
215 | "\n" | 209 | "Search for symbols (configuration variable names CONFIG_*) and display\n" |
216 | "Search for symbols and display their relations. Regular expressions\n" | 210 | "their relations. Regular expressions are supported.\n" |
217 | "are allowed.\n" | 211 | "Example: Search for \"^FOO\".\n" |
218 | "Example: search for \"^FOO\"\n" | ||
219 | "Result:\n" | 212 | "Result:\n" |
220 | "-----------------------------------------------------------------\n" | 213 | "-----------------------------------------------------------------\n" |
221 | "Symbol: FOO [ = m]\n" | 214 | "Symbol: FOO [ = m]\n" |
@@ -229,26 +222,26 @@ search_help[] = N_( | |||
229 | "Selects: LIBCRC32\n" | 222 | "Selects: LIBCRC32\n" |
230 | "Selected by: BAR\n" | 223 | "Selected by: BAR\n" |
231 | "-----------------------------------------------------------------\n" | 224 | "-----------------------------------------------------------------\n" |
232 | "o The line 'Prompt:' shows the text used in the menu structure for\n" | 225 | "o The line 'Prompt:' shows the text displayed for this symbol in\n" |
233 | " this symbol\n" | 226 | " the menu hierarchy.\n" |
234 | "o The 'Defined at' line tell at what file / line number the symbol\n" | 227 | "o The 'Defined at' line tells at what file / line number the symbol is\n" |
235 | " is defined\n" | 228 | " defined.\n" |
236 | "o The 'Depends on:' line tell what symbols needs to be defined for\n" | 229 | "o The 'Depends on:' line lists symbols that need to be defined for\n" |
237 | " this symbol to be visible in the menu (selectable)\n" | 230 | " this symbol to be visible and selectable in the menu.\n" |
238 | "o The 'Location:' lines tell where in the menu structure this symbol\n" | 231 | "o The 'Location:' lines tell, where in the menu structure this symbol\n" |
239 | " is located\n" | 232 | " is located. A location followed by a [ = y] indicates that this is\n" |
240 | " A location followed by a [ = y] indicate that this is a selectable\n" | 233 | " a selectable menu item, and the current value is displayed inside\n" |
241 | " menu item - and current value is displayed inside brackets.\n" | 234 | " brackets.\n" |
242 | "o The 'Selects:' line tell what symbol will be automatically\n" | 235 | "o The 'Selects:' line tells, what symbol will be automatically selected\n" |
243 | " selected if this symbol is selected (y or m)\n" | 236 | " if this symbol is selected (y or m).\n" |
244 | "o The 'Selected by' line tell what symbol has selected this symbol\n" | 237 | "o The 'Selected by' line tells what symbol has selected this symbol.\n" |
245 | "\n" | 238 | "\n" |
246 | "Only relevant lines are shown.\n" | 239 | "Only relevant lines are shown.\n" |
247 | "\n\n" | 240 | "\n\n" |
248 | "Search examples:\n" | 241 | "Search examples:\n" |
249 | "Examples: USB => find all symbols containing USB\n" | 242 | "USB => find all symbols containing USB\n" |
250 | " ^USB => find all symbols starting with USB\n" | 243 | "^USB => find all symbols starting with USB\n" |
251 | " USB$ => find all symbols ending with USB\n" | 244 | "USB$ => find all symbols ending with USB\n" |
252 | "\n"); | 245 | "\n"); |
253 | 246 | ||
254 | struct mitem { | 247 | struct mitem { |
@@ -319,19 +312,19 @@ struct function_keys function_keys[] = { | |||
319 | }, | 312 | }, |
320 | { | 313 | { |
321 | .key_str = "F2", | 314 | .key_str = "F2", |
322 | .func = "Sym Info", | 315 | .func = "SymInfo", |
323 | .key = F_SYMBOL, | 316 | .key = F_SYMBOL, |
324 | .handler = handle_f2, | 317 | .handler = handle_f2, |
325 | }, | 318 | }, |
326 | { | 319 | { |
327 | .key_str = "F3", | 320 | .key_str = "F3", |
328 | .func = "Insts", | 321 | .func = "Help 2", |
329 | .key = F_INSTS, | 322 | .key = F_INSTS, |
330 | .handler = handle_f3, | 323 | .handler = handle_f3, |
331 | }, | 324 | }, |
332 | { | 325 | { |
333 | .key_str = "F4", | 326 | .key_str = "F4", |
334 | .func = "Config", | 327 | .func = "ShowAll", |
335 | .key = F_CONF, | 328 | .key = F_CONF, |
336 | .handler = handle_f4, | 329 | .handler = handle_f4, |
337 | }, | 330 | }, |
@@ -355,7 +348,7 @@ struct function_keys function_keys[] = { | |||
355 | }, | 348 | }, |
356 | { | 349 | { |
357 | .key_str = "F8", | 350 | .key_str = "F8", |
358 | .func = "Sym Search", | 351 | .func = "SymSearch", |
359 | .key = F_SEARCH, | 352 | .key = F_SEARCH, |
360 | .handler = handle_f8, | 353 | .handler = handle_f8, |
361 | }, | 354 | }, |
@@ -392,7 +385,7 @@ static void print_function_line(void) | |||
392 | static void handle_f1(int *key, struct menu *current_item) | 385 | static void handle_f1(int *key, struct menu *current_item) |
393 | { | 386 | { |
394 | show_scroll_win(main_window, | 387 | show_scroll_win(main_window, |
395 | _("README"), _(nconf_readme)); | 388 | _("Global help"), _(nconf_global_help)); |
396 | return; | 389 | return; |
397 | } | 390 | } |
398 | 391 | ||
@@ -407,7 +400,7 @@ static void handle_f2(int *key, struct menu *current_item) | |||
407 | static void handle_f3(int *key, struct menu *current_item) | 400 | static void handle_f3(int *key, struct menu *current_item) |
408 | { | 401 | { |
409 | show_scroll_win(main_window, | 402 | show_scroll_win(main_window, |
410 | _("Instructions"), | 403 | _("Short help"), |
411 | _(current_instructions)); | 404 | _(current_instructions)); |
412 | return; | 405 | return; |
413 | } | 406 | } |
@@ -696,13 +689,18 @@ static void search_conf(void) | |||
696 | { | 689 | { |
697 | struct symbol **sym_arr; | 690 | struct symbol **sym_arr; |
698 | struct gstr res; | 691 | struct gstr res; |
692 | struct gstr title; | ||
699 | char *dialog_input; | 693 | char *dialog_input; |
700 | int dres; | 694 | int dres; |
695 | |||
696 | title = str_new(); | ||
697 | str_printf( &title, _("Enter %s (sub)string to search for " | ||
698 | "(with or without \"%s\")"), CONFIG_, CONFIG_); | ||
699 | |||
701 | again: | 700 | again: |
702 | dres = dialog_inputbox(main_window, | 701 | dres = dialog_inputbox(main_window, |
703 | _("Search Configuration Parameter"), | 702 | _("Search Configuration Parameter"), |
704 | _("Enter " CONFIG_ " (sub)string to search for " | 703 | str_get(&title), |
705 | "(with or without \"" CONFIG_ "\")"), | ||
706 | "", &dialog_input_result, &dialog_input_result_len); | 704 | "", &dialog_input_result, &dialog_input_result_len); |
707 | switch (dres) { | 705 | switch (dres) { |
708 | case 0: | 706 | case 0: |
@@ -712,6 +710,7 @@ again: | |||
712 | _("Search Configuration"), search_help); | 710 | _("Search Configuration"), search_help); |
713 | goto again; | 711 | goto again; |
714 | default: | 712 | default: |
713 | str_free(&title); | ||
715 | return; | 714 | return; |
716 | } | 715 | } |
717 | 716 | ||
@@ -726,6 +725,7 @@ again: | |||
726 | show_scroll_win(main_window, | 725 | show_scroll_win(main_window, |
727 | _("Search Results"), str_get(&res)); | 726 | _("Search Results"), str_get(&res)); |
728 | str_free(&res); | 727 | str_free(&res); |
728 | str_free(&title); | ||
729 | } | 729 | } |
730 | 730 | ||
731 | 731 | ||
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c index 379003c7a2b4..9f8c44ecc703 100644 --- a/scripts/kconfig/nconf.gui.c +++ b/scripts/kconfig/nconf.gui.c | |||
@@ -48,7 +48,7 @@ static void set_normal_colors(void) | |||
48 | init_pair(INPUT_FIELD, -1, -1); | 48 | init_pair(INPUT_FIELD, -1, -1); |
49 | 49 | ||
50 | init_pair(FUNCTION_HIGHLIGHT, -1, -1); | 50 | init_pair(FUNCTION_HIGHLIGHT, -1, -1); |
51 | init_pair(FUNCTION_TEXT, COLOR_BLUE, -1); | 51 | init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1); |
52 | } | 52 | } |
53 | 53 | ||
54 | /* available attributes: | 54 | /* available attributes: |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index df274febb3e5..1500c38f0cca 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <qglobal.h> | 6 | #include <qglobal.h> |
7 | 7 | ||
8 | #if QT_VERSION < 0x040000 | 8 | #if QT_VERSION < 0x040000 |
9 | #include <stddef.h> | ||
9 | #include <qmainwindow.h> | 10 | #include <qmainwindow.h> |
10 | #include <qvbox.h> | 11 | #include <qvbox.h> |
11 | #include <qvaluelist.h> | 12 | #include <qvaluelist.h> |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 22a3c400fc41..ecc5aa5f865d 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -656,11 +656,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval) | |||
656 | size = strlen(newval) + 1; | 656 | size = strlen(newval) + 1; |
657 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { | 657 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { |
658 | size += 2; | 658 | size += 2; |
659 | sym->def[S_DEF_USER].val = val = malloc(size); | 659 | sym->def[S_DEF_USER].val = val = xmalloc(size); |
660 | *val++ = '0'; | 660 | *val++ = '0'; |
661 | *val++ = 'x'; | 661 | *val++ = 'x'; |
662 | } else if (!oldval || strcmp(oldval, newval)) | 662 | } else if (!oldval || strcmp(oldval, newval)) |
663 | sym->def[S_DEF_USER].val = val = malloc(size); | 663 | sym->def[S_DEF_USER].val = val = xmalloc(size); |
664 | else | 664 | else |
665 | return true; | 665 | return true; |
666 | 666 | ||
@@ -812,7 +812,7 @@ struct symbol *sym_lookup(const char *name, int flags) | |||
812 | hash = 0; | 812 | hash = 0; |
813 | } | 813 | } |
814 | 814 | ||
815 | symbol = malloc(sizeof(*symbol)); | 815 | symbol = xmalloc(sizeof(*symbol)); |
816 | memset(symbol, 0, sizeof(*symbol)); | 816 | memset(symbol, 0, sizeof(*symbol)); |
817 | symbol->name = new_name; | 817 | symbol->name = new_name; |
818 | symbol->type = S_UNKNOWN; | 818 | symbol->type = S_UNKNOWN; |
@@ -863,7 +863,7 @@ const char *sym_expand_string_value(const char *in) | |||
863 | size_t reslen; | 863 | size_t reslen; |
864 | 864 | ||
865 | reslen = strlen(in) + 1; | 865 | reslen = strlen(in) + 1; |
866 | res = malloc(reslen); | 866 | res = xmalloc(reslen); |
867 | res[0] = '\0'; | 867 | res[0] = '\0'; |
868 | 868 | ||
869 | while ((src = strchr(in, '$'))) { | 869 | while ((src = strchr(in, '$'))) { |
@@ -921,7 +921,7 @@ const char *sym_escape_string_value(const char *in) | |||
921 | p++; | 921 | p++; |
922 | } | 922 | } |
923 | 923 | ||
924 | res = malloc(reslen); | 924 | res = xmalloc(reslen); |
925 | res[0] = '\0'; | 925 | res[0] = '\0'; |
926 | 926 | ||
927 | strcat(res, "\""); | 927 | strcat(res, "\""); |
@@ -1228,7 +1228,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym) | |||
1228 | struct property *prop; | 1228 | struct property *prop; |
1229 | struct property **propp; | 1229 | struct property **propp; |
1230 | 1230 | ||
1231 | prop = malloc(sizeof(*prop)); | 1231 | prop = xmalloc(sizeof(*prop)); |
1232 | memset(prop, 0, sizeof(*prop)); | 1232 | memset(prop, 0, sizeof(*prop)); |
1233 | prop->type = type; | 1233 | prop->type = type; |
1234 | prop->sym = sym; | 1234 | prop->sym = sym; |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index d0b8b2318e48..6e7fbf196809 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -23,7 +23,7 @@ struct file *file_lookup(const char *name) | |||
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | file = malloc(sizeof(*file)); | 26 | file = xmalloc(sizeof(*file)); |
27 | memset(file, 0, sizeof(*file)); | 27 | memset(file, 0, sizeof(*file)); |
28 | file->name = file_name; | 28 | file->name = file_name; |
29 | file->next = file_list; | 29 | file->next = file_list; |
@@ -81,7 +81,7 @@ int file_write_dep(const char *name) | |||
81 | struct gstr str_new(void) | 81 | struct gstr str_new(void) |
82 | { | 82 | { |
83 | struct gstr gs; | 83 | struct gstr gs; |
84 | gs.s = malloc(sizeof(char) * 64); | 84 | gs.s = xmalloc(sizeof(char) * 64); |
85 | gs.len = 64; | 85 | gs.len = 64; |
86 | gs.max_width = 0; | 86 | gs.max_width = 0; |
87 | strcpy(gs.s, "\0"); | 87 | strcpy(gs.s, "\0"); |
@@ -138,3 +138,22 @@ const char *str_get(struct gstr *gs) | |||
138 | return gs->s; | 138 | return gs->s; |
139 | } | 139 | } |
140 | 140 | ||
141 | void *xmalloc(size_t size) | ||
142 | { | ||
143 | void *p = malloc(size); | ||
144 | if (p) | ||
145 | return p; | ||
146 | fprintf(stderr, "Out of memory.\n"); | ||
147 | exit(1); | ||
148 | } | ||
149 | |||
150 | void *xcalloc(size_t nmemb, size_t size) | ||
151 | { | ||
152 | void *p = calloc(nmemb, size); | ||
153 | if (p) | ||
154 | return p; | ||
155 | fprintf(stderr, "Out of memory.\n"); | ||
156 | exit(1); | ||
157 | } | ||
158 | |||
159 | |||
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 00f9d3a9cf8b..6555a475453b 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -40,7 +40,7 @@ static void zconf_endfile(void); | |||
40 | 40 | ||
41 | static void new_string(void) | 41 | static void new_string(void) |
42 | { | 42 | { |
43 | text = malloc(START_STRSIZE); | 43 | text = xmalloc(START_STRSIZE); |
44 | text_asize = START_STRSIZE; | 44 | text_asize = START_STRSIZE; |
45 | text_size = 0; | 45 | text_size = 0; |
46 | *text = 0; | 46 | *text = 0; |
@@ -62,7 +62,7 @@ static void append_string(const char *str, int size) | |||
62 | 62 | ||
63 | static void alloc_string(const char *str, int size) | 63 | static void alloc_string(const char *str, int size) |
64 | { | 64 | { |
65 | text = malloc(size + 1); | 65 | text = xmalloc(size + 1); |
66 | memcpy(text, str, size); | 66 | memcpy(text, str, size); |
67 | text[size] = 0; | 67 | text[size] = 0; |
68 | } | 68 | } |
@@ -288,7 +288,7 @@ void zconf_initscan(const char *name) | |||
288 | exit(1); | 288 | exit(1); |
289 | } | 289 | } |
290 | 290 | ||
291 | current_buf = malloc(sizeof(*current_buf)); | 291 | current_buf = xmalloc(sizeof(*current_buf)); |
292 | memset(current_buf, 0, sizeof(*current_buf)); | 292 | memset(current_buf, 0, sizeof(*current_buf)); |
293 | 293 | ||
294 | current_file = file_lookup(name); | 294 | current_file = file_lookup(name); |
@@ -299,7 +299,7 @@ void zconf_nextfile(const char *name) | |||
299 | { | 299 | { |
300 | struct file *iter; | 300 | struct file *iter; |
301 | struct file *file = file_lookup(name); | 301 | struct file *file = file_lookup(name); |
302 | struct buffer *buf = malloc(sizeof(*buf)); | 302 | struct buffer *buf = xmalloc(sizeof(*buf)); |
303 | memset(buf, 0, sizeof(*buf)); | 303 | memset(buf, 0, sizeof(*buf)); |
304 | 304 | ||
305 | current_buf->state = YY_CURRENT_BUFFER; | 305 | current_buf->state = YY_CURRENT_BUFFER; |
diff --git a/scripts/kconfig/zconf.lex.c_shipped b/scripts/kconfig/zconf.lex.c_shipped index c32b1a49f5a3..a0521aa5974b 100644 --- a/scripts/kconfig/zconf.lex.c_shipped +++ b/scripts/kconfig/zconf.lex.c_shipped | |||
@@ -802,7 +802,7 @@ static void zconf_endfile(void); | |||
802 | 802 | ||
803 | static void new_string(void) | 803 | static void new_string(void) |
804 | { | 804 | { |
805 | text = malloc(START_STRSIZE); | 805 | text = xmalloc(START_STRSIZE); |
806 | text_asize = START_STRSIZE; | 806 | text_asize = START_STRSIZE; |
807 | text_size = 0; | 807 | text_size = 0; |
808 | *text = 0; | 808 | *text = 0; |
@@ -824,7 +824,7 @@ static void append_string(const char *str, int size) | |||
824 | 824 | ||
825 | static void alloc_string(const char *str, int size) | 825 | static void alloc_string(const char *str, int size) |
826 | { | 826 | { |
827 | text = malloc(size + 1); | 827 | text = xmalloc(size + 1); |
828 | memcpy(text, str, size); | 828 | memcpy(text, str, size); |
829 | text[size] = 0; | 829 | text[size] = 0; |
830 | } | 830 | } |
@@ -2343,7 +2343,7 @@ void zconf_initscan(const char *name) | |||
2343 | exit(1); | 2343 | exit(1); |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | current_buf = malloc(sizeof(*current_buf)); | 2346 | current_buf = xmalloc(sizeof(*current_buf)); |
2347 | memset(current_buf, 0, sizeof(*current_buf)); | 2347 | memset(current_buf, 0, sizeof(*current_buf)); |
2348 | 2348 | ||
2349 | current_file = file_lookup(name); | 2349 | current_file = file_lookup(name); |
@@ -2354,7 +2354,7 @@ void zconf_nextfile(const char *name) | |||
2354 | { | 2354 | { |
2355 | struct file *iter; | 2355 | struct file *iter; |
2356 | struct file *file = file_lookup(name); | 2356 | struct file *file = file_lookup(name); |
2357 | struct buffer *buf = malloc(sizeof(*buf)); | 2357 | struct buffer *buf = xmalloc(sizeof(*buf)); |
2358 | memset(buf, 0, sizeof(*buf)); | 2358 | memset(buf, 0, sizeof(*buf)); |
2359 | 2359 | ||
2360 | current_buf->state = YY_CURRENT_BUFFER; | 2360 | current_buf->state = YY_CURRENT_BUFFER; |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index b3d907eb93a9..3d569d6022c2 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -132,7 +132,14 @@ if [ "$1" = "clean" ]; then | |||
132 | fi | 132 | fi |
133 | 133 | ||
134 | # We need access to CONFIG_ symbols | 134 | # We need access to CONFIG_ symbols |
135 | . ./.config | 135 | case "${KCONFIG_CONFIG}" in |
136 | */*) | ||
137 | . "${KCONFIG_CONFIG}" | ||
138 | ;; | ||
139 | *) | ||
140 | # Force using a file from the current directory | ||
141 | . "./${KCONFIG_CONFIG}" | ||
142 | esac | ||
136 | 143 | ||
137 | #link vmlinux.o | 144 | #link vmlinux.o |
138 | info LD vmlinux.o | 145 | info LD vmlinux.o |
diff --git a/scripts/mod/.gitignore b/scripts/mod/.gitignore index e9b7abe7b95b..33bae0df4de5 100644 --- a/scripts/mod/.gitignore +++ b/scripts/mod/.gitignore | |||
@@ -1,4 +1,5 @@ | |||
1 | elfconfig.h | 1 | elfconfig.h |
2 | mk_elfconfig | 2 | mk_elfconfig |
3 | modpost | 3 | modpost |
4 | devicetable-offsets.h | ||
4 | 5 | ||
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index ff954f8168c1..9415b5663364 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile | |||
@@ -3,9 +3,44 @@ always := $(hostprogs-y) empty.o | |||
3 | 3 | ||
4 | modpost-objs := modpost.o file2alias.o sumversion.o | 4 | modpost-objs := modpost.o file2alias.o sumversion.o |
5 | 5 | ||
6 | devicetable-offsets-file := devicetable-offsets.h | ||
7 | |||
8 | define sed-y | ||
9 | "/^->/{s:->#\(.*\):/* \1 */:; \ | ||
10 | s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
11 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
12 | s:->::; p;}" | ||
13 | endef | ||
14 | |||
15 | quiet_cmd_offsets = GEN $@ | ||
16 | define cmd_offsets | ||
17 | (set -e; \ | ||
18 | echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; \ | ||
19 | echo "#define __DEVICEVTABLE_OFFSETS_H__"; \ | ||
20 | echo "/*"; \ | ||
21 | echo " * DO NOT MODIFY."; \ | ||
22 | echo " *"; \ | ||
23 | echo " * This file was generated by Kbuild"; \ | ||
24 | echo " *"; \ | ||
25 | echo " */"; \ | ||
26 | echo ""; \ | ||
27 | sed -ne $(sed-y) $<; \ | ||
28 | echo ""; \ | ||
29 | echo "#endif" ) > $@ | ||
30 | endef | ||
31 | |||
32 | # We use internal kbuild rules to avoid the "is up to date" message from make | ||
33 | scripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE | ||
34 | $(Q)mkdir -p $(dir $@) | ||
35 | $(call if_changed_dep,cc_s_c) | ||
36 | |||
37 | $(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s | ||
38 | $(call cmd,offsets) | ||
39 | |||
6 | # dependencies on generated files need to be listed explicitly | 40 | # dependencies on generated files need to be listed explicitly |
7 | 41 | ||
8 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h | 42 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h |
43 | $(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file) | ||
9 | 44 | ||
10 | quiet_cmd_elfconfig = MKELF $@ | 45 | quiet_cmd_elfconfig = MKELF $@ |
11 | cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ | 46 | cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ |
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c new file mode 100644 index 000000000000..b45260bfeaa0 --- /dev/null +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -0,0 +1,178 @@ | |||
1 | #include <linux/kbuild.h> | ||
2 | #include <linux/mod_devicetable.h> | ||
3 | |||
4 | #define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid)) | ||
5 | #define DEVID_FIELD(devid, field) \ | ||
6 | DEFINE(OFF_##devid##_##field, offsetof(struct devid, field)) | ||
7 | |||
8 | int main(void) | ||
9 | { | ||
10 | DEVID(usb_device_id); | ||
11 | DEVID_FIELD(usb_device_id, match_flags); | ||
12 | DEVID_FIELD(usb_device_id, idVendor); | ||
13 | DEVID_FIELD(usb_device_id, idProduct); | ||
14 | DEVID_FIELD(usb_device_id, bcdDevice_lo); | ||
15 | DEVID_FIELD(usb_device_id, bcdDevice_hi); | ||
16 | DEVID_FIELD(usb_device_id, bDeviceClass); | ||
17 | DEVID_FIELD(usb_device_id, bDeviceSubClass); | ||
18 | DEVID_FIELD(usb_device_id, bDeviceProtocol); | ||
19 | DEVID_FIELD(usb_device_id, bInterfaceClass); | ||
20 | DEVID_FIELD(usb_device_id, bInterfaceSubClass); | ||
21 | DEVID_FIELD(usb_device_id, bInterfaceProtocol); | ||
22 | DEVID_FIELD(usb_device_id, bInterfaceNumber); | ||
23 | |||
24 | DEVID(hid_device_id); | ||
25 | DEVID_FIELD(hid_device_id, bus); | ||
26 | DEVID_FIELD(hid_device_id, group); | ||
27 | DEVID_FIELD(hid_device_id, vendor); | ||
28 | DEVID_FIELD(hid_device_id, product); | ||
29 | |||
30 | DEVID(ieee1394_device_id); | ||
31 | DEVID_FIELD(ieee1394_device_id, match_flags); | ||
32 | DEVID_FIELD(ieee1394_device_id, vendor_id); | ||
33 | DEVID_FIELD(ieee1394_device_id, model_id); | ||
34 | DEVID_FIELD(ieee1394_device_id, specifier_id); | ||
35 | DEVID_FIELD(ieee1394_device_id, version); | ||
36 | |||
37 | DEVID(pci_device_id); | ||
38 | DEVID_FIELD(pci_device_id, vendor); | ||
39 | DEVID_FIELD(pci_device_id, device); | ||
40 | DEVID_FIELD(pci_device_id, subvendor); | ||
41 | DEVID_FIELD(pci_device_id, subdevice); | ||
42 | DEVID_FIELD(pci_device_id, class); | ||
43 | DEVID_FIELD(pci_device_id, class_mask); | ||
44 | |||
45 | DEVID(ccw_device_id); | ||
46 | DEVID_FIELD(ccw_device_id, match_flags); | ||
47 | DEVID_FIELD(ccw_device_id, cu_type); | ||
48 | DEVID_FIELD(ccw_device_id, cu_model); | ||
49 | DEVID_FIELD(ccw_device_id, dev_type); | ||
50 | DEVID_FIELD(ccw_device_id, dev_model); | ||
51 | |||
52 | DEVID(ap_device_id); | ||
53 | DEVID_FIELD(ap_device_id, dev_type); | ||
54 | |||
55 | DEVID(css_device_id); | ||
56 | DEVID_FIELD(css_device_id, type); | ||
57 | |||
58 | DEVID(serio_device_id); | ||
59 | DEVID_FIELD(serio_device_id, type); | ||
60 | DEVID_FIELD(serio_device_id, proto); | ||
61 | DEVID_FIELD(serio_device_id, id); | ||
62 | DEVID_FIELD(serio_device_id, extra); | ||
63 | |||
64 | DEVID(acpi_device_id); | ||
65 | DEVID_FIELD(acpi_device_id, id); | ||
66 | |||
67 | DEVID(pnp_device_id); | ||
68 | DEVID_FIELD(pnp_device_id, id); | ||
69 | |||
70 | DEVID(pnp_card_device_id); | ||
71 | DEVID_FIELD(pnp_card_device_id, devs); | ||
72 | |||
73 | DEVID(pcmcia_device_id); | ||
74 | DEVID_FIELD(pcmcia_device_id, match_flags); | ||
75 | DEVID_FIELD(pcmcia_device_id, manf_id); | ||
76 | DEVID_FIELD(pcmcia_device_id, card_id); | ||
77 | DEVID_FIELD(pcmcia_device_id, func_id); | ||
78 | DEVID_FIELD(pcmcia_device_id, function); | ||
79 | DEVID_FIELD(pcmcia_device_id, device_no); | ||
80 | DEVID_FIELD(pcmcia_device_id, prod_id_hash); | ||
81 | |||
82 | DEVID(of_device_id); | ||
83 | DEVID_FIELD(of_device_id, name); | ||
84 | DEVID_FIELD(of_device_id, type); | ||
85 | DEVID_FIELD(of_device_id, compatible); | ||
86 | |||
87 | DEVID(vio_device_id); | ||
88 | DEVID_FIELD(vio_device_id, type); | ||
89 | DEVID_FIELD(vio_device_id, compat); | ||
90 | |||
91 | DEVID(input_device_id); | ||
92 | DEVID_FIELD(input_device_id, flags); | ||
93 | DEVID_FIELD(input_device_id, bustype); | ||
94 | DEVID_FIELD(input_device_id, vendor); | ||
95 | DEVID_FIELD(input_device_id, product); | ||
96 | DEVID_FIELD(input_device_id, version); | ||
97 | DEVID_FIELD(input_device_id, evbit); | ||
98 | DEVID_FIELD(input_device_id, keybit); | ||
99 | DEVID_FIELD(input_device_id, relbit); | ||
100 | DEVID_FIELD(input_device_id, absbit); | ||
101 | DEVID_FIELD(input_device_id, mscbit); | ||
102 | DEVID_FIELD(input_device_id, ledbit); | ||
103 | DEVID_FIELD(input_device_id, sndbit); | ||
104 | DEVID_FIELD(input_device_id, ffbit); | ||
105 | DEVID_FIELD(input_device_id, swbit); | ||
106 | |||
107 | DEVID(eisa_device_id); | ||
108 | DEVID_FIELD(eisa_device_id, sig); | ||
109 | |||
110 | DEVID(parisc_device_id); | ||
111 | DEVID_FIELD(parisc_device_id, hw_type); | ||
112 | DEVID_FIELD(parisc_device_id, hversion); | ||
113 | DEVID_FIELD(parisc_device_id, hversion_rev); | ||
114 | DEVID_FIELD(parisc_device_id, sversion); | ||
115 | |||
116 | DEVID(sdio_device_id); | ||
117 | DEVID_FIELD(sdio_device_id, class); | ||
118 | DEVID_FIELD(sdio_device_id, vendor); | ||
119 | DEVID_FIELD(sdio_device_id, device); | ||
120 | |||
121 | DEVID(ssb_device_id); | ||
122 | DEVID_FIELD(ssb_device_id, vendor); | ||
123 | DEVID_FIELD(ssb_device_id, coreid); | ||
124 | DEVID_FIELD(ssb_device_id, revision); | ||
125 | |||
126 | DEVID(bcma_device_id); | ||
127 | DEVID_FIELD(bcma_device_id, manuf); | ||
128 | DEVID_FIELD(bcma_device_id, id); | ||
129 | DEVID_FIELD(bcma_device_id, rev); | ||
130 | DEVID_FIELD(bcma_device_id, class); | ||
131 | |||
132 | DEVID(virtio_device_id); | ||
133 | DEVID_FIELD(virtio_device_id, device); | ||
134 | DEVID_FIELD(virtio_device_id, vendor); | ||
135 | |||
136 | DEVID(hv_vmbus_device_id); | ||
137 | DEVID_FIELD(hv_vmbus_device_id, guid); | ||
138 | |||
139 | DEVID(i2c_device_id); | ||
140 | DEVID_FIELD(i2c_device_id, name); | ||
141 | |||
142 | DEVID(spi_device_id); | ||
143 | DEVID_FIELD(spi_device_id, name); | ||
144 | |||
145 | DEVID(dmi_system_id); | ||
146 | DEVID_FIELD(dmi_system_id, matches); | ||
147 | |||
148 | DEVID(platform_device_id); | ||
149 | DEVID_FIELD(platform_device_id, name); | ||
150 | |||
151 | DEVID(mdio_device_id); | ||
152 | DEVID_FIELD(mdio_device_id, phy_id); | ||
153 | DEVID_FIELD(mdio_device_id, phy_id_mask); | ||
154 | |||
155 | DEVID(zorro_device_id); | ||
156 | DEVID_FIELD(zorro_device_id, id); | ||
157 | |||
158 | DEVID(isapnp_device_id); | ||
159 | DEVID_FIELD(isapnp_device_id, vendor); | ||
160 | DEVID_FIELD(isapnp_device_id, function); | ||
161 | |||
162 | DEVID(ipack_device_id); | ||
163 | DEVID_FIELD(ipack_device_id, format); | ||
164 | DEVID_FIELD(ipack_device_id, vendor); | ||
165 | DEVID_FIELD(ipack_device_id, device); | ||
166 | |||
167 | DEVID(amba_id); | ||
168 | DEVID_FIELD(amba_id, id); | ||
169 | DEVID_FIELD(amba_id, mask); | ||
170 | |||
171 | DEVID(x86_cpu_id); | ||
172 | DEVID_FIELD(x86_cpu_id, feature); | ||
173 | DEVID_FIELD(x86_cpu_id, family); | ||
174 | DEVID_FIELD(x86_cpu_id, model); | ||
175 | DEVID_FIELD(x86_cpu_id, vendor); | ||
176 | |||
177 | return 0; | ||
178 | } | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index df4fc23dd836..771ac17f635d 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "modpost.h" | 13 | #include "modpost.h" |
14 | #include "devicetable-offsets.h" | ||
14 | 15 | ||
15 | /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and | 16 | /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and |
16 | * use either stdint.h or inttypes.h for the rest. */ | 17 | * use either stdint.h or inttypes.h for the rest. */ |
@@ -84,13 +85,25 @@ extern struct devtable *__start___devtable[], *__stop___devtable[]; | |||
84 | # define __used __attribute__((__used__)) | 85 | # define __used __attribute__((__used__)) |
85 | #endif | 86 | #endif |
86 | 87 | ||
88 | /* Define a variable f that holds the value of field f of struct devid | ||
89 | * based at address m. | ||
90 | */ | ||
91 | #define DEF_FIELD(m, devid, f) \ | ||
92 | typeof(((struct devid *)0)->f) f = TO_NATIVE(*(typeof(f) *)((m) + OFF_##devid##_##f)) | ||
93 | /* Define a variable f that holds the address of field f of struct devid | ||
94 | * based at address m. Due to the way typeof works, for a field of type | ||
95 | * T[N] the variable has type T(*)[N], _not_ T*. | ||
96 | */ | ||
97 | #define DEF_FIELD_ADDR(m, devid, f) \ | ||
98 | typeof(((struct devid *)0)->f) *f = ((m) + OFF_##devid##_##f) | ||
99 | |||
87 | /* Add a table entry. We test function type matches while we're here. */ | 100 | /* Add a table entry. We test function type matches while we're here. */ |
88 | #define ADD_TO_DEVTABLE(device_id, type, function) \ | 101 | #define ADD_TO_DEVTABLE(device_id, type, function) \ |
89 | static struct devtable __cat(devtable,__LINE__) = { \ | 102 | static struct devtable __cat(devtable,__LINE__) = { \ |
90 | device_id + 0*sizeof((function)((const char *)NULL, \ | 103 | device_id + 0*sizeof((function)((const char *)NULL, \ |
91 | (type *)NULL, \ | 104 | (void *)NULL, \ |
92 | (char *)NULL)), \ | 105 | (char *)NULL)), \ |
93 | sizeof(type), (function) }; \ | 106 | SIZE_##type, (function) }; \ |
94 | static struct devtable *SECTION(__devtable) __used \ | 107 | static struct devtable *SECTION(__devtable) __used \ |
95 | __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) | 108 | __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) |
96 | 109 | ||
@@ -116,7 +129,6 @@ static inline void add_wildcard(char *str) | |||
116 | strcat(str + len, "*"); | 129 | strcat(str + len, "*"); |
117 | } | 130 | } |
118 | 131 | ||
119 | unsigned int cross_build = 0; | ||
120 | /** | 132 | /** |
121 | * Check that sizeof(device_id type) are consistent with size of section | 133 | * Check that sizeof(device_id type) are consistent with size of section |
122 | * in .o file. If in-consistent then userspace and kernel does not agree | 134 | * in .o file. If in-consistent then userspace and kernel does not agree |
@@ -131,8 +143,6 @@ static void device_id_check(const char *modname, const char *device_id, | |||
131 | int i; | 143 | int i; |
132 | 144 | ||
133 | if (size % id_size || size < id_size) { | 145 | if (size % id_size || size < id_size) { |
134 | if (cross_build != 0) | ||
135 | return; | ||
136 | fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " | 146 | fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " |
137 | "of the size of section __mod_%s_device_table=%lu.\n" | 147 | "of the size of section __mod_%s_device_table=%lu.\n" |
138 | "Fix definition of struct %s_device_id " | 148 | "Fix definition of struct %s_device_id " |
@@ -157,17 +167,29 @@ static void device_id_check(const char *modname, const char *device_id, | |||
157 | 167 | ||
158 | /* USB is special because the bcdDevice can be matched against a numeric range */ | 168 | /* USB is special because the bcdDevice can be matched against a numeric range */ |
159 | /* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipNinN" */ | 169 | /* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipNinN" */ |
160 | static void do_usb_entry(struct usb_device_id *id, | 170 | static void do_usb_entry(void *symval, |
161 | unsigned int bcdDevice_initial, int bcdDevice_initial_digits, | 171 | unsigned int bcdDevice_initial, int bcdDevice_initial_digits, |
162 | unsigned char range_lo, unsigned char range_hi, | 172 | unsigned char range_lo, unsigned char range_hi, |
163 | unsigned char max, struct module *mod) | 173 | unsigned char max, struct module *mod) |
164 | { | 174 | { |
165 | char alias[500]; | 175 | char alias[500]; |
176 | DEF_FIELD(symval, usb_device_id, match_flags); | ||
177 | DEF_FIELD(symval, usb_device_id, idVendor); | ||
178 | DEF_FIELD(symval, usb_device_id, idProduct); | ||
179 | DEF_FIELD(symval, usb_device_id, bcdDevice_lo); | ||
180 | DEF_FIELD(symval, usb_device_id, bDeviceClass); | ||
181 | DEF_FIELD(symval, usb_device_id, bDeviceSubClass); | ||
182 | DEF_FIELD(symval, usb_device_id, bDeviceProtocol); | ||
183 | DEF_FIELD(symval, usb_device_id, bInterfaceClass); | ||
184 | DEF_FIELD(symval, usb_device_id, bInterfaceSubClass); | ||
185 | DEF_FIELD(symval, usb_device_id, bInterfaceProtocol); | ||
186 | DEF_FIELD(symval, usb_device_id, bInterfaceNumber); | ||
187 | |||
166 | strcpy(alias, "usb:"); | 188 | strcpy(alias, "usb:"); |
167 | ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR, | 189 | ADD(alias, "v", match_flags&USB_DEVICE_ID_MATCH_VENDOR, |
168 | id->idVendor); | 190 | idVendor); |
169 | ADD(alias, "p", id->match_flags&USB_DEVICE_ID_MATCH_PRODUCT, | 191 | ADD(alias, "p", match_flags&USB_DEVICE_ID_MATCH_PRODUCT, |
170 | id->idProduct); | 192 | idProduct); |
171 | 193 | ||
172 | strcat(alias, "d"); | 194 | strcat(alias, "d"); |
173 | if (bcdDevice_initial_digits) | 195 | if (bcdDevice_initial_digits) |
@@ -190,29 +212,23 @@ static void do_usb_entry(struct usb_device_id *id, | |||
190 | range_lo); | 212 | range_lo); |
191 | } | 213 | } |
192 | } | 214 | } |
193 | if (bcdDevice_initial_digits < (sizeof(id->bcdDevice_lo) * 2 - 1)) | 215 | if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1)) |
194 | strcat(alias, "*"); | 216 | strcat(alias, "*"); |
195 | 217 | ||
196 | ADD(alias, "dc", id->match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS, | 218 | ADD(alias, "dc", match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS, |
197 | id->bDeviceClass); | 219 | bDeviceClass); |
198 | ADD(alias, "dsc", | 220 | ADD(alias, "dsc", match_flags&USB_DEVICE_ID_MATCH_DEV_SUBCLASS, |
199 | id->match_flags&USB_DEVICE_ID_MATCH_DEV_SUBCLASS, | 221 | bDeviceSubClass); |
200 | id->bDeviceSubClass); | 222 | ADD(alias, "dp", match_flags&USB_DEVICE_ID_MATCH_DEV_PROTOCOL, |
201 | ADD(alias, "dp", | 223 | bDeviceProtocol); |
202 | id->match_flags&USB_DEVICE_ID_MATCH_DEV_PROTOCOL, | 224 | ADD(alias, "ic", match_flags&USB_DEVICE_ID_MATCH_INT_CLASS, |
203 | id->bDeviceProtocol); | 225 | bInterfaceClass); |
204 | ADD(alias, "ic", | 226 | ADD(alias, "isc", match_flags&USB_DEVICE_ID_MATCH_INT_SUBCLASS, |
205 | id->match_flags&USB_DEVICE_ID_MATCH_INT_CLASS, | 227 | bInterfaceSubClass); |
206 | id->bInterfaceClass); | 228 | ADD(alias, "ip", match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, |
207 | ADD(alias, "isc", | 229 | bInterfaceProtocol); |
208 | id->match_flags&USB_DEVICE_ID_MATCH_INT_SUBCLASS, | 230 | ADD(alias, "in", match_flags&USB_DEVICE_ID_MATCH_INT_NUMBER, |
209 | id->bInterfaceSubClass); | 231 | bInterfaceNumber); |
210 | ADD(alias, "ip", | ||
211 | id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, | ||
212 | id->bInterfaceProtocol); | ||
213 | ADD(alias, "in", | ||
214 | id->match_flags&USB_DEVICE_ID_MATCH_INT_NUMBER, | ||
215 | id->bInterfaceNumber); | ||
216 | 232 | ||
217 | add_wildcard(alias); | 233 | add_wildcard(alias); |
218 | buf_printf(&mod->dev_table_buf, | 234 | buf_printf(&mod->dev_table_buf, |
@@ -258,24 +274,28 @@ static unsigned int incbcd(unsigned int *bcd, | |||
258 | return init; | 274 | return init; |
259 | } | 275 | } |
260 | 276 | ||
261 | static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod) | 277 | static void do_usb_entry_multi(void *symval, struct module *mod) |
262 | { | 278 | { |
263 | unsigned int devlo, devhi; | 279 | unsigned int devlo, devhi; |
264 | unsigned char chi, clo, max; | 280 | unsigned char chi, clo, max; |
265 | int ndigits; | 281 | int ndigits; |
266 | 282 | ||
267 | id->match_flags = TO_NATIVE(id->match_flags); | 283 | DEF_FIELD(symval, usb_device_id, match_flags); |
268 | id->idVendor = TO_NATIVE(id->idVendor); | 284 | DEF_FIELD(symval, usb_device_id, idVendor); |
269 | id->idProduct = TO_NATIVE(id->idProduct); | 285 | DEF_FIELD(symval, usb_device_id, idProduct); |
286 | DEF_FIELD(symval, usb_device_id, bcdDevice_lo); | ||
287 | DEF_FIELD(symval, usb_device_id, bcdDevice_hi); | ||
288 | DEF_FIELD(symval, usb_device_id, bDeviceClass); | ||
289 | DEF_FIELD(symval, usb_device_id, bInterfaceClass); | ||
270 | 290 | ||
271 | devlo = id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO ? | 291 | devlo = match_flags & USB_DEVICE_ID_MATCH_DEV_LO ? |
272 | TO_NATIVE(id->bcdDevice_lo) : 0x0U; | 292 | bcdDevice_lo : 0x0U; |
273 | devhi = id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI ? | 293 | devhi = match_flags & USB_DEVICE_ID_MATCH_DEV_HI ? |
274 | TO_NATIVE(id->bcdDevice_hi) : ~0x0U; | 294 | bcdDevice_hi : ~0x0U; |
275 | 295 | ||
276 | /* Figure out if this entry is in bcd or hex format */ | 296 | /* Figure out if this entry is in bcd or hex format */ |
277 | max = 0x9; /* Default to decimal format */ | 297 | max = 0x9; /* Default to decimal format */ |
278 | for (ndigits = 0 ; ndigits < sizeof(id->bcdDevice_lo) * 2 ; ndigits++) { | 298 | for (ndigits = 0 ; ndigits < sizeof(bcdDevice_lo) * 2 ; ndigits++) { |
279 | clo = (devlo >> (ndigits << 2)) & 0xf; | 299 | clo = (devlo >> (ndigits << 2)) & 0xf; |
280 | chi = ((devhi > 0x9999 ? 0x9999 : devhi) >> (ndigits << 2)) & 0xf; | 300 | chi = ((devhi > 0x9999 ? 0x9999 : devhi) >> (ndigits << 2)) & 0xf; |
281 | if (clo > max || chi > max) { | 301 | if (clo > max || chi > max) { |
@@ -288,11 +308,11 @@ static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod) | |||
288 | * Some modules (visor) have empty slots as placeholder for | 308 | * Some modules (visor) have empty slots as placeholder for |
289 | * run-time specification that results in catch-all alias | 309 | * run-time specification that results in catch-all alias |
290 | */ | 310 | */ |
291 | if (!(id->idVendor | id->idProduct | id->bDeviceClass | id->bInterfaceClass)) | 311 | if (!(idVendor | idProduct | bDeviceClass | bInterfaceClass)) |
292 | return; | 312 | return; |
293 | 313 | ||
294 | /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */ | 314 | /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */ |
295 | for (ndigits = sizeof(id->bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) { | 315 | for (ndigits = sizeof(bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) { |
296 | clo = devlo & 0xf; | 316 | clo = devlo & 0xf; |
297 | chi = devhi & 0xf; | 317 | chi = devhi & 0xf; |
298 | if (chi > max) /* If we are in bcd mode, truncate if necessary */ | 318 | if (chi > max) /* If we are in bcd mode, truncate if necessary */ |
@@ -301,20 +321,20 @@ static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod) | |||
301 | devhi >>= 4; | 321 | devhi >>= 4; |
302 | 322 | ||
303 | if (devlo == devhi || !ndigits) { | 323 | if (devlo == devhi || !ndigits) { |
304 | do_usb_entry(id, devlo, ndigits, clo, chi, max, mod); | 324 | do_usb_entry(symval, devlo, ndigits, clo, chi, max, mod); |
305 | break; | 325 | break; |
306 | } | 326 | } |
307 | 327 | ||
308 | if (clo > 0x0) | 328 | if (clo > 0x0) |
309 | do_usb_entry(id, | 329 | do_usb_entry(symval, |
310 | incbcd(&devlo, 1, max, | 330 | incbcd(&devlo, 1, max, |
311 | sizeof(id->bcdDevice_lo) * 2), | 331 | sizeof(bcdDevice_lo) * 2), |
312 | ndigits, clo, max, max, mod); | 332 | ndigits, clo, max, max, mod); |
313 | 333 | ||
314 | if (chi < max) | 334 | if (chi < max) |
315 | do_usb_entry(id, | 335 | do_usb_entry(symval, |
316 | incbcd(&devhi, -1, max, | 336 | incbcd(&devhi, -1, max, |
317 | sizeof(id->bcdDevice_lo) * 2), | 337 | sizeof(bcdDevice_lo) * 2), |
318 | ndigits, 0x0, chi, max, mod); | 338 | ndigits, 0x0, chi, max, mod); |
319 | } | 339 | } |
320 | } | 340 | } |
@@ -323,7 +343,7 @@ static void do_usb_table(void *symval, unsigned long size, | |||
323 | struct module *mod) | 343 | struct module *mod) |
324 | { | 344 | { |
325 | unsigned int i; | 345 | unsigned int i; |
326 | const unsigned long id_size = sizeof(struct usb_device_id); | 346 | const unsigned long id_size = SIZE_usb_device_id; |
327 | 347 | ||
328 | device_id_check(mod->name, "usb", size, id_size, symval); | 348 | device_id_check(mod->name, "usb", size, id_size, symval); |
329 | 349 | ||
@@ -336,81 +356,81 @@ static void do_usb_table(void *symval, unsigned long size, | |||
336 | 356 | ||
337 | /* Looks like: hid:bNvNpN */ | 357 | /* Looks like: hid:bNvNpN */ |
338 | static int do_hid_entry(const char *filename, | 358 | static int do_hid_entry(const char *filename, |
339 | struct hid_device_id *id, char *alias) | 359 | void *symval, char *alias) |
340 | { | 360 | { |
341 | id->bus = TO_NATIVE(id->bus); | 361 | DEF_FIELD(symval, hid_device_id, bus); |
342 | id->group = TO_NATIVE(id->group); | 362 | DEF_FIELD(symval, hid_device_id, group); |
343 | id->vendor = TO_NATIVE(id->vendor); | 363 | DEF_FIELD(symval, hid_device_id, vendor); |
344 | id->product = TO_NATIVE(id->product); | 364 | DEF_FIELD(symval, hid_device_id, product); |
345 | 365 | ||
346 | sprintf(alias, "hid:"); | 366 | sprintf(alias, "hid:"); |
347 | ADD(alias, "b", id->bus != HID_BUS_ANY, id->bus); | 367 | ADD(alias, "b", bus != HID_BUS_ANY, bus); |
348 | ADD(alias, "g", id->group != HID_GROUP_ANY, id->group); | 368 | ADD(alias, "g", group != HID_GROUP_ANY, group); |
349 | ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); | 369 | ADD(alias, "v", vendor != HID_ANY_ID, vendor); |
350 | ADD(alias, "p", id->product != HID_ANY_ID, id->product); | 370 | ADD(alias, "p", product != HID_ANY_ID, product); |
351 | 371 | ||
352 | return 1; | 372 | return 1; |
353 | } | 373 | } |
354 | ADD_TO_DEVTABLE("hid", struct hid_device_id, do_hid_entry); | 374 | ADD_TO_DEVTABLE("hid", hid_device_id, do_hid_entry); |
355 | 375 | ||
356 | /* Looks like: ieee1394:venNmoNspNverN */ | 376 | /* Looks like: ieee1394:venNmoNspNverN */ |
357 | static int do_ieee1394_entry(const char *filename, | 377 | static int do_ieee1394_entry(const char *filename, |
358 | struct ieee1394_device_id *id, char *alias) | 378 | void *symval, char *alias) |
359 | { | 379 | { |
360 | id->match_flags = TO_NATIVE(id->match_flags); | 380 | DEF_FIELD(symval, ieee1394_device_id, match_flags); |
361 | id->vendor_id = TO_NATIVE(id->vendor_id); | 381 | DEF_FIELD(symval, ieee1394_device_id, vendor_id); |
362 | id->model_id = TO_NATIVE(id->model_id); | 382 | DEF_FIELD(symval, ieee1394_device_id, model_id); |
363 | id->specifier_id = TO_NATIVE(id->specifier_id); | 383 | DEF_FIELD(symval, ieee1394_device_id, specifier_id); |
364 | id->version = TO_NATIVE(id->version); | 384 | DEF_FIELD(symval, ieee1394_device_id, version); |
365 | 385 | ||
366 | strcpy(alias, "ieee1394:"); | 386 | strcpy(alias, "ieee1394:"); |
367 | ADD(alias, "ven", id->match_flags & IEEE1394_MATCH_VENDOR_ID, | 387 | ADD(alias, "ven", match_flags & IEEE1394_MATCH_VENDOR_ID, |
368 | id->vendor_id); | 388 | vendor_id); |
369 | ADD(alias, "mo", id->match_flags & IEEE1394_MATCH_MODEL_ID, | 389 | ADD(alias, "mo", match_flags & IEEE1394_MATCH_MODEL_ID, |
370 | id->model_id); | 390 | model_id); |
371 | ADD(alias, "sp", id->match_flags & IEEE1394_MATCH_SPECIFIER_ID, | 391 | ADD(alias, "sp", match_flags & IEEE1394_MATCH_SPECIFIER_ID, |
372 | id->specifier_id); | 392 | specifier_id); |
373 | ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION, | 393 | ADD(alias, "ver", match_flags & IEEE1394_MATCH_VERSION, |
374 | id->version); | 394 | version); |
375 | 395 | ||
376 | add_wildcard(alias); | 396 | add_wildcard(alias); |
377 | return 1; | 397 | return 1; |
378 | } | 398 | } |
379 | ADD_TO_DEVTABLE("ieee1394", struct ieee1394_device_id, do_ieee1394_entry); | 399 | ADD_TO_DEVTABLE("ieee1394", ieee1394_device_id, do_ieee1394_entry); |
380 | 400 | ||
381 | /* Looks like: pci:vNdNsvNsdNbcNscNiN. */ | 401 | /* Looks like: pci:vNdNsvNsdNbcNscNiN. */ |
382 | static int do_pci_entry(const char *filename, | 402 | static int do_pci_entry(const char *filename, |
383 | struct pci_device_id *id, char *alias) | 403 | void *symval, char *alias) |
384 | { | 404 | { |
385 | /* Class field can be divided into these three. */ | 405 | /* Class field can be divided into these three. */ |
386 | unsigned char baseclass, subclass, interface, | 406 | unsigned char baseclass, subclass, interface, |
387 | baseclass_mask, subclass_mask, interface_mask; | 407 | baseclass_mask, subclass_mask, interface_mask; |
388 | 408 | ||
389 | id->vendor = TO_NATIVE(id->vendor); | 409 | DEF_FIELD(symval, pci_device_id, vendor); |
390 | id->device = TO_NATIVE(id->device); | 410 | DEF_FIELD(symval, pci_device_id, device); |
391 | id->subvendor = TO_NATIVE(id->subvendor); | 411 | DEF_FIELD(symval, pci_device_id, subvendor); |
392 | id->subdevice = TO_NATIVE(id->subdevice); | 412 | DEF_FIELD(symval, pci_device_id, subdevice); |
393 | id->class = TO_NATIVE(id->class); | 413 | DEF_FIELD(symval, pci_device_id, class); |
394 | id->class_mask = TO_NATIVE(id->class_mask); | 414 | DEF_FIELD(symval, pci_device_id, class_mask); |
395 | 415 | ||
396 | strcpy(alias, "pci:"); | 416 | strcpy(alias, "pci:"); |
397 | ADD(alias, "v", id->vendor != PCI_ANY_ID, id->vendor); | 417 | ADD(alias, "v", vendor != PCI_ANY_ID, vendor); |
398 | ADD(alias, "d", id->device != PCI_ANY_ID, id->device); | 418 | ADD(alias, "d", device != PCI_ANY_ID, device); |
399 | ADD(alias, "sv", id->subvendor != PCI_ANY_ID, id->subvendor); | 419 | ADD(alias, "sv", subvendor != PCI_ANY_ID, subvendor); |
400 | ADD(alias, "sd", id->subdevice != PCI_ANY_ID, id->subdevice); | 420 | ADD(alias, "sd", subdevice != PCI_ANY_ID, subdevice); |
401 | 421 | ||
402 | baseclass = (id->class) >> 16; | 422 | baseclass = (class) >> 16; |
403 | baseclass_mask = (id->class_mask) >> 16; | 423 | baseclass_mask = (class_mask) >> 16; |
404 | subclass = (id->class) >> 8; | 424 | subclass = (class) >> 8; |
405 | subclass_mask = (id->class_mask) >> 8; | 425 | subclass_mask = (class_mask) >> 8; |
406 | interface = id->class; | 426 | interface = class; |
407 | interface_mask = id->class_mask; | 427 | interface_mask = class_mask; |
408 | 428 | ||
409 | if ((baseclass_mask != 0 && baseclass_mask != 0xFF) | 429 | if ((baseclass_mask != 0 && baseclass_mask != 0xFF) |
410 | || (subclass_mask != 0 && subclass_mask != 0xFF) | 430 | || (subclass_mask != 0 && subclass_mask != 0xFF) |
411 | || (interface_mask != 0 && interface_mask != 0xFF)) { | 431 | || (interface_mask != 0 && interface_mask != 0xFF)) { |
412 | warn("Can't handle masks in %s:%04X\n", | 432 | warn("Can't handle masks in %s:%04X\n", |
413 | filename, id->class_mask); | 433 | filename, class_mask); |
414 | return 0; | 434 | return 0; |
415 | } | 435 | } |
416 | 436 | ||
@@ -420,101 +440,105 @@ static int do_pci_entry(const char *filename, | |||
420 | add_wildcard(alias); | 440 | add_wildcard(alias); |
421 | return 1; | 441 | return 1; |
422 | } | 442 | } |
423 | ADD_TO_DEVTABLE("pci", struct pci_device_id, do_pci_entry); | 443 | ADD_TO_DEVTABLE("pci", pci_device_id, do_pci_entry); |
424 | 444 | ||
425 | /* looks like: "ccw:tNmNdtNdmN" */ | 445 | /* looks like: "ccw:tNmNdtNdmN" */ |
426 | static int do_ccw_entry(const char *filename, | 446 | static int do_ccw_entry(const char *filename, |
427 | struct ccw_device_id *id, char *alias) | 447 | void *symval, char *alias) |
428 | { | 448 | { |
429 | id->match_flags = TO_NATIVE(id->match_flags); | 449 | DEF_FIELD(symval, ccw_device_id, match_flags); |
430 | id->cu_type = TO_NATIVE(id->cu_type); | 450 | DEF_FIELD(symval, ccw_device_id, cu_type); |
431 | id->cu_model = TO_NATIVE(id->cu_model); | 451 | DEF_FIELD(symval, ccw_device_id, cu_model); |
432 | id->dev_type = TO_NATIVE(id->dev_type); | 452 | DEF_FIELD(symval, ccw_device_id, dev_type); |
433 | id->dev_model = TO_NATIVE(id->dev_model); | 453 | DEF_FIELD(symval, ccw_device_id, dev_model); |
434 | 454 | ||
435 | strcpy(alias, "ccw:"); | 455 | strcpy(alias, "ccw:"); |
436 | ADD(alias, "t", id->match_flags&CCW_DEVICE_ID_MATCH_CU_TYPE, | 456 | ADD(alias, "t", match_flags&CCW_DEVICE_ID_MATCH_CU_TYPE, |
437 | id->cu_type); | 457 | cu_type); |
438 | ADD(alias, "m", id->match_flags&CCW_DEVICE_ID_MATCH_CU_MODEL, | 458 | ADD(alias, "m", match_flags&CCW_DEVICE_ID_MATCH_CU_MODEL, |
439 | id->cu_model); | 459 | cu_model); |
440 | ADD(alias, "dt", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_TYPE, | 460 | ADD(alias, "dt", match_flags&CCW_DEVICE_ID_MATCH_DEVICE_TYPE, |
441 | id->dev_type); | 461 | dev_type); |
442 | ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, | 462 | ADD(alias, "dm", match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, |
443 | id->dev_model); | 463 | dev_model); |
444 | add_wildcard(alias); | 464 | add_wildcard(alias); |
445 | return 1; | 465 | return 1; |
446 | } | 466 | } |
447 | ADD_TO_DEVTABLE("ccw", struct ccw_device_id, do_ccw_entry); | 467 | ADD_TO_DEVTABLE("ccw", ccw_device_id, do_ccw_entry); |
448 | 468 | ||
449 | /* looks like: "ap:tN" */ | 469 | /* looks like: "ap:tN" */ |
450 | static int do_ap_entry(const char *filename, | 470 | static int do_ap_entry(const char *filename, |
451 | struct ap_device_id *id, char *alias) | 471 | void *symval, char *alias) |
452 | { | 472 | { |
453 | sprintf(alias, "ap:t%02X*", id->dev_type); | 473 | DEF_FIELD(symval, ap_device_id, dev_type); |
474 | |||
475 | sprintf(alias, "ap:t%02X*", dev_type); | ||
454 | return 1; | 476 | return 1; |
455 | } | 477 | } |
456 | ADD_TO_DEVTABLE("ap", struct ap_device_id, do_ap_entry); | 478 | ADD_TO_DEVTABLE("ap", ap_device_id, do_ap_entry); |
457 | 479 | ||
458 | /* looks like: "css:tN" */ | 480 | /* looks like: "css:tN" */ |
459 | static int do_css_entry(const char *filename, | 481 | static int do_css_entry(const char *filename, |
460 | struct css_device_id *id, char *alias) | 482 | void *symval, char *alias) |
461 | { | 483 | { |
462 | sprintf(alias, "css:t%01X", id->type); | 484 | DEF_FIELD(symval, css_device_id, type); |
485 | |||
486 | sprintf(alias, "css:t%01X", type); | ||
463 | return 1; | 487 | return 1; |
464 | } | 488 | } |
465 | ADD_TO_DEVTABLE("css", struct css_device_id, do_css_entry); | 489 | ADD_TO_DEVTABLE("css", css_device_id, do_css_entry); |
466 | 490 | ||
467 | /* Looks like: "serio:tyNprNidNexN" */ | 491 | /* Looks like: "serio:tyNprNidNexN" */ |
468 | static int do_serio_entry(const char *filename, | 492 | static int do_serio_entry(const char *filename, |
469 | struct serio_device_id *id, char *alias) | 493 | void *symval, char *alias) |
470 | { | 494 | { |
471 | id->type = TO_NATIVE(id->type); | 495 | DEF_FIELD(symval, serio_device_id, type); |
472 | id->proto = TO_NATIVE(id->proto); | 496 | DEF_FIELD(symval, serio_device_id, proto); |
473 | id->id = TO_NATIVE(id->id); | 497 | DEF_FIELD(symval, serio_device_id, id); |
474 | id->extra = TO_NATIVE(id->extra); | 498 | DEF_FIELD(symval, serio_device_id, extra); |
475 | 499 | ||
476 | strcpy(alias, "serio:"); | 500 | strcpy(alias, "serio:"); |
477 | ADD(alias, "ty", id->type != SERIO_ANY, id->type); | 501 | ADD(alias, "ty", type != SERIO_ANY, type); |
478 | ADD(alias, "pr", id->proto != SERIO_ANY, id->proto); | 502 | ADD(alias, "pr", proto != SERIO_ANY, proto); |
479 | ADD(alias, "id", id->id != SERIO_ANY, id->id); | 503 | ADD(alias, "id", id != SERIO_ANY, id); |
480 | ADD(alias, "ex", id->extra != SERIO_ANY, id->extra); | 504 | ADD(alias, "ex", extra != SERIO_ANY, extra); |
481 | 505 | ||
482 | add_wildcard(alias); | 506 | add_wildcard(alias); |
483 | return 1; | 507 | return 1; |
484 | } | 508 | } |
485 | ADD_TO_DEVTABLE("serio", struct serio_device_id, do_serio_entry); | 509 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); |
486 | 510 | ||
487 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ | 511 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ |
488 | static int do_acpi_entry(const char *filename, | 512 | static int do_acpi_entry(const char *filename, |
489 | struct acpi_device_id *id, char *alias) | 513 | void *symval, char *alias) |
490 | { | 514 | { |
491 | sprintf(alias, "acpi*:%s:*", id->id); | 515 | DEF_FIELD_ADDR(symval, acpi_device_id, id); |
516 | sprintf(alias, "acpi*:%s:*", *id); | ||
492 | return 1; | 517 | return 1; |
493 | } | 518 | } |
494 | ADD_TO_DEVTABLE("acpi", struct acpi_device_id, do_acpi_entry); | 519 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); |
495 | 520 | ||
496 | /* looks like: "pnp:dD" */ | 521 | /* looks like: "pnp:dD" */ |
497 | static void do_pnp_device_entry(void *symval, unsigned long size, | 522 | static void do_pnp_device_entry(void *symval, unsigned long size, |
498 | struct module *mod) | 523 | struct module *mod) |
499 | { | 524 | { |
500 | const unsigned long id_size = sizeof(struct pnp_device_id); | 525 | const unsigned long id_size = SIZE_pnp_device_id; |
501 | const unsigned int count = (size / id_size)-1; | 526 | const unsigned int count = (size / id_size)-1; |
502 | const struct pnp_device_id *devs = symval; | ||
503 | unsigned int i; | 527 | unsigned int i; |
504 | 528 | ||
505 | device_id_check(mod->name, "pnp", size, id_size, symval); | 529 | device_id_check(mod->name, "pnp", size, id_size, symval); |
506 | 530 | ||
507 | for (i = 0; i < count; i++) { | 531 | for (i = 0; i < count; i++) { |
508 | const char *id = (char *)devs[i].id; | 532 | DEF_FIELD_ADDR(symval + i*id_size, pnp_device_id, id); |
509 | char acpi_id[sizeof(devs[0].id)]; | 533 | char acpi_id[sizeof(*id)]; |
510 | int j; | 534 | int j; |
511 | 535 | ||
512 | buf_printf(&mod->dev_table_buf, | 536 | buf_printf(&mod->dev_table_buf, |
513 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 537 | "MODULE_ALIAS(\"pnp:d%s*\");\n", *id); |
514 | 538 | ||
515 | /* fix broken pnp bus lowercasing */ | 539 | /* fix broken pnp bus lowercasing */ |
516 | for (j = 0; j < sizeof(acpi_id); j++) | 540 | for (j = 0; j < sizeof(acpi_id); j++) |
517 | acpi_id[j] = toupper(id[j]); | 541 | acpi_id[j] = toupper((*id)[j]); |
518 | buf_printf(&mod->dev_table_buf, | 542 | buf_printf(&mod->dev_table_buf, |
519 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id); | 543 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id); |
520 | } | 544 | } |
@@ -524,19 +548,18 @@ static void do_pnp_device_entry(void *symval, unsigned long size, | |||
524 | static void do_pnp_card_entries(void *symval, unsigned long size, | 548 | static void do_pnp_card_entries(void *symval, unsigned long size, |
525 | struct module *mod) | 549 | struct module *mod) |
526 | { | 550 | { |
527 | const unsigned long id_size = sizeof(struct pnp_card_device_id); | 551 | const unsigned long id_size = SIZE_pnp_card_device_id; |
528 | const unsigned int count = (size / id_size)-1; | 552 | const unsigned int count = (size / id_size)-1; |
529 | const struct pnp_card_device_id *cards = symval; | ||
530 | unsigned int i; | 553 | unsigned int i; |
531 | 554 | ||
532 | device_id_check(mod->name, "pnp", size, id_size, symval); | 555 | device_id_check(mod->name, "pnp", size, id_size, symval); |
533 | 556 | ||
534 | for (i = 0; i < count; i++) { | 557 | for (i = 0; i < count; i++) { |
535 | unsigned int j; | 558 | unsigned int j; |
536 | const struct pnp_card_device_id *card = &cards[i]; | 559 | DEF_FIELD_ADDR(symval + i*id_size, pnp_card_device_id, devs); |
537 | 560 | ||
538 | for (j = 0; j < PNP_MAX_DEVICES; j++) { | 561 | for (j = 0; j < PNP_MAX_DEVICES; j++) { |
539 | const char *id = (char *)card->devs[j].id; | 562 | const char *id = (char *)(*devs)[j].id; |
540 | int i2, j2; | 563 | int i2, j2; |
541 | int dup = 0; | 564 | int dup = 0; |
542 | 565 | ||
@@ -545,10 +568,10 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
545 | 568 | ||
546 | /* find duplicate, already added value */ | 569 | /* find duplicate, already added value */ |
547 | for (i2 = 0; i2 < i && !dup; i2++) { | 570 | for (i2 = 0; i2 < i && !dup; i2++) { |
548 | const struct pnp_card_device_id *card2 = &cards[i2]; | 571 | DEF_FIELD_ADDR(symval + i2*id_size, pnp_card_device_id, devs); |
549 | 572 | ||
550 | for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) { | 573 | for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) { |
551 | const char *id2 = (char *)card2->devs[j2].id; | 574 | const char *id2 = (char *)(*devs)[j2].id; |
552 | 575 | ||
553 | if (!id2[0]) | 576 | if (!id2[0]) |
554 | break; | 577 | break; |
@@ -562,7 +585,7 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
562 | 585 | ||
563 | /* add an individual alias for every device entry */ | 586 | /* add an individual alias for every device entry */ |
564 | if (!dup) { | 587 | if (!dup) { |
565 | char acpi_id[sizeof(card->devs[0].id)]; | 588 | char acpi_id[PNP_ID_LEN]; |
566 | int k; | 589 | int k; |
567 | 590 | ||
568 | buf_printf(&mod->dev_table_buf, | 591 | buf_printf(&mod->dev_table_buf, |
@@ -580,54 +603,58 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
580 | 603 | ||
581 | /* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ | 604 | /* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ |
582 | static int do_pcmcia_entry(const char *filename, | 605 | static int do_pcmcia_entry(const char *filename, |
583 | struct pcmcia_device_id *id, char *alias) | 606 | void *symval, char *alias) |
584 | { | 607 | { |
585 | unsigned int i; | 608 | unsigned int i; |
586 | 609 | DEF_FIELD(symval, pcmcia_device_id, match_flags); | |
587 | id->match_flags = TO_NATIVE(id->match_flags); | 610 | DEF_FIELD(symval, pcmcia_device_id, manf_id); |
588 | id->manf_id = TO_NATIVE(id->manf_id); | 611 | DEF_FIELD(symval, pcmcia_device_id, card_id); |
589 | id->card_id = TO_NATIVE(id->card_id); | 612 | DEF_FIELD(symval, pcmcia_device_id, func_id); |
590 | id->func_id = TO_NATIVE(id->func_id); | 613 | DEF_FIELD(symval, pcmcia_device_id, function); |
591 | id->function = TO_NATIVE(id->function); | 614 | DEF_FIELD(symval, pcmcia_device_id, device_no); |
592 | id->device_no = TO_NATIVE(id->device_no); | 615 | DEF_FIELD_ADDR(symval, pcmcia_device_id, prod_id_hash); |
593 | 616 | ||
594 | for (i=0; i<4; i++) { | 617 | for (i=0; i<4; i++) { |
595 | id->prod_id_hash[i] = TO_NATIVE(id->prod_id_hash[i]); | 618 | (*prod_id_hash)[i] = TO_NATIVE((*prod_id_hash)[i]); |
596 | } | 619 | } |
597 | 620 | ||
598 | strcpy(alias, "pcmcia:"); | 621 | strcpy(alias, "pcmcia:"); |
599 | ADD(alias, "m", id->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID, | 622 | ADD(alias, "m", match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID, |
600 | id->manf_id); | 623 | manf_id); |
601 | ADD(alias, "c", id->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID, | 624 | ADD(alias, "c", match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID, |
602 | id->card_id); | 625 | card_id); |
603 | ADD(alias, "f", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID, | 626 | ADD(alias, "f", match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID, |
604 | id->func_id); | 627 | func_id); |
605 | ADD(alias, "fn", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION, | 628 | ADD(alias, "fn", match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION, |
606 | id->function); | 629 | function); |
607 | ADD(alias, "pfn", id->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO, | 630 | ADD(alias, "pfn", match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO, |
608 | id->device_no); | 631 | device_no); |
609 | ADD(alias, "pa", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, id->prod_id_hash[0]); | 632 | ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, (*prod_id_hash)[0]); |
610 | ADD(alias, "pb", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, id->prod_id_hash[1]); | 633 | ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, (*prod_id_hash)[1]); |
611 | ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); | 634 | ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, (*prod_id_hash)[2]); |
612 | ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); | 635 | ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, (*prod_id_hash)[3]); |
613 | 636 | ||
614 | add_wildcard(alias); | 637 | add_wildcard(alias); |
615 | return 1; | 638 | return 1; |
616 | } | 639 | } |
617 | ADD_TO_DEVTABLE("pcmcia", struct pcmcia_device_id, do_pcmcia_entry); | 640 | ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry); |
618 | 641 | ||
619 | static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) | 642 | static int do_of_entry (const char *filename, void *symval, char *alias) |
620 | { | 643 | { |
621 | int len; | 644 | int len; |
622 | char *tmp; | 645 | char *tmp; |
646 | DEF_FIELD_ADDR(symval, of_device_id, name); | ||
647 | DEF_FIELD_ADDR(symval, of_device_id, type); | ||
648 | DEF_FIELD_ADDR(symval, of_device_id, compatible); | ||
649 | |||
623 | len = sprintf (alias, "of:N%sT%s", | 650 | len = sprintf (alias, "of:N%sT%s", |
624 | of->name[0] ? of->name : "*", | 651 | (*name)[0] ? *name : "*", |
625 | of->type[0] ? of->type : "*"); | 652 | (*type)[0] ? *type : "*"); |
626 | 653 | ||
627 | if (of->compatible[0]) | 654 | if (compatible[0]) |
628 | sprintf (&alias[len], "%sC%s", | 655 | sprintf (&alias[len], "%sC%s", |
629 | of->type[0] ? "*" : "", | 656 | (*type)[0] ? "*" : "", |
630 | of->compatible); | 657 | *compatible); |
631 | 658 | ||
632 | /* Replace all whitespace with underscores */ | 659 | /* Replace all whitespace with underscores */ |
633 | for (tmp = alias; tmp && *tmp; tmp++) | 660 | for (tmp = alias; tmp && *tmp; tmp++) |
@@ -637,15 +664,17 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali | |||
637 | add_wildcard(alias); | 664 | add_wildcard(alias); |
638 | return 1; | 665 | return 1; |
639 | } | 666 | } |
640 | ADD_TO_DEVTABLE("of", struct of_device_id, do_of_entry); | 667 | ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); |
641 | 668 | ||
642 | static int do_vio_entry(const char *filename, struct vio_device_id *vio, | 669 | static int do_vio_entry(const char *filename, void *symval, |
643 | char *alias) | 670 | char *alias) |
644 | { | 671 | { |
645 | char *tmp; | 672 | char *tmp; |
673 | DEF_FIELD_ADDR(symval, vio_device_id, type); | ||
674 | DEF_FIELD_ADDR(symval, vio_device_id, compat); | ||
646 | 675 | ||
647 | sprintf(alias, "vio:T%sS%s", vio->type[0] ? vio->type : "*", | 676 | sprintf(alias, "vio:T%sS%s", (*type)[0] ? *type : "*", |
648 | vio->compat[0] ? vio->compat : "*"); | 677 | (*compat)[0] ? *compat : "*"); |
649 | 678 | ||
650 | /* Replace all whitespace with underscores */ | 679 | /* Replace all whitespace with underscores */ |
651 | for (tmp = alias; tmp && *tmp; tmp++) | 680 | for (tmp = alias; tmp && *tmp; tmp++) |
@@ -655,7 +684,7 @@ static int do_vio_entry(const char *filename, struct vio_device_id *vio, | |||
655 | add_wildcard(alias); | 684 | add_wildcard(alias); |
656 | return 1; | 685 | return 1; |
657 | } | 686 | } |
658 | ADD_TO_DEVTABLE("vio", struct vio_device_id, do_vio_entry); | 687 | ADD_TO_DEVTABLE("vio", vio_device_id, do_vio_entry); |
659 | 688 | ||
660 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 689 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
661 | 690 | ||
@@ -664,154 +693,172 @@ static void do_input(char *alias, | |||
664 | { | 693 | { |
665 | unsigned int i; | 694 | unsigned int i; |
666 | 695 | ||
696 | for (i = min / BITS_PER_LONG; i < max / BITS_PER_LONG + 1; i++) | ||
697 | arr[i] = TO_NATIVE(arr[i]); | ||
667 | for (i = min; i < max; i++) | 698 | for (i = min; i < max; i++) |
668 | if (arr[i / BITS_PER_LONG] & (1L << (i%BITS_PER_LONG))) | 699 | if (arr[i / BITS_PER_LONG] & (1L << (i%BITS_PER_LONG))) |
669 | sprintf(alias + strlen(alias), "%X,*", i); | 700 | sprintf(alias + strlen(alias), "%X,*", i); |
670 | } | 701 | } |
671 | 702 | ||
672 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ | 703 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ |
673 | static int do_input_entry(const char *filename, struct input_device_id *id, | 704 | static int do_input_entry(const char *filename, void *symval, |
674 | char *alias) | 705 | char *alias) |
675 | { | 706 | { |
707 | DEF_FIELD(symval, input_device_id, flags); | ||
708 | DEF_FIELD(symval, input_device_id, bustype); | ||
709 | DEF_FIELD(symval, input_device_id, vendor); | ||
710 | DEF_FIELD(symval, input_device_id, product); | ||
711 | DEF_FIELD(symval, input_device_id, version); | ||
712 | DEF_FIELD_ADDR(symval, input_device_id, evbit); | ||
713 | DEF_FIELD_ADDR(symval, input_device_id, keybit); | ||
714 | DEF_FIELD_ADDR(symval, input_device_id, relbit); | ||
715 | DEF_FIELD_ADDR(symval, input_device_id, absbit); | ||
716 | DEF_FIELD_ADDR(symval, input_device_id, mscbit); | ||
717 | DEF_FIELD_ADDR(symval, input_device_id, ledbit); | ||
718 | DEF_FIELD_ADDR(symval, input_device_id, sndbit); | ||
719 | DEF_FIELD_ADDR(symval, input_device_id, ffbit); | ||
720 | DEF_FIELD_ADDR(symval, input_device_id, swbit); | ||
721 | |||
676 | sprintf(alias, "input:"); | 722 | sprintf(alias, "input:"); |
677 | 723 | ||
678 | ADD(alias, "b", id->flags & INPUT_DEVICE_ID_MATCH_BUS, id->bustype); | 724 | ADD(alias, "b", flags & INPUT_DEVICE_ID_MATCH_BUS, bustype); |
679 | ADD(alias, "v", id->flags & INPUT_DEVICE_ID_MATCH_VENDOR, id->vendor); | 725 | ADD(alias, "v", flags & INPUT_DEVICE_ID_MATCH_VENDOR, vendor); |
680 | ADD(alias, "p", id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT, id->product); | 726 | ADD(alias, "p", flags & INPUT_DEVICE_ID_MATCH_PRODUCT, product); |
681 | ADD(alias, "e", id->flags & INPUT_DEVICE_ID_MATCH_VERSION, id->version); | 727 | ADD(alias, "e", flags & INPUT_DEVICE_ID_MATCH_VERSION, version); |
682 | 728 | ||
683 | sprintf(alias + strlen(alias), "-e*"); | 729 | sprintf(alias + strlen(alias), "-e*"); |
684 | if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT) | 730 | if (flags & INPUT_DEVICE_ID_MATCH_EVBIT) |
685 | do_input(alias, id->evbit, 0, INPUT_DEVICE_ID_EV_MAX); | 731 | do_input(alias, *evbit, 0, INPUT_DEVICE_ID_EV_MAX); |
686 | sprintf(alias + strlen(alias), "k*"); | 732 | sprintf(alias + strlen(alias), "k*"); |
687 | if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT) | 733 | if (flags & INPUT_DEVICE_ID_MATCH_KEYBIT) |
688 | do_input(alias, id->keybit, | 734 | do_input(alias, *keybit, |
689 | INPUT_DEVICE_ID_KEY_MIN_INTERESTING, | 735 | INPUT_DEVICE_ID_KEY_MIN_INTERESTING, |
690 | INPUT_DEVICE_ID_KEY_MAX); | 736 | INPUT_DEVICE_ID_KEY_MAX); |
691 | sprintf(alias + strlen(alias), "r*"); | 737 | sprintf(alias + strlen(alias), "r*"); |
692 | if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT) | 738 | if (flags & INPUT_DEVICE_ID_MATCH_RELBIT) |
693 | do_input(alias, id->relbit, 0, INPUT_DEVICE_ID_REL_MAX); | 739 | do_input(alias, *relbit, 0, INPUT_DEVICE_ID_REL_MAX); |
694 | sprintf(alias + strlen(alias), "a*"); | 740 | sprintf(alias + strlen(alias), "a*"); |
695 | if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT) | 741 | if (flags & INPUT_DEVICE_ID_MATCH_ABSBIT) |
696 | do_input(alias, id->absbit, 0, INPUT_DEVICE_ID_ABS_MAX); | 742 | do_input(alias, *absbit, 0, INPUT_DEVICE_ID_ABS_MAX); |
697 | sprintf(alias + strlen(alias), "m*"); | 743 | sprintf(alias + strlen(alias), "m*"); |
698 | if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT) | 744 | if (flags & INPUT_DEVICE_ID_MATCH_MSCIT) |
699 | do_input(alias, id->mscbit, 0, INPUT_DEVICE_ID_MSC_MAX); | 745 | do_input(alias, *mscbit, 0, INPUT_DEVICE_ID_MSC_MAX); |
700 | sprintf(alias + strlen(alias), "l*"); | 746 | sprintf(alias + strlen(alias), "l*"); |
701 | if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT) | 747 | if (flags & INPUT_DEVICE_ID_MATCH_LEDBIT) |
702 | do_input(alias, id->ledbit, 0, INPUT_DEVICE_ID_LED_MAX); | 748 | do_input(alias, *ledbit, 0, INPUT_DEVICE_ID_LED_MAX); |
703 | sprintf(alias + strlen(alias), "s*"); | 749 | sprintf(alias + strlen(alias), "s*"); |
704 | if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT) | 750 | if (flags & INPUT_DEVICE_ID_MATCH_SNDBIT) |
705 | do_input(alias, id->sndbit, 0, INPUT_DEVICE_ID_SND_MAX); | 751 | do_input(alias, *sndbit, 0, INPUT_DEVICE_ID_SND_MAX); |
706 | sprintf(alias + strlen(alias), "f*"); | 752 | sprintf(alias + strlen(alias), "f*"); |
707 | if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT) | 753 | if (flags & INPUT_DEVICE_ID_MATCH_FFBIT) |
708 | do_input(alias, id->ffbit, 0, INPUT_DEVICE_ID_FF_MAX); | 754 | do_input(alias, *ffbit, 0, INPUT_DEVICE_ID_FF_MAX); |
709 | sprintf(alias + strlen(alias), "w*"); | 755 | sprintf(alias + strlen(alias), "w*"); |
710 | if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT) | 756 | if (flags & INPUT_DEVICE_ID_MATCH_SWBIT) |
711 | do_input(alias, id->swbit, 0, INPUT_DEVICE_ID_SW_MAX); | 757 | do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); |
712 | return 1; | 758 | return 1; |
713 | } | 759 | } |
714 | ADD_TO_DEVTABLE("input", struct input_device_id, do_input_entry); | 760 | ADD_TO_DEVTABLE("input", input_device_id, do_input_entry); |
715 | 761 | ||
716 | static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | 762 | static int do_eisa_entry(const char *filename, void *symval, |
717 | char *alias) | 763 | char *alias) |
718 | { | 764 | { |
719 | if (eisa->sig[0]) | 765 | DEF_FIELD_ADDR(symval, eisa_device_id, sig); |
720 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); | 766 | if (sig[0]) |
767 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", *sig); | ||
721 | else | 768 | else |
722 | strcat(alias, "*"); | 769 | strcat(alias, "*"); |
723 | return 1; | 770 | return 1; |
724 | } | 771 | } |
725 | ADD_TO_DEVTABLE("eisa", struct eisa_device_id, do_eisa_entry); | 772 | ADD_TO_DEVTABLE("eisa", eisa_device_id, do_eisa_entry); |
726 | 773 | ||
727 | /* Looks like: parisc:tNhvNrevNsvN */ | 774 | /* Looks like: parisc:tNhvNrevNsvN */ |
728 | static int do_parisc_entry(const char *filename, struct parisc_device_id *id, | 775 | static int do_parisc_entry(const char *filename, void *symval, |
729 | char *alias) | 776 | char *alias) |
730 | { | 777 | { |
731 | id->hw_type = TO_NATIVE(id->hw_type); | 778 | DEF_FIELD(symval, parisc_device_id, hw_type); |
732 | id->hversion = TO_NATIVE(id->hversion); | 779 | DEF_FIELD(symval, parisc_device_id, hversion); |
733 | id->hversion_rev = TO_NATIVE(id->hversion_rev); | 780 | DEF_FIELD(symval, parisc_device_id, hversion_rev); |
734 | id->sversion = TO_NATIVE(id->sversion); | 781 | DEF_FIELD(symval, parisc_device_id, sversion); |
735 | 782 | ||
736 | strcpy(alias, "parisc:"); | 783 | strcpy(alias, "parisc:"); |
737 | ADD(alias, "t", id->hw_type != PA_HWTYPE_ANY_ID, id->hw_type); | 784 | ADD(alias, "t", hw_type != PA_HWTYPE_ANY_ID, hw_type); |
738 | ADD(alias, "hv", id->hversion != PA_HVERSION_ANY_ID, id->hversion); | 785 | ADD(alias, "hv", hversion != PA_HVERSION_ANY_ID, hversion); |
739 | ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); | 786 | ADD(alias, "rev", hversion_rev != PA_HVERSION_REV_ANY_ID, hversion_rev); |
740 | ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); | 787 | ADD(alias, "sv", sversion != PA_SVERSION_ANY_ID, sversion); |
741 | 788 | ||
742 | add_wildcard(alias); | 789 | add_wildcard(alias); |
743 | return 1; | 790 | return 1; |
744 | } | 791 | } |
745 | ADD_TO_DEVTABLE("parisc", struct parisc_device_id, do_parisc_entry); | 792 | ADD_TO_DEVTABLE("parisc", parisc_device_id, do_parisc_entry); |
746 | 793 | ||
747 | /* Looks like: sdio:cNvNdN. */ | 794 | /* Looks like: sdio:cNvNdN. */ |
748 | static int do_sdio_entry(const char *filename, | 795 | static int do_sdio_entry(const char *filename, |
749 | struct sdio_device_id *id, char *alias) | 796 | void *symval, char *alias) |
750 | { | 797 | { |
751 | id->class = TO_NATIVE(id->class); | 798 | DEF_FIELD(symval, sdio_device_id, class); |
752 | id->vendor = TO_NATIVE(id->vendor); | 799 | DEF_FIELD(symval, sdio_device_id, vendor); |
753 | id->device = TO_NATIVE(id->device); | 800 | DEF_FIELD(symval, sdio_device_id, device); |
754 | 801 | ||
755 | strcpy(alias, "sdio:"); | 802 | strcpy(alias, "sdio:"); |
756 | ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); | 803 | ADD(alias, "c", class != (__u8)SDIO_ANY_ID, class); |
757 | ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); | 804 | ADD(alias, "v", vendor != (__u16)SDIO_ANY_ID, vendor); |
758 | ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); | 805 | ADD(alias, "d", device != (__u16)SDIO_ANY_ID, device); |
759 | add_wildcard(alias); | 806 | add_wildcard(alias); |
760 | return 1; | 807 | return 1; |
761 | } | 808 | } |
762 | ADD_TO_DEVTABLE("sdio", struct sdio_device_id, do_sdio_entry); | 809 | ADD_TO_DEVTABLE("sdio", sdio_device_id, do_sdio_entry); |
763 | 810 | ||
764 | /* Looks like: ssb:vNidNrevN. */ | 811 | /* Looks like: ssb:vNidNrevN. */ |
765 | static int do_ssb_entry(const char *filename, | 812 | static int do_ssb_entry(const char *filename, |
766 | struct ssb_device_id *id, char *alias) | 813 | void *symval, char *alias) |
767 | { | 814 | { |
768 | id->vendor = TO_NATIVE(id->vendor); | 815 | DEF_FIELD(symval, ssb_device_id, vendor); |
769 | id->coreid = TO_NATIVE(id->coreid); | 816 | DEF_FIELD(symval, ssb_device_id, coreid); |
770 | id->revision = TO_NATIVE(id->revision); | 817 | DEF_FIELD(symval, ssb_device_id, revision); |
771 | 818 | ||
772 | strcpy(alias, "ssb:"); | 819 | strcpy(alias, "ssb:"); |
773 | ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); | 820 | ADD(alias, "v", vendor != SSB_ANY_VENDOR, vendor); |
774 | ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); | 821 | ADD(alias, "id", coreid != SSB_ANY_ID, coreid); |
775 | ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); | 822 | ADD(alias, "rev", revision != SSB_ANY_REV, revision); |
776 | add_wildcard(alias); | 823 | add_wildcard(alias); |
777 | return 1; | 824 | return 1; |
778 | } | 825 | } |
779 | ADD_TO_DEVTABLE("ssb", struct ssb_device_id, do_ssb_entry); | 826 | ADD_TO_DEVTABLE("ssb", ssb_device_id, do_ssb_entry); |
780 | 827 | ||
781 | /* Looks like: bcma:mNidNrevNclN. */ | 828 | /* Looks like: bcma:mNidNrevNclN. */ |
782 | static int do_bcma_entry(const char *filename, | 829 | static int do_bcma_entry(const char *filename, |
783 | struct bcma_device_id *id, char *alias) | 830 | void *symval, char *alias) |
784 | { | 831 | { |
785 | id->manuf = TO_NATIVE(id->manuf); | 832 | DEF_FIELD(symval, bcma_device_id, manuf); |
786 | id->id = TO_NATIVE(id->id); | 833 | DEF_FIELD(symval, bcma_device_id, id); |
787 | id->rev = TO_NATIVE(id->rev); | 834 | DEF_FIELD(symval, bcma_device_id, rev); |
788 | id->class = TO_NATIVE(id->class); | 835 | DEF_FIELD(symval, bcma_device_id, class); |
789 | 836 | ||
790 | strcpy(alias, "bcma:"); | 837 | strcpy(alias, "bcma:"); |
791 | ADD(alias, "m", id->manuf != BCMA_ANY_MANUF, id->manuf); | 838 | ADD(alias, "m", manuf != BCMA_ANY_MANUF, manuf); |
792 | ADD(alias, "id", id->id != BCMA_ANY_ID, id->id); | 839 | ADD(alias, "id", id != BCMA_ANY_ID, id); |
793 | ADD(alias, "rev", id->rev != BCMA_ANY_REV, id->rev); | 840 | ADD(alias, "rev", rev != BCMA_ANY_REV, rev); |
794 | ADD(alias, "cl", id->class != BCMA_ANY_CLASS, id->class); | 841 | ADD(alias, "cl", class != BCMA_ANY_CLASS, class); |
795 | add_wildcard(alias); | 842 | add_wildcard(alias); |
796 | return 1; | 843 | return 1; |
797 | } | 844 | } |
798 | ADD_TO_DEVTABLE("bcma", struct bcma_device_id, do_bcma_entry); | 845 | ADD_TO_DEVTABLE("bcma", bcma_device_id, do_bcma_entry); |
799 | 846 | ||
800 | /* Looks like: virtio:dNvN */ | 847 | /* Looks like: virtio:dNvN */ |
801 | static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | 848 | static int do_virtio_entry(const char *filename, void *symval, |
802 | char *alias) | 849 | char *alias) |
803 | { | 850 | { |
804 | id->device = TO_NATIVE(id->device); | 851 | DEF_FIELD(symval, virtio_device_id, device); |
805 | id->vendor = TO_NATIVE(id->vendor); | 852 | DEF_FIELD(symval, virtio_device_id, vendor); |
806 | 853 | ||
807 | strcpy(alias, "virtio:"); | 854 | strcpy(alias, "virtio:"); |
808 | ADD(alias, "d", id->device != VIRTIO_DEV_ANY_ID, id->device); | 855 | ADD(alias, "d", device != VIRTIO_DEV_ANY_ID, device); |
809 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); | 856 | ADD(alias, "v", vendor != VIRTIO_DEV_ANY_ID, vendor); |
810 | 857 | ||
811 | add_wildcard(alias); | 858 | add_wildcard(alias); |
812 | return 1; | 859 | return 1; |
813 | } | 860 | } |
814 | ADD_TO_DEVTABLE("virtio", struct virtio_device_id, do_virtio_entry); | 861 | ADD_TO_DEVTABLE("virtio", virtio_device_id, do_virtio_entry); |
815 | 862 | ||
816 | /* | 863 | /* |
817 | * Looks like: vmbus:guid | 864 | * Looks like: vmbus:guid |
@@ -819,41 +866,44 @@ ADD_TO_DEVTABLE("virtio", struct virtio_device_id, do_virtio_entry); | |||
819 | * in the name. | 866 | * in the name. |
820 | */ | 867 | */ |
821 | 868 | ||
822 | static int do_vmbus_entry(const char *filename, struct hv_vmbus_device_id *id, | 869 | static int do_vmbus_entry(const char *filename, void *symval, |
823 | char *alias) | 870 | char *alias) |
824 | { | 871 | { |
825 | int i; | 872 | int i; |
826 | char guid_name[((sizeof(id->guid) + 1)) * 2]; | 873 | DEF_FIELD_ADDR(symval, hv_vmbus_device_id, guid); |
874 | char guid_name[(sizeof(*guid) + 1) * 2]; | ||
827 | 875 | ||
828 | for (i = 0; i < (sizeof(id->guid) * 2); i += 2) | 876 | for (i = 0; i < (sizeof(*guid) * 2); i += 2) |
829 | sprintf(&guid_name[i], "%02x", id->guid[i/2]); | 877 | sprintf(&guid_name[i], "%02x", TO_NATIVE((*guid)[i/2])); |
830 | 878 | ||
831 | strcpy(alias, "vmbus:"); | 879 | strcpy(alias, "vmbus:"); |
832 | strcat(alias, guid_name); | 880 | strcat(alias, guid_name); |
833 | 881 | ||
834 | return 1; | 882 | return 1; |
835 | } | 883 | } |
836 | ADD_TO_DEVTABLE("vmbus", struct hv_vmbus_device_id, do_vmbus_entry); | 884 | ADD_TO_DEVTABLE("vmbus", hv_vmbus_device_id, do_vmbus_entry); |
837 | 885 | ||
838 | /* Looks like: i2c:S */ | 886 | /* Looks like: i2c:S */ |
839 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | 887 | static int do_i2c_entry(const char *filename, void *symval, |
840 | char *alias) | 888 | char *alias) |
841 | { | 889 | { |
842 | sprintf(alias, I2C_MODULE_PREFIX "%s", id->name); | 890 | DEF_FIELD_ADDR(symval, i2c_device_id, name); |
891 | sprintf(alias, I2C_MODULE_PREFIX "%s", *name); | ||
843 | 892 | ||
844 | return 1; | 893 | return 1; |
845 | } | 894 | } |
846 | ADD_TO_DEVTABLE("i2c", struct i2c_device_id, do_i2c_entry); | 895 | ADD_TO_DEVTABLE("i2c", i2c_device_id, do_i2c_entry); |
847 | 896 | ||
848 | /* Looks like: spi:S */ | 897 | /* Looks like: spi:S */ |
849 | static int do_spi_entry(const char *filename, struct spi_device_id *id, | 898 | static int do_spi_entry(const char *filename, void *symval, |
850 | char *alias) | 899 | char *alias) |
851 | { | 900 | { |
852 | sprintf(alias, SPI_MODULE_PREFIX "%s", id->name); | 901 | DEF_FIELD_ADDR(symval, spi_device_id, name); |
902 | sprintf(alias, SPI_MODULE_PREFIX "%s", *name); | ||
853 | 903 | ||
854 | return 1; | 904 | return 1; |
855 | } | 905 | } |
856 | ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry); | 906 | ADD_TO_DEVTABLE("spi", spi_device_id, do_spi_entry); |
857 | 907 | ||
858 | static const struct dmifield { | 908 | static const struct dmifield { |
859 | const char *prefix; | 909 | const char *prefix; |
@@ -885,21 +935,21 @@ static void dmi_ascii_filter(char *d, const char *s) | |||
885 | } | 935 | } |
886 | 936 | ||
887 | 937 | ||
888 | static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | 938 | static int do_dmi_entry(const char *filename, void *symval, |
889 | char *alias) | 939 | char *alias) |
890 | { | 940 | { |
891 | int i, j; | 941 | int i, j; |
892 | 942 | DEF_FIELD_ADDR(symval, dmi_system_id, matches); | |
893 | sprintf(alias, "dmi*"); | 943 | sprintf(alias, "dmi*"); |
894 | 944 | ||
895 | for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) { | 945 | for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) { |
896 | for (j = 0; j < 4; j++) { | 946 | for (j = 0; j < 4; j++) { |
897 | if (id->matches[j].slot && | 947 | if ((*matches)[j].slot && |
898 | id->matches[j].slot == dmi_fields[i].field) { | 948 | (*matches)[j].slot == dmi_fields[i].field) { |
899 | sprintf(alias + strlen(alias), ":%s*", | 949 | sprintf(alias + strlen(alias), ":%s*", |
900 | dmi_fields[i].prefix); | 950 | dmi_fields[i].prefix); |
901 | dmi_ascii_filter(alias + strlen(alias), | 951 | dmi_ascii_filter(alias + strlen(alias), |
902 | id->matches[j].substr); | 952 | (*matches)[j].substr); |
903 | strcat(alias, "*"); | 953 | strcat(alias, "*"); |
904 | } | 954 | } |
905 | } | 955 | } |
@@ -908,27 +958,30 @@ static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | |||
908 | strcat(alias, ":"); | 958 | strcat(alias, ":"); |
909 | return 1; | 959 | return 1; |
910 | } | 960 | } |
911 | ADD_TO_DEVTABLE("dmi", struct dmi_system_id, do_dmi_entry); | 961 | ADD_TO_DEVTABLE("dmi", dmi_system_id, do_dmi_entry); |
912 | 962 | ||
913 | static int do_platform_entry(const char *filename, | 963 | static int do_platform_entry(const char *filename, |
914 | struct platform_device_id *id, char *alias) | 964 | void *symval, char *alias) |
915 | { | 965 | { |
916 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", id->name); | 966 | DEF_FIELD_ADDR(symval, platform_device_id, name); |
967 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", *name); | ||
917 | return 1; | 968 | return 1; |
918 | } | 969 | } |
919 | ADD_TO_DEVTABLE("platform", struct platform_device_id, do_platform_entry); | 970 | ADD_TO_DEVTABLE("platform", platform_device_id, do_platform_entry); |
920 | 971 | ||
921 | static int do_mdio_entry(const char *filename, | 972 | static int do_mdio_entry(const char *filename, |
922 | struct mdio_device_id *id, char *alias) | 973 | void *symval, char *alias) |
923 | { | 974 | { |
924 | int i; | 975 | int i; |
976 | DEF_FIELD(symval, mdio_device_id, phy_id); | ||
977 | DEF_FIELD(symval, mdio_device_id, phy_id_mask); | ||
925 | 978 | ||
926 | alias += sprintf(alias, MDIO_MODULE_PREFIX); | 979 | alias += sprintf(alias, MDIO_MODULE_PREFIX); |
927 | 980 | ||
928 | for (i = 0; i < 32; i++) { | 981 | for (i = 0; i < 32; i++) { |
929 | if (!((id->phy_id_mask >> (31-i)) & 1)) | 982 | if (!((phy_id_mask >> (31-i)) & 1)) |
930 | *(alias++) = '?'; | 983 | *(alias++) = '?'; |
931 | else if ((id->phy_id >> (31-i)) & 1) | 984 | else if ((phy_id >> (31-i)) & 1) |
932 | *(alias++) = '1'; | 985 | *(alias++) = '1'; |
933 | else | 986 | else |
934 | *(alias++) = '0'; | 987 | *(alias++) = '0'; |
@@ -939,47 +992,50 @@ static int do_mdio_entry(const char *filename, | |||
939 | 992 | ||
940 | return 1; | 993 | return 1; |
941 | } | 994 | } |
942 | ADD_TO_DEVTABLE("mdio", struct mdio_device_id, do_mdio_entry); | 995 | ADD_TO_DEVTABLE("mdio", mdio_device_id, do_mdio_entry); |
943 | 996 | ||
944 | /* Looks like: zorro:iN. */ | 997 | /* Looks like: zorro:iN. */ |
945 | static int do_zorro_entry(const char *filename, struct zorro_device_id *id, | 998 | static int do_zorro_entry(const char *filename, void *symval, |
946 | char *alias) | 999 | char *alias) |
947 | { | 1000 | { |
948 | id->id = TO_NATIVE(id->id); | 1001 | DEF_FIELD(symval, zorro_device_id, id); |
949 | strcpy(alias, "zorro:"); | 1002 | strcpy(alias, "zorro:"); |
950 | ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id); | 1003 | ADD(alias, "i", id != ZORRO_WILDCARD, id); |
951 | return 1; | 1004 | return 1; |
952 | } | 1005 | } |
953 | ADD_TO_DEVTABLE("zorro", struct zorro_device_id, do_zorro_entry); | 1006 | ADD_TO_DEVTABLE("zorro", zorro_device_id, do_zorro_entry); |
954 | 1007 | ||
955 | /* looks like: "pnp:dD" */ | 1008 | /* looks like: "pnp:dD" */ |
956 | static int do_isapnp_entry(const char *filename, | 1009 | static int do_isapnp_entry(const char *filename, |
957 | struct isapnp_device_id *id, char *alias) | 1010 | void *symval, char *alias) |
958 | { | 1011 | { |
1012 | DEF_FIELD(symval, isapnp_device_id, vendor); | ||
1013 | DEF_FIELD(symval, isapnp_device_id, function); | ||
959 | sprintf(alias, "pnp:d%c%c%c%x%x%x%x*", | 1014 | sprintf(alias, "pnp:d%c%c%c%x%x%x%x*", |
960 | 'A' + ((id->vendor >> 2) & 0x3f) - 1, | 1015 | 'A' + ((vendor >> 2) & 0x3f) - 1, |
961 | 'A' + (((id->vendor & 3) << 3) | ((id->vendor >> 13) & 7)) - 1, | 1016 | 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, |
962 | 'A' + ((id->vendor >> 8) & 0x1f) - 1, | 1017 | 'A' + ((vendor >> 8) & 0x1f) - 1, |
963 | (id->function >> 4) & 0x0f, id->function & 0x0f, | 1018 | (function >> 4) & 0x0f, function & 0x0f, |
964 | (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f); | 1019 | (function >> 12) & 0x0f, (function >> 8) & 0x0f); |
965 | return 1; | 1020 | return 1; |
966 | } | 1021 | } |
967 | ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry); | 1022 | ADD_TO_DEVTABLE("isapnp", isapnp_device_id, do_isapnp_entry); |
968 | 1023 | ||
969 | /* Looks like: "ipack:fNvNdN". */ | 1024 | /* Looks like: "ipack:fNvNdN". */ |
970 | static int do_ipack_entry(const char *filename, | 1025 | static int do_ipack_entry(const char *filename, |
971 | struct ipack_device_id *id, char *alias) | 1026 | void *symval, char *alias) |
972 | { | 1027 | { |
973 | id->vendor = TO_NATIVE(id->vendor); | 1028 | DEF_FIELD(symval, ipack_device_id, format); |
974 | id->device = TO_NATIVE(id->device); | 1029 | DEF_FIELD(symval, ipack_device_id, vendor); |
1030 | DEF_FIELD(symval, ipack_device_id, device); | ||
975 | strcpy(alias, "ipack:"); | 1031 | strcpy(alias, "ipack:"); |
976 | ADD(alias, "f", id->format != IPACK_ANY_FORMAT, id->format); | 1032 | ADD(alias, "f", format != IPACK_ANY_FORMAT, format); |
977 | ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor); | 1033 | ADD(alias, "v", vendor != IPACK_ANY_ID, vendor); |
978 | ADD(alias, "d", id->device != IPACK_ANY_ID, id->device); | 1034 | ADD(alias, "d", device != IPACK_ANY_ID, device); |
979 | add_wildcard(alias); | 1035 | add_wildcard(alias); |
980 | return 1; | 1036 | return 1; |
981 | } | 1037 | } |
982 | ADD_TO_DEVTABLE("ipack", struct ipack_device_id, do_ipack_entry); | 1038 | ADD_TO_DEVTABLE("ipack", ipack_device_id, do_ipack_entry); |
983 | 1039 | ||
984 | /* | 1040 | /* |
985 | * Append a match expression for a single masked hex digit. | 1041 | * Append a match expression for a single masked hex digit. |
@@ -1030,25 +1086,27 @@ static void append_nibble_mask(char **outp, | |||
1030 | * a ? or [] pattern matching exactly one digit. | 1086 | * a ? or [] pattern matching exactly one digit. |
1031 | */ | 1087 | */ |
1032 | static int do_amba_entry(const char *filename, | 1088 | static int do_amba_entry(const char *filename, |
1033 | struct amba_id *id, char *alias) | 1089 | void *symval, char *alias) |
1034 | { | 1090 | { |
1035 | unsigned int digit; | 1091 | unsigned int digit; |
1036 | char *p = alias; | 1092 | char *p = alias; |
1093 | DEF_FIELD(symval, amba_id, id); | ||
1094 | DEF_FIELD(symval, amba_id, mask); | ||
1037 | 1095 | ||
1038 | if ((id->id & id->mask) != id->id) | 1096 | if ((id & mask) != id) |
1039 | fatal("%s: Masked-off bit(s) of AMBA device ID are non-zero: " | 1097 | fatal("%s: Masked-off bit(s) of AMBA device ID are non-zero: " |
1040 | "id=0x%08X, mask=0x%08X. Please fix this driver.\n", | 1098 | "id=0x%08X, mask=0x%08X. Please fix this driver.\n", |
1041 | filename, id->id, id->mask); | 1099 | filename, id, mask); |
1042 | 1100 | ||
1043 | p += sprintf(alias, "amba:d"); | 1101 | p += sprintf(alias, "amba:d"); |
1044 | for (digit = 0; digit < 8; digit++) | 1102 | for (digit = 0; digit < 8; digit++) |
1045 | append_nibble_mask(&p, | 1103 | append_nibble_mask(&p, |
1046 | (id->id >> (4 * (7 - digit))) & 0xf, | 1104 | (id >> (4 * (7 - digit))) & 0xf, |
1047 | (id->mask >> (4 * (7 - digit))) & 0xf); | 1105 | (mask >> (4 * (7 - digit))) & 0xf); |
1048 | 1106 | ||
1049 | return 1; | 1107 | return 1; |
1050 | } | 1108 | } |
1051 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); | 1109 | ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); |
1052 | 1110 | ||
1053 | /* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* | 1111 | /* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* |
1054 | * All fields are numbers. It would be nicer to use strings for vendor | 1112 | * All fields are numbers. It would be nicer to use strings for vendor |
@@ -1056,24 +1114,24 @@ ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); | |||
1056 | * complicated. | 1114 | * complicated. |
1057 | */ | 1115 | */ |
1058 | 1116 | ||
1059 | static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id, | 1117 | static int do_x86cpu_entry(const char *filename, void *symval, |
1060 | char *alias) | 1118 | char *alias) |
1061 | { | 1119 | { |
1062 | id->feature = TO_NATIVE(id->feature); | 1120 | DEF_FIELD(symval, x86_cpu_id, feature); |
1063 | id->family = TO_NATIVE(id->family); | 1121 | DEF_FIELD(symval, x86_cpu_id, family); |
1064 | id->model = TO_NATIVE(id->model); | 1122 | DEF_FIELD(symval, x86_cpu_id, model); |
1065 | id->vendor = TO_NATIVE(id->vendor); | 1123 | DEF_FIELD(symval, x86_cpu_id, vendor); |
1066 | 1124 | ||
1067 | strcpy(alias, "x86cpu:"); | 1125 | strcpy(alias, "x86cpu:"); |
1068 | ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor); | 1126 | ADD(alias, "vendor:", vendor != X86_VENDOR_ANY, vendor); |
1069 | ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family); | 1127 | ADD(alias, ":family:", family != X86_FAMILY_ANY, family); |
1070 | ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model); | 1128 | ADD(alias, ":model:", model != X86_MODEL_ANY, model); |
1071 | strcat(alias, ":feature:*"); | 1129 | strcat(alias, ":feature:*"); |
1072 | if (id->feature != X86_FEATURE_ANY) | 1130 | if (feature != X86_FEATURE_ANY) |
1073 | sprintf(alias + strlen(alias), "%04X*", id->feature); | 1131 | sprintf(alias + strlen(alias), "%04X*", feature); |
1074 | return 1; | 1132 | return 1; |
1075 | } | 1133 | } |
1076 | ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry); | 1134 | ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); |
1077 | 1135 | ||
1078 | /* Does namelen bytes of name exactly match the symbol? */ | 1136 | /* Does namelen bytes of name exactly match the symbol? */ |
1079 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1137 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index ff36c508a10e..78b30c1548e9 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -830,6 +830,8 @@ static const char *section_white_list[] = | |||
830 | ".toc*", | 830 | ".toc*", |
831 | ".xt.prop", /* xtensa */ | 831 | ".xt.prop", /* xtensa */ |
832 | ".xt.lit", /* xtensa */ | 832 | ".xt.lit", /* xtensa */ |
833 | ".arcextmap*", /* arc */ | ||
834 | ".gnu.linkonce.arcext*", /* arc : modules */ | ||
833 | NULL | 835 | NULL |
834 | }; | 836 | }; |
835 | 837 | ||
@@ -2126,7 +2128,7 @@ int main(int argc, char **argv) | |||
2126 | struct ext_sym_list *extsym_iter; | 2128 | struct ext_sym_list *extsym_iter; |
2127 | struct ext_sym_list *extsym_start = NULL; | 2129 | struct ext_sym_list *extsym_start = NULL; |
2128 | 2130 | ||
2129 | while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) { | 2131 | while ((opt = getopt(argc, argv, "i:I:e:msSo:awM:K:")) != -1) { |
2130 | switch (opt) { | 2132 | switch (opt) { |
2131 | case 'i': | 2133 | case 'i': |
2132 | kernel_read = optarg; | 2134 | kernel_read = optarg; |
@@ -2135,9 +2137,6 @@ int main(int argc, char **argv) | |||
2135 | module_read = optarg; | 2137 | module_read = optarg; |
2136 | external_module = 1; | 2138 | external_module = 1; |
2137 | break; | 2139 | break; |
2138 | case 'c': | ||
2139 | cross_build = 1; | ||
2140 | break; | ||
2141 | case 'e': | 2140 | case 'e': |
2142 | external_module = 1; | 2141 | external_module = 1; |
2143 | extsym_iter = | 2142 | extsym_iter = |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 4bf17ddf7c7f..fbbfd08853d3 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -95,7 +95,7 @@ echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | |||
95 | echo "%endif" | 95 | echo "%endif" |
96 | echo "%endif" | 96 | echo "%endif" |
97 | 97 | ||
98 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install' | 98 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' |
99 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 99 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
100 | 100 | ||
101 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 101 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index bd6dca8a0ab2..84b88f109b80 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -108,7 +108,7 @@ scm_version() | |||
108 | fi | 108 | fi |
109 | 109 | ||
110 | # Check for svn and a svn repo. | 110 | # Check for svn and a svn repo. |
111 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then | 111 | if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
112 | rev=`echo $rev | awk '{print $NF}'` | 112 | rev=`echo $rev | awk '{print $NF}'` |
113 | printf -- '-svn%s' "$rev" | 113 | printf -- '-svn%s' "$rev" |
114 | 114 | ||
diff --git a/scripts/sign-file b/scripts/sign-file index 974a20b661b7..2b7c4484d46c 100755 --- a/scripts/sign-file +++ b/scripts/sign-file | |||
@@ -2,51 +2,45 @@ | |||
2 | # | 2 | # |
3 | # Sign a module file using the given key. | 3 | # Sign a module file using the given key. |
4 | # | 4 | # |
5 | # Format: | 5 | |
6 | # | 6 | my $USAGE = |
7 | # ./scripts/sign-file [-v] <key> <x509> <module> [<dest>] | 7 | "Usage: scripts/sign-file [-v] <hash algo> <key> <x509> <module> [<dest>]\n" . |
8 | # | 8 | " scripts/sign-file [-v] -s <raw sig> <hash algo> <x509> <module> [<dest>]\n"; |
9 | # | 9 | |
10 | use strict; | 10 | use strict; |
11 | use FileHandle; | 11 | use FileHandle; |
12 | use IPC::Open2; | 12 | use IPC::Open2; |
13 | use Getopt::Std; | ||
13 | 14 | ||
14 | my $verbose = 0; | 15 | my %opts; |
15 | if ($#ARGV >= 0 && $ARGV[0] eq "-v") { | 16 | getopts('vs:', \%opts) or die $USAGE; |
16 | $verbose = 1; | 17 | my $verbose = $opts{'v'}; |
17 | shift; | 18 | my $signature_file = $opts{'s'}; |
18 | } | ||
19 | 19 | ||
20 | die "Format: ./scripts/sign-file [-v] <key> <x509> <module> [<dest>]\n" | 20 | die $USAGE if ($#ARGV > 4); |
21 | if ($#ARGV != 2 && $#ARGV != 3); | 21 | die $USAGE if (!$signature_file && $#ARGV < 3 || $signature_file && $#ARGV < 2); |
22 | 22 | ||
23 | my $private_key = $ARGV[0]; | 23 | my $dgst = shift @ARGV; |
24 | my $x509 = $ARGV[1]; | 24 | my $private_key; |
25 | my $module = $ARGV[2]; | 25 | if (!$signature_file) { |
26 | my $dest = ($#ARGV == 3) ? $ARGV[3] : $ARGV[2] . "~"; | 26 | $private_key = shift @ARGV; |
27 | } | ||
28 | my $x509 = shift @ARGV; | ||
29 | my $module = shift @ARGV; | ||
30 | my ($dest, $keep_orig); | ||
31 | if (@ARGV) { | ||
32 | $dest = $ARGV[0]; | ||
33 | $keep_orig = 1; | ||
34 | } else { | ||
35 | $dest = $module . "~"; | ||
36 | } | ||
27 | 37 | ||
28 | die "Can't read private key\n" unless (-r $private_key); | 38 | die "Can't read private key\n" if (!$signature_file && !-r $private_key); |
39 | die "Can't read signature file\n" if ($signature_file && !-r $signature_file); | ||
29 | die "Can't read X.509 certificate\n" unless (-r $x509); | 40 | die "Can't read X.509 certificate\n" unless (-r $x509); |
30 | die "Can't read module\n" unless (-r $module); | 41 | die "Can't read module\n" unless (-r $module); |
31 | 42 | ||
32 | # | 43 | # |
33 | # Read the kernel configuration | ||
34 | # | ||
35 | my %config = ( | ||
36 | CONFIG_MODULE_SIG_SHA512 => 1 | ||
37 | ); | ||
38 | |||
39 | if (-r ".config") { | ||
40 | open(FD, "<.config") || die ".config"; | ||
41 | while (<FD>) { | ||
42 | if ($_ =~ /^(CONFIG_.*)=[ym]/) { | ||
43 | $config{$1} = 1; | ||
44 | } | ||
45 | } | ||
46 | close(FD); | ||
47 | } | ||
48 | |||
49 | # | ||
50 | # Function to read the contents of a file into a variable. | 44 | # Function to read the contents of a file into a variable. |
51 | # | 45 | # |
52 | sub read_file($) | 46 | sub read_file($) |
@@ -321,73 +315,71 @@ my $id_type = 1; # Identifier type: X.509 | |||
321 | # | 315 | # |
322 | # Digest the data | 316 | # Digest the data |
323 | # | 317 | # |
324 | my ($dgst, $prologue) = (); | 318 | my $prologue; |
325 | if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) { | 319 | if ($dgst eq "sha1") { |
326 | $prologue = pack("C*", | 320 | $prologue = pack("C*", |
327 | 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, | 321 | 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, |
328 | 0x2B, 0x0E, 0x03, 0x02, 0x1A, | 322 | 0x2B, 0x0E, 0x03, 0x02, 0x1A, |
329 | 0x05, 0x00, 0x04, 0x14); | 323 | 0x05, 0x00, 0x04, 0x14); |
330 | $dgst = "-sha1"; | ||
331 | $hash = 2; | 324 | $hash = 2; |
332 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA224"}) { | 325 | } elsif ($dgst eq "sha224") { |
333 | $prologue = pack("C*", | 326 | $prologue = pack("C*", |
334 | 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, | 327 | 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, |
335 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, | 328 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, |
336 | 0x05, 0x00, 0x04, 0x1C); | 329 | 0x05, 0x00, 0x04, 0x1C); |
337 | $dgst = "-sha224"; | ||
338 | $hash = 7; | 330 | $hash = 7; |
339 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA256"}) { | 331 | } elsif ($dgst eq "sha256") { |
340 | $prologue = pack("C*", | 332 | $prologue = pack("C*", |
341 | 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, | 333 | 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, |
342 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, | 334 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, |
343 | 0x05, 0x00, 0x04, 0x20); | 335 | 0x05, 0x00, 0x04, 0x20); |
344 | $dgst = "-sha256"; | ||
345 | $hash = 4; | 336 | $hash = 4; |
346 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA384"}) { | 337 | } elsif ($dgst eq "sha384") { |
347 | $prologue = pack("C*", | 338 | $prologue = pack("C*", |
348 | 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, | 339 | 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, |
349 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, | 340 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, |
350 | 0x05, 0x00, 0x04, 0x30); | 341 | 0x05, 0x00, 0x04, 0x30); |
351 | $dgst = "-sha384"; | ||
352 | $hash = 5; | 342 | $hash = 5; |
353 | } elsif (exists $config{"CONFIG_MODULE_SIG_SHA512"}) { | 343 | } elsif ($dgst eq "sha512") { |
354 | $prologue = pack("C*", | 344 | $prologue = pack("C*", |
355 | 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, | 345 | 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, |
356 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, | 346 | 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, |
357 | 0x05, 0x00, 0x04, 0x40); | 347 | 0x05, 0x00, 0x04, 0x40); |
358 | $dgst = "-sha512"; | ||
359 | $hash = 6; | 348 | $hash = 6; |
360 | } else { | 349 | } else { |
361 | die "Can't determine hash algorithm"; | 350 | die "Unknown hash algorithm: $dgst\n"; |
362 | } | 351 | } |
363 | 352 | ||
364 | # | ||
365 | # Generate the digest and read from openssl's stdout | ||
366 | # | ||
367 | my $digest; | ||
368 | $digest = readpipe("openssl dgst $dgst -binary $module") || die "openssl dgst"; | ||
369 | |||
370 | # | ||
371 | # Generate the binary signature, which will be just the integer that comprises | ||
372 | # the signature with no metadata attached. | ||
373 | # | ||
374 | my $pid; | ||
375 | $pid = open2(*read_from, *write_to, | ||
376 | "openssl rsautl -sign -inkey $private_key -keyform PEM") || | ||
377 | die "openssl rsautl"; | ||
378 | binmode write_to; | ||
379 | print write_to $prologue . $digest || die "pipe to openssl rsautl"; | ||
380 | close(write_to) || die "pipe to openssl rsautl"; | ||
381 | |||
382 | binmode read_from; | ||
383 | my $signature; | 353 | my $signature; |
384 | read(read_from, $signature, 4096) || die "pipe from openssl rsautl"; | 354 | if ($signature_file) { |
385 | close(read_from) || die "pipe from openssl rsautl"; | 355 | $signature = read_file($signature_file); |
356 | } else { | ||
357 | # | ||
358 | # Generate the digest and read from openssl's stdout | ||
359 | # | ||
360 | my $digest; | ||
361 | $digest = readpipe("openssl dgst -$dgst -binary $module") || die "openssl dgst"; | ||
362 | |||
363 | # | ||
364 | # Generate the binary signature, which will be just the integer that | ||
365 | # comprises the signature with no metadata attached. | ||
366 | # | ||
367 | my $pid; | ||
368 | $pid = open2(*read_from, *write_to, | ||
369 | "openssl rsautl -sign -inkey $private_key -keyform PEM") || | ||
370 | die "openssl rsautl"; | ||
371 | binmode write_to; | ||
372 | print write_to $prologue . $digest || die "pipe to openssl rsautl"; | ||
373 | close(write_to) || die "pipe to openssl rsautl"; | ||
374 | |||
375 | binmode read_from; | ||
376 | read(read_from, $signature, 4096) || die "pipe from openssl rsautl"; | ||
377 | close(read_from) || die "pipe from openssl rsautl"; | ||
378 | waitpid($pid, 0) || die; | ||
379 | die "openssl rsautl died: $?" if ($? >> 8); | ||
380 | } | ||
386 | $signature = pack("n", length($signature)) . $signature, | 381 | $signature = pack("n", length($signature)) . $signature, |
387 | 382 | ||
388 | waitpid($pid, 0) || die; | ||
389 | die "openssl rsautl died: $?" if ($? >> 8); | ||
390 | |||
391 | # | 383 | # |
392 | # Build the signed binary | 384 | # Build the signed binary |
393 | # | 385 | # |
@@ -424,6 +416,6 @@ print FD | |||
424 | ; | 416 | ; |
425 | close FD || die $dest; | 417 | close FD || die $dest; |
426 | 418 | ||
427 | if ($#ARGV != 3) { | 419 | if (!$keep_orig) { |
428 | rename($dest, $module) || die $module; | 420 | rename($dest, $module) || die $module; |
429 | } | 421 | } |
diff --git a/scripts/sortextable.h b/scripts/sortextable.h index e4fd45b7e456..f5eb43d42926 100644 --- a/scripts/sortextable.h +++ b/scripts/sortextable.h | |||
@@ -182,7 +182,7 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) | |||
182 | _r(&sort_needed_sym->st_value) - | 182 | _r(&sort_needed_sym->st_value) - |
183 | _r(&sort_needed_sec->sh_addr); | 183 | _r(&sort_needed_sec->sh_addr); |
184 | 184 | ||
185 | #if 1 | 185 | #if 0 |
186 | printf("sort done marker at %lx\n", | 186 | printf("sort done marker at %lx\n", |
187 | (unsigned long)((char *)sort_done_location - (char *)ehdr)); | 187 | (unsigned long)((char *)sort_done_location - (char *)ehdr)); |
188 | #endif | 188 | #endif |
diff --git a/scripts/tags.sh b/scripts/tags.sh index 08f06c00745e..26a87e68afed 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -149,12 +149,17 @@ dogtags() | |||
149 | exuberant() | 149 | exuberant() |
150 | { | 150 | { |
151 | all_target_sources | xargs $1 -a \ | 151 | all_target_sources | xargs $1 -a \ |
152 | -I __initdata,__exitdata,__acquires,__releases \ | 152 | -I __initdata,__exitdata,__initconst,__devinitdata \ |
153 | -I __read_mostly,____cacheline_aligned \ | 153 | -I __devinitconst,__cpuinitdata,__initdata_memblock \ |
154 | -I __refdata,__attribute \ | ||
155 | -I __acquires,__releases,__deprecated \ | ||
156 | -I __read_mostly,__aligned,____cacheline_aligned \ | ||
154 | -I ____cacheline_aligned_in_smp \ | 157 | -I ____cacheline_aligned_in_smp \ |
155 | -I ____cacheline_internodealigned_in_smp \ | 158 | -I ____cacheline_internodealigned_in_smp \ |
159 | -I __used,__packed,__packed2__,__must_check,__must_hold \ | ||
156 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 160 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
157 | -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ | 161 | -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ |
162 | -I static,const \ | ||
158 | --extra=+f --c-kinds=+px \ | 163 | --extra=+f --c-kinds=+px \ |
159 | --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \ | 164 | --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \ |
160 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ | 165 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ |
@@ -182,8 +187,19 @@ exuberant() | |||
182 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ | 187 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ |
183 | --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ | 188 | --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ |
184 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ | 189 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ |
185 | --regex-c='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ | 190 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ |
186 | --regex-c='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' | 191 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ |
192 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ | ||
193 | --regex-c='/DEFINE_(RAW_SPINLOCK|RWLOCK|SEQLOCK)\((\w*)/\2/v/' \ | ||
194 | --regex-c='/DECLARE_(RWSEM|COMPLETION)\((\w*)/\2/v/' \ | ||
195 | --regex-c='/DECLARE_BITMAP\((\w*)/\1/v/' \ | ||
196 | --regex-c='/(^|\s)(|L|H)LIST_HEAD\((\w*)/\3/v/' \ | ||
197 | --regex-c='/(^|\s)RADIX_TREE\((\w*)/\2/v/' \ | ||
198 | --regex-c='/DEFINE_PER_CPU\(([^,]*,\s*)(\w*).*\)/\2/v/' \ | ||
199 | --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \ | ||
200 | --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \ | ||
201 | --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ | ||
202 | --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' | ||
187 | 203 | ||
188 | all_kconfigs | xargs $1 -a \ | 204 | all_kconfigs | xargs $1 -a \ |
189 | --langdef=kconfig --language-force=kconfig \ | 205 | --langdef=kconfig --language-force=kconfig \ |
@@ -201,34 +217,34 @@ exuberant() | |||
201 | emacs() | 217 | emacs() |
202 | { | 218 | { |
203 | all_target_sources | xargs $1 -a \ | 219 | all_target_sources | xargs $1 -a \ |
204 | --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \ | 220 | --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \ |
205 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ | 221 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ |
206 | --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ | 222 | --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ |
207 | --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \ | 223 | --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \ |
208 | --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \ | 224 | --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/' \ |
209 | --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \ | 225 | --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \ |
210 | --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \ | 226 | --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \ |
211 | --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \ | 227 | --regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/' \ |
212 | --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \ | 228 | --regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/' \ |
213 | --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \ | 229 | --regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/' \ |
214 | --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \ | 230 | --regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/' \ |
215 | --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ | 231 | --regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \ |
216 | --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ | 232 | --regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \ |
217 | --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \ | 233 | --regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/' \ |
218 | --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ | 234 | --regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \ |
219 | --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \ | 235 | --regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \ |
220 | --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ | 236 | --regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \ |
221 | --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \ | 237 | --regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/' \ |
222 | --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \ | 238 | --regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/' \ |
223 | --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \ | 239 | --regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \ |
224 | --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \ | 240 | --regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \ |
225 | --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ | 241 | --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \ |
226 | --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ | 242 | --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ |
227 | --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ | 243 | --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ |
228 | --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ | 244 | --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ |
229 | --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ | 245 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ |
230 | --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ | 246 | --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ |
231 | --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' | 247 | --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/' |
232 | 248 | ||
233 | all_kconfigs | xargs $1 -a \ | 249 | all_kconfigs | xargs $1 -a \ |
234 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 250 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |