aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-11-23 03:04:05 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-11-23 03:04:05 -0500
commit92907cbbef8625bb3998d1eb385fc88f23c97a3f (patch)
tree15626ff9287e37c3cb81c7286d6db5a7fd77c854 /scripts
parent15fbfccfe92c62ae8d1ecc647c44157ed01ac02e (diff)
parent1ec218373b8ebda821aec00bb156a9c94fad9cd4 (diff)
Merge tag 'v4.4-rc2' into drm-intel-next-queued
Linux 4.4-rc2 Backmerge to get at commit 1b0e3a049efe471c399674fd954500ce97438d30 Author: Imre Deak <imre.deak@intel.com> Date: Thu Nov 5 23:04:11 2015 +0200 drm/i915/skl: disable display side power well support for now so that we can proplery re-eanble skl power wells in -next. Conflicts are just adjacent lines changed, except for intel_fbdev.c where we need to interleave the changs. Nothing nefarious. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile7
-rw-r--r--scripts/Makefile.kasan4
-rw-r--r--scripts/Makefile.modpost1
-rw-r--r--scripts/check-lc_ctype.c11
-rwxr-xr-xscripts/checkpatch.pl66
-rwxr-xr-xscripts/coccicheck2
-rw-r--r--scripts/coccinelle/free/ifnullfree.cocci26
-rw-r--r--scripts/coccinelle/iterators/device_node_continue.cocci100
-rw-r--r--scripts/coccinelle/misc/compare_const_fl.cocci171
-rw-r--r--scripts/coccinelle/misc/of_table.cocci33
-rw-r--r--scripts/coccinelle/misc/simple_return.cocci180
-rw-r--r--scripts/coccinelle/null/deref_null.cocci4
-rw-r--r--scripts/coccinelle/tests/odd_ptr_err.cocci120
-rw-r--r--scripts/extract-cert.c4
-rwxr-xr-xscripts/extract-module-sig.pl136
-rwxr-xr-xscripts/extract-sys-certs.pl144
-rwxr-xr-xscripts/get_maintainer.pl37
-rw-r--r--scripts/kconfig/Makefile61
-rw-r--r--scripts/kconfig/expr.c2
-rwxr-xr-xscripts/kconfig/merge_config.sh18
-rw-r--r--scripts/kconfig/qconf.cc688
-rw-r--r--scripts/kconfig/qconf.h150
-rw-r--r--scripts/kconfig/symbol.c2
-rwxr-xr-xscripts/kernel-doc144
-rw-r--r--scripts/mod/devicetable-offsets.c6
-rw-r--r--scripts/mod/file2alias.c29
-rw-r--r--scripts/mod/modpost.c37
-rwxr-xr-xscripts/package/builddeb15
-rw-r--r--scripts/recordmcount.c26
-rw-r--r--scripts/recordmcount.h2
-rwxr-xr-xscripts/sign-file.c94
-rwxr-xr-xscripts/tags.sh2
-rwxr-xr-xscripts/ver_linux223
34 files changed, 1673 insertions, 873 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 12efbbefd4d7..1f78169d4254 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -8,6 +8,7 @@ unifdef
8ihex2fw 8ihex2fw
9recordmcount 9recordmcount
10docproc 10docproc
11check-lc_ctype
11sortextable 12sortextable
12asn1_compiler 13asn1_compiler
13extract-cert 14extract-cert
diff --git a/scripts/Makefile b/scripts/Makefile
index 1b2661712d44..fd0d53d4a234 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -7,6 +7,7 @@
7# conmakehash: Create chartable 7# conmakehash: Create chartable
8# conmakehash: Create arrays for initializing the kernel console tables 8# conmakehash: Create arrays for initializing the kernel console tables
9# docproc: Used in Documentation/DocBook 9# docproc: Used in Documentation/DocBook
10# check-lc_ctype: Used in Documentation/DocBook
10 11
11HOST_EXTRACFLAGS += -I$(srctree)/tools/include 12HOST_EXTRACFLAGS += -I$(srctree)/tools/include
12 13
@@ -27,14 +28,16 @@ HOSTLOADLIBES_extract-cert = -lcrypto
27always := $(hostprogs-y) $(hostprogs-m) 28always := $(hostprogs-y) $(hostprogs-m)
28 29
29# The following hostprogs-y programs are only build on demand 30# The following hostprogs-y programs are only build on demand
30hostprogs-y += unifdef docproc 31hostprogs-y += unifdef docproc check-lc_ctype
31 32
32# These targets are used internally to avoid "is up to date" messages 33# These targets are used internally to avoid "is up to date" messages
33PHONY += build_unifdef build_docproc 34PHONY += build_unifdef build_docproc build_check-lc_ctype
34build_unifdef: $(obj)/unifdef 35build_unifdef: $(obj)/unifdef
35 @: 36 @:
36build_docproc: $(obj)/docproc 37build_docproc: $(obj)/docproc
37 @: 38 @:
39build_check-lc_ctype: $(obj)/check-lc_ctype
40 @:
38 41
39subdir-$(CONFIG_MODVERSIONS) += genksyms 42subdir-$(CONFIG_MODVERSIONS) += genksyms
40subdir-y += mod 43subdir-y += mod
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 3f874d24234f..37323b0df374 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -5,10 +5,12 @@ else
5 call_threshold := 0 5 call_threshold := 0
6endif 6endif
7 7
8KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
9
8CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address 10CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
9 11
10CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ 12CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
11 -fasan-shadow-offset=$(CONFIG_KASAN_SHADOW_OFFSET) \ 13 -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
12 --param asan-stack=1 --param asan-globals=1 \ 14 --param asan-stack=1 --param asan-globals=1 \
13 --param asan-instrumentation-with-call-threshold=$(call_threshold)) 15 --param asan-instrumentation-with-call-threshold=$(call_threshold))
14 16
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 69f0a1417e9a..1366a94b6c39 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -77,6 +77,7 @@ modpost = scripts/mod/modpost \
77 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ 77 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
78 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 78 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
80 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 81 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
81 82
82MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) 83MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
diff --git a/scripts/check-lc_ctype.c b/scripts/check-lc_ctype.c
new file mode 100644
index 000000000000..9097ff5449fb
--- /dev/null
+++ b/scripts/check-lc_ctype.c
@@ -0,0 +1,11 @@
1/*
2 * Check that a specified locale works as LC_CTYPE. Used by the
3 * DocBook build system to probe for C.UTF-8 support.
4 */
5
6#include <locale.h>
7
8int main(void)
9{
10 return !setlocale(LC_CTYPE, "");
11}
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f2a1131b2f8b..2b3c22808c3b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -370,6 +370,8 @@ our $typeTypedefs = qr{(?x:
370 $typeKernelTypedefs\b 370 $typeKernelTypedefs\b
371)}; 371)};
372 372
373our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
374
373our $logFunctions = qr{(?x: 375our $logFunctions = qr{(?x:
374 printk(?:_ratelimited|_once|)| 376 printk(?:_ratelimited|_once|)|
375 (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| 377 (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
@@ -2313,42 +2315,43 @@ sub process {
2313 "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); 2315 "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);
2314 } 2316 }
2315 2317
2318# Check if the commit log is in a possible stack dump
2319 if ($in_commit_log && !$commit_log_possible_stack_dump &&
2320 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
2321 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
2322 # timestamp
2323 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) {
2324 # stack dump address
2325 $commit_log_possible_stack_dump = 1;
2326 }
2327
2316# Check for line lengths > 75 in commit log, warn once 2328# Check for line lengths > 75 in commit log, warn once
2317 if ($in_commit_log && !$commit_log_long_line && 2329 if ($in_commit_log && !$commit_log_long_line &&
2318 length($line) > 75 && 2330 length($line) > 75 &&
2319 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ || 2331 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
2320 # file delta changes 2332 # file delta changes
2321 $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ || 2333 $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ ||
2322 # filename then : 2334 # filename then :
2323 $line =~ /^\s*(?:Fixes:|Link:)/i || 2335 $line =~ /^\s*(?:Fixes:|Link:)/i ||
2324 # A Fixes: or Link: line 2336 # A Fixes: or Link: line
2325 $commit_log_possible_stack_dump)) { 2337 $commit_log_possible_stack_dump)) {
2326 WARN("COMMIT_LOG_LONG_LINE", 2338 WARN("COMMIT_LOG_LONG_LINE",
2327 "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); 2339 "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
2328 $commit_log_long_line = 1; 2340 $commit_log_long_line = 1;
2329 } 2341 }
2330 2342
2331# Check if the commit log is in a possible stack dump
2332 if ($in_commit_log && !$commit_log_possible_stack_dump &&
2333 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
2334 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
2335 # timestamp
2336 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) {
2337 # stack dump address
2338 $commit_log_possible_stack_dump = 1;
2339 }
2340
2341# Reset possible stack dump if a blank line is found 2343# Reset possible stack dump if a blank line is found
2342 if ($in_commit_log && $commit_log_possible_stack_dump && 2344 if ($in_commit_log && $commit_log_possible_stack_dump &&
2343 $line =~ /^\s*$/) { 2345 $line =~ /^\s*$/) {
2344 $commit_log_possible_stack_dump = 0; 2346 $commit_log_possible_stack_dump = 0;
2345 } 2347 }
2346 2348
2347# Check for git id commit length and improperly formed commit descriptions 2349# Check for git id commit length and improperly formed commit descriptions
2348 if ($in_commit_log && 2350 if ($in_commit_log && !$commit_log_possible_stack_dump &&
2349 ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || 2351 ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
2350 ($line =~ /\b[0-9a-f]{12,40}\b/i && 2352 ($line =~ /\b[0-9a-f]{12,40}\b/i &&
2351 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { 2353 $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
2354 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
2352 my $init_char = "c"; 2355 my $init_char = "c";
2353 my $orig_commit = ""; 2356 my $orig_commit = "";
2354 my $short = 1; 2357 my $short = 1;
@@ -3333,21 +3336,20 @@ sub process {
3333 } 3336 }
3334 3337
3335# check for global initialisers. 3338# check for global initialisers.
3336 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) { 3339 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/) {
3337 if (ERROR("GLOBAL_INITIALISERS", 3340 if (ERROR("GLOBAL_INITIALISERS",
3338 "do not initialise globals to 0 or NULL\n" . 3341 "do not initialise globals to $1\n" . $herecurr) &&
3339 $herecurr) &&
3340 $fix) { 3342 $fix) {
3341 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/; 3343 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*$zero_initializer\s*;/$1;/;
3342 } 3344 }
3343 } 3345 }
3344# check for static initialisers. 3346# check for static initialisers.
3345 if ($line =~ /^\+.*\bstatic\s.*=\s*(0|NULL|false)\s*;/) { 3347 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
3346 if (ERROR("INITIALISED_STATIC", 3348 if (ERROR("INITIALISED_STATIC",
3347 "do not initialise statics to 0 or NULL\n" . 3349 "do not initialise statics to $1\n" .
3348 $herecurr) && 3350 $herecurr) &&
3349 $fix) { 3351 $fix) {
3350 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*(0|NULL|false)\s*;/$1;/; 3352 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*$zero_initializer\s*;/$1;/;
3351 } 3353 }
3352 } 3354 }
3353 3355
diff --git a/scripts/coccicheck b/scripts/coccicheck
index bbf901afb606..b2d758188f2f 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -30,7 +30,7 @@ FLAGS="$SPFLAGS --very-quiet"
30# spatch only allows include directories with the syntax "-I include" 30# spatch only allows include directories with the syntax "-I include"
31# while gcc also allows "-Iinclude" and "-include include" 31# while gcc also allows "-Iinclude" and "-include include"
32COCCIINCLUDE=${LINUXINCLUDE//-I/-I } 32COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
33COCCIINCLUDE=${COCCIINCLUDE//-include/-I} 33COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
34 34
35if [ "$C" = "1" -o "$C" = "2" ]; then 35if [ "$C" = "1" -o "$C" = "2" ]; then
36 ONLINE=1 36 ONLINE=1
diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
index a42d70bf88b3..52bd235286fa 100644
--- a/scripts/coccinelle/free/ifnullfree.cocci
+++ b/scripts/coccinelle/free/ifnullfree.cocci
@@ -16,19 +16,21 @@ virtual context
16@r2 depends on patch@ 16@r2 depends on patch@
17expression E; 17expression E;
18@@ 18@@
19- if (E) 19- if (E != NULL)
20( 20(
21- kfree(E); 21 kfree(E);
22+ kfree(E);
23| 22|
24- debugfs_remove(E); 23 debugfs_remove(E);
25+ debugfs_remove(E);
26| 24|
27- debugfs_remove_recursive(E); 25 debugfs_remove_recursive(E);
28+ debugfs_remove_recursive(E);
29| 26|
30- usb_free_urb(E); 27 usb_free_urb(E);
31+ usb_free_urb(E); 28|
29 kmem_cache_destroy(E);
30|
31 mempool_destroy(E);
32|
33 dma_pool_destroy(E);
32) 34)
33 35
34@r depends on context || report || org @ 36@r depends on context || report || org @
@@ -36,8 +38,10 @@ expression E;
36position p; 38position p;
37@@ 39@@
38 40
39* if (E) 41* if (E != NULL)
40* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E); 42* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
43* usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
44* dma_pool_destroy@p\)(E);
41 45
42@script:python depends on org@ 46@script:python depends on org@
43p << r.p; 47p << r.p;
diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci
new file mode 100644
index 000000000000..38ab744a4037
--- /dev/null
+++ b/scripts/coccinelle/iterators/device_node_continue.cocci
@@ -0,0 +1,100 @@
1/// Device node iterators put the previous value of the index variable, so an
2/// explicit put causes a double put.
3///
4// Confidence: High
5// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
6// URL: http://coccinelle.lip6.fr/
7// Options: --no-includes --include-headers
8// Keywords: for_each_child_of_node, etc.
9
10virtual patch
11virtual context
12virtual org
13virtual report
14
15@r exists@
16expression e1,e2;
17local idexpression n;
18iterator name for_each_node_by_name, for_each_node_by_type,
19for_each_compatible_node, for_each_matching_node,
20for_each_matching_node_and_match, for_each_child_of_node,
21for_each_available_child_of_node, for_each_node_with_property;
22iterator i;
23position p1,p2;
24statement S;
25@@
26
27(
28(
29for_each_node_by_name(n,e1) S
30|
31for_each_node_by_type(n,e1) S
32|
33for_each_compatible_node(n,e1,e2) S
34|
35for_each_matching_node(n,e1) S
36|
37for_each_matching_node_and_match(n,e1,e2) S
38|
39for_each_child_of_node(e1,n) S
40|
41for_each_available_child_of_node(e1,n) S
42|
43for_each_node_with_property(n,e1) S
44)
45&
46i@p1(...) {
47 ... when != of_node_get(n)
48 when any
49 of_node_put@p2(n);
50 ... when any
51}
52)
53
54@s exists@
55local idexpression r.n;
56statement S;
57position r.p1,r.p2;
58iterator i;
59@@
60
61 of_node_put@p2(n);
62 ... when any
63 i@p1(..., n, ...)
64 S
65
66@t depends on s && patch && !context && !org && !report@
67local idexpression n;
68position r.p2;
69@@
70
71- of_node_put@p2(n);
72
73// ----------------------------------------------------------------------------
74
75@t_context depends on s && !patch && (context || org || report)@
76local idexpression n;
77position r.p2;
78position j0;
79@@
80
81* of_node_put@j0@p2(n);
82
83// ----------------------------------------------------------------------------
84
85@script:python t_org depends on org@
86j0 << t_context.j0;
87@@
88
89msg = "ERROR: probable double put."
90coccilib.org.print_todo(j0[0], msg)
91
92// ----------------------------------------------------------------------------
93
94@script:python t_report depends on report@
95j0 << t_context.j0;
96@@
97
98msg = "ERROR: probable double put."
99coccilib.report.print_report(j0[0], msg)
100
diff --git a/scripts/coccinelle/misc/compare_const_fl.cocci b/scripts/coccinelle/misc/compare_const_fl.cocci
new file mode 100644
index 000000000000..b5d4bab60263
--- /dev/null
+++ b/scripts/coccinelle/misc/compare_const_fl.cocci
@@ -0,0 +1,171 @@
1/// Move constants to the right of binary operators.
2//# Depends on personal taste in some cases.
3///
4// Confidence: Moderate
5// Copyright: (C) 2015 Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
6// URL: http://coccinelle.lip6.fr/
7// Options: --no-includes --include-headers
8
9virtual patch
10virtual context
11virtual org
12virtual report
13
14@r1 depends on patch && !context && !org && !report
15 disable bitor_comm, neg_if_exp@
16constant c,c1;
17local idexpression i;
18expression e,e1,e2;
19binary operator b = {==,!=,&,|};
20type t;
21@@
22
23(
24c b (c1)
25|
26sizeof(t) b e1
27|
28sizeof e b e1
29|
30i b e1
31|
32c | e1 | e2 | ...
33|
34c | (e ? e1 : e2)
35|
36- c
37+ e
38b
39- e
40+ c
41)
42
43@r2 depends on patch && !context && !org && !report
44 disable gtr_lss, gtr_lss_eq, not_int2@
45constant c,c1;
46expression e,e1,e2;
47binary operator b;
48binary operator b1 = {<,<=},b2 = {<,<=};
49binary operator b3 = {>,>=},b4 = {>,>=};
50local idexpression i;
51type t;
52@@
53
54(
55c b c1
56|
57sizeof(t) b e1
58|
59sizeof e b e1
60|
61 (e1 b1 e) && (e b2 e2)
62|
63 (e1 b3 e) && (e b4 e2)
64|
65i b e
66|
67- c < e
68+ e > c
69|
70- c <= e
71+ e >= c
72|
73- c > e
74+ e < c
75|
76- c >= e
77+ e <= c
78)
79
80// ----------------------------------------------------------------------------
81
82@r1_context depends on !patch && (context || org || report)
83 disable bitor_comm, neg_if_exp exists@
84type t;
85binary operator b = {==,!=,&,|};
86constant c, c1;
87expression e, e1, e2;
88local idexpression i;
89position j0;
90@@
91
92(
93c b (c1)
94|
95sizeof(t) b e1
96|
97sizeof e b e1
98|
99i b e1
100|
101c | e1 | e2 | ...
102|
103c | (e ? e1 : e2)
104|
105* c@j0 b e
106)
107
108@r2_context depends on !patch && (context || org || report)
109 disable gtr_lss, gtr_lss_eq, not_int2 exists@
110type t;
111binary operator b, b1 = {<,<=}, b2 = {<,<=}, b3 = {>,>=}, b4 = {>,>=};
112constant c, c1;
113expression e, e1, e2;
114local idexpression i;
115position j0;
116@@
117
118(
119c b c1
120|
121sizeof(t) b e1
122|
123sizeof e b e1
124|
125 (e1 b1 e) && (e b2 e2)
126|
127 (e1 b3 e) && (e b4 e2)
128|
129i b e
130|
131* c@j0 < e
132|
133* c@j0 <= e
134|
135* c@j0 > e
136|
137* c@j0 >= e
138)
139
140// ----------------------------------------------------------------------------
141
142@script:python r1_org depends on org@
143j0 << r1_context.j0;
144@@
145
146msg = "Move constant to right."
147coccilib.org.print_todo(j0[0], msg)
148
149@script:python r2_org depends on org@
150j0 << r2_context.j0;
151@@
152
153msg = "Move constant to right."
154coccilib.org.print_todo(j0[0], msg)
155
156// ----------------------------------------------------------------------------
157
158@script:python r1_report depends on report@
159j0 << r1_context.j0;
160@@
161
162msg = "Move constant to right."
163coccilib.report.print_report(j0[0], msg)
164
165@script:python r2_report depends on report@
166j0 << r2_context.j0;
167@@
168
169msg = "Move constant to right."
170coccilib.report.print_report(j0[0], msg)
171
diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c934046a060..2294915a19bc 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
1/// Make sure of_device_id tables are NULL terminated 1/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
2// 2//
3// Keywords: of_table 3// Keywords: of_table i2c_table platform_table
4// Confidence: Medium 4// Confidence: Medium
5// Options: --include-headers 5// Options: --include-headers
6 6
@@ -13,18 +13,26 @@ virtual report
13identifier var, arr; 13identifier var, arr;
14expression E; 14expression E;
15@@ 15@@
16struct of_device_id arr[] = { 16(
17struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
17 ..., 18 ...,
18 { 19 {
19 .var = E, 20 .var = E,
20* } 21* }
21}; 22};
23|
24struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
25 ...,
26* { ..., E, ... },
27};
28)
22 29
23@depends on patch@ 30@depends on patch@
24identifier var, arr; 31identifier var, arr;
25expression E; 32expression E;
26@@ 33@@
27struct of_device_id arr[] = { 34(
35struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
28 ..., 36 ...,
29 { 37 {
30 .var = E, 38 .var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
32+ }, 40+ },
33+ { } 41+ { }
34}; 42};
43|
44struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
45 ...,
46 { ..., E, ... },
47+ { },
48};
49)
35 50
36@r depends on org || report@ 51@r depends on org || report@
37position p1; 52position p1;
38identifier var, arr; 53identifier var, arr;
39expression E; 54expression E;
40@@ 55@@
41struct of_device_id arr[] = { 56(
57struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
42 ..., 58 ...,
43 { 59 {
44 .var = E, 60 .var = E,
45 } 61 }
46 @p1 62 @p1
47}; 63};
64|
65struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
66 ...,
67 { ..., E, ... }
68 @p1
69};
70)
48 71
49@script:python depends on org@ 72@script:python depends on org@
50p1 << r.p1; 73p1 << r.p1;
diff --git a/scripts/coccinelle/misc/simple_return.cocci b/scripts/coccinelle/misc/simple_return.cocci
deleted file mode 100644
index e8b6313b116f..000000000000
--- a/scripts/coccinelle/misc/simple_return.cocci
+++ /dev/null
@@ -1,180 +0,0 @@
1/// Simplify a trivial if-return sequence. Possibly combine with a
2/// preceding function call.
3///
4// Confidence: High
5// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2.
6// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2.
7// URL: http://coccinelle.lip6.fr/
8// Comments:
9// Options: --no-includes --include-headers
10
11virtual patch
12virtual context
13virtual org
14virtual report
15
16@r depends on patch@
17local idexpression e;
18identifier i,f,fn;
19@@
20
21fn(...) { <...
22- e@i =
23+ return
24 f(...);
25-if (i != 0) return i;
26-return 0;
27...> }
28
29@depends on patch@
30identifier r.i;
31type t;
32@@
33
34-t i;
35 ... when != i
36
37@depends on patch@
38expression e;
39@@
40
41-if (e != 0)
42 return e;
43-return 0;
44
45// -----------------------------------------------------------------------
46
47@s1 depends on context || org || report@
48local idexpression e;
49identifier i,f,fn;
50position p,p1,p2;
51@@
52
53fn(...) { <...
54* e@i@p = f(...);
55 if (\(i@p1 != 0\|i@p2 < 0\))
56 return i;
57 return 0;
58...> }
59
60@s2 depends on context || org || report forall@
61identifier s1.i;
62type t;
63position q,s1.p;
64expression e,f;
65@@
66
67* t i@q;
68 ... when != i
69 e@p = f(...);
70
71@s3 depends on context || org || report@
72expression e;
73position p1!=s1.p1;
74position p2!=s1.p2;
75@@
76
77*if (\(e@p1 != 0\|e@p2 < 0\))
78 return e;
79 return 0;
80
81// -----------------------------------------------------------------------
82
83@script:python depends on org@
84p << s1.p;
85p1 << s1.p1;
86q << s2.q;
87@@
88
89cocci.print_main("decl",q)
90cocci.print_secs("use",p)
91cocci.include_match(False)
92
93@script:python depends on org@
94p << s1.p;
95p2 << s1.p2;
96q << s2.q;
97@@
98
99cocci.print_main("decl",q)
100cocci.print_secs("use with questionable test",p)
101cocci.include_match(False)
102
103@script:python depends on org@
104p << s1.p;
105p1 << s1.p1;
106@@
107
108cocci.print_main("use",p)
109
110@script:python depends on org@
111p << s1.p;
112p2 << s1.p2;
113@@
114
115cocci.print_main("use with questionable test",p)
116
117@script:python depends on org@
118p << s3.p1;
119@@
120
121cocci.print_main("test",p)
122
123@script:python depends on org@
124p << s3.p2;
125@@
126
127cocci.print_main("questionable test",p)
128
129// -----------------------------------------------------------------------
130
131@script:python depends on report@
132p << s1.p;
133p1 << s1.p1;
134q << s2.q;
135@@
136
137msg = "WARNING: end returns can be simpified and declaration on line %s can be dropped" % (q[0].line)
138coccilib.report.print_report(p[0],msg)
139cocci.include_match(False)
140
141@script:python depends on report@
142p << s1.p;
143p1 << s1.p1;
144q << s2.q
145;
146@@
147
148msg = "WARNING: end returns may be simpified if negative or 0 value and declaration on line %s can be dropped" % (q[0].line)
149coccilib.report.print_report(p[0],msg)
150cocci.include_match(False)
151
152@script:python depends on report@
153p << s1.p;
154p1 << s1.p1;
155@@
156
157msg = "WARNING: end returns can be simpified"
158coccilib.report.print_report(p[0],msg)
159
160@script:python depends on report@
161p << s1.p;
162p2 << s1.p2;
163@@
164
165msg = "WARNING: end returns can be simpified if negative or 0 value"
166coccilib.report.print_report(p[0],msg)
167
168@script:python depends on report@
169p << s3.p1;
170@@
171
172msg = "WARNING: end returns can be simpified"
173coccilib.report.print_report(p[0],msg)
174
175@script:python depends on report@
176p << s3.p2;
177@@
178
179msg = "WARNING: end returns can be simpified if tested value is negative or 0"
180coccilib.report.print_report(p[0],msg)
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci
index cdac6cfcce92..f192d6035d02 100644
--- a/scripts/coccinelle/null/deref_null.cocci
+++ b/scripts/coccinelle/null/deref_null.cocci
@@ -1,6 +1,6 @@
1/// 1///
2/// A variable is dereference under a NULL test. 2/// A variable is dereferenced under a NULL test.
3/// Even though it is know to be NULL. 3/// Even though it is known to be NULL.
4/// 4///
5// Confidence: Moderate 5// Confidence: Moderate
6// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. 6// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
diff --git a/scripts/coccinelle/tests/odd_ptr_err.cocci b/scripts/coccinelle/tests/odd_ptr_err.cocci
index cfe0a35cf2dd..dfc6b40c2969 100644
--- a/scripts/coccinelle/tests/odd_ptr_err.cocci
+++ b/scripts/coccinelle/tests/odd_ptr_err.cocci
@@ -1,12 +1,11 @@
1/// PTR_ERR should access the value just tested by IS_ERR 1/// PTR_ERR should access the value just tested by IS_ERR
2//# There can be false positives in the patch case, where it is the call 2//# There can be false positives in the patch case, where it is the call to
3//# IS_ERR that is wrong. 3//# IS_ERR that is wrong.
4/// 4///
5// Confidence: High 5// Confidence: High
6// Copyright: (C) 2012 Julia Lawall, INRIA. GPLv2. 6// Copyright: (C) 2012, 2015 Julia Lawall, INRIA. GPLv2.
7// Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. 7// Copyright: (C) 2012, 2015 Gilles Muller, INRIA. GPLv2.
8// URL: http://coccinelle.lip6.fr/ 8// URL: http://coccinelle.lip6.fr/
9// Comments:
10// Options: --no-includes --include-headers 9// Options: --no-includes --include-headers
11 10
12virtual patch 11virtual patch
@@ -14,52 +13,105 @@ virtual context
14virtual org 13virtual org
15virtual report 14virtual report
16 15
17@depends on patch@ 16@ok1 exists@
18expression e,e1; 17expression x,e;
18position p;
19@@ 19@@
20 20
21if (IS_ERR(x=e) || ...) {
22 <...
23 PTR_ERR@p(x)
24 ...>
25}
26
27@ok2 exists@
28expression x,e1,e2;
29position p;
30@@
31
32if (IS_ERR(x) || ...) {
33 <...
21( 34(
22if (IS_ERR(e)) { ... PTR_ERR(e) ... } 35 PTR_ERR@p(\(e1 ? e2 : x\|e1 ? x : e2\))
23| 36|
24if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } 37 PTR_ERR@p(x)
38)
39 ...>
40}
41
42@r1 depends on patch && !context && !org && !report exists@
43expression x,y;
44position p != {ok1.p,ok2.p};
45@@
46
47if (IS_ERR(x) || ...) {
48 ... when any
49 when != IS_ERR(...)
50(
51 PTR_ERR(x)
25| 52|
26if (IS_ERR(e)) 53 PTR_ERR@p(
27 { ... 54- y
28 PTR_ERR( 55+ x
29- e1
30+ e
31 ) 56 )
32 ... }
33) 57)
58 ... when any
59}
60
61// ----------------------------------------------------------------------------
34 62
35@r depends on !patch@ 63@r1_context depends on !patch && (context || org || report) exists@
36expression e,e1; 64position p != {ok1.p,ok2.p};
37position p1,p2; 65expression x, y;
66position j0, j1;
38@@ 67@@
39 68
69if (IS_ERR@j0(x) || ...) {
70 ... when any
71 when != IS_ERR(...)
40( 72(
41if (IS_ERR(e)) { ... PTR_ERR(e) ... } 73 PTR_ERR(x)
42| 74|
43if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } 75 PTR_ERR@j1@p(
44| 76 y
45*if (IS_ERR@p1(e)) 77 )
46 { ...
47* PTR_ERR@p2(e1)
48 ... }
49) 78)
79 ... when any
80}
50 81
51@script:python depends on org@ 82@r1_disj depends on !patch && (context || org || report) exists@
52p1 << r.p1; 83position p != {ok1.p,ok2.p};
53p2 << r.p2; 84expression x, y;
85position r1_context.j0, r1_context.j1;
54@@ 86@@
55 87
56cocci.print_main("inconsistent IS_ERR and PTR_ERR",p1) 88* if (IS_ERR@j0(x) || ...) {
57cocci.print_secs("PTR_ERR",p2) 89 ... when any
90 when != IS_ERR(...)
91* PTR_ERR@j1@p(
92 y
93 )
94 ... when any
95}
58 96
59@script:python depends on report@ 97// ----------------------------------------------------------------------------
60p1 << r.p1; 98
61p2 << r.p2; 99@script:python r1_org depends on org@
100j0 << r1_context.j0;
101j1 << r1_context.j1;
62@@ 102@@
63 103
64msg = "inconsistent IS_ERR and PTR_ERR, PTR_ERR on line %s" % (p2[0].line) 104msg = "inconsistent IS_ERR and PTR_ERR"
65coccilib.report.print_report(p1[0],msg) 105coccilib.org.print_todo(j0[0], msg)
106coccilib.org.print_link(j1[0], "")
107
108// ----------------------------------------------------------------------------
109
110@script:python r1_report depends on report@
111j0 << r1_context.j0;
112j1 << r1_context.j1;
113@@
114
115msg = "inconsistent IS_ERR and PTR_ERR on line %s." % (j1[0].line)
116coccilib.report.print_report(j0[0], msg)
117
diff --git a/scripts/extract-cert.c b/scripts/extract-cert.c
index 6ce5945a0b89..b071bf476fea 100644
--- a/scripts/extract-cert.c
+++ b/scripts/extract-cert.c
@@ -17,13 +17,9 @@
17#include <stdint.h> 17#include <stdint.h>
18#include <stdbool.h> 18#include <stdbool.h>
19#include <string.h> 19#include <string.h>
20#include <getopt.h>
21#include <err.h> 20#include <err.h>
22#include <arpa/inet.h>
23#include <openssl/bio.h> 21#include <openssl/bio.h>
24#include <openssl/evp.h>
25#include <openssl/pem.h> 22#include <openssl/pem.h>
26#include <openssl/pkcs7.h>
27#include <openssl/err.h> 23#include <openssl/err.h>
28#include <openssl/engine.h> 24#include <openssl/engine.h>
29 25
diff --git a/scripts/extract-module-sig.pl b/scripts/extract-module-sig.pl
new file mode 100755
index 000000000000..faac6f2e377f
--- /dev/null
+++ b/scripts/extract-module-sig.pl
@@ -0,0 +1,136 @@
1#!/usr/bin/perl -w
2#
3# extract-mod-sig <part> <module-file>
4#
5# Reads the module file and writes out some or all of the signature
6# section to stdout. Part is the bit to be written and is one of:
7#
8# -0: The unsigned module, no signature data at all
9# -a: All of the signature data, including magic number
10# -d: Just the descriptor values as a sequence of numbers
11# -n: Just the signer's name
12# -k: Just the key ID
13# -s: Just the crypto signature or PKCS#7 message
14#
15use strict;
16
17die "Format: $0 -[0adnks] module-file >out\n"
18 if ($#ARGV != 1);
19
20my $part = $ARGV[0];
21my $modfile = $ARGV[1];
22
23my $magic_number = "~Module signature appended~\n";
24
25#
26# Read the module contents
27#
28open FD, "<$modfile" || die $modfile;
29binmode(FD);
30my @st = stat(FD);
31die "$modfile" unless (@st);
32my $buf = "";
33my $len = sysread(FD, $buf, $st[7]);
34die "$modfile" unless (defined($len));
35die "Short read on $modfile\n" unless ($len == $st[7]);
36close(FD) || die $modfile;
37
38print STDERR "Read ", $len, " bytes from module file\n";
39
40die "The file is too short to have a sig magic number and descriptor\n"
41 if ($len < 12 + length($magic_number));
42
43#
44# Check for the magic number and extract the information block
45#
46my $p = $len - length($magic_number);
47my $raw_magic = substr($buf, $p);
48
49die "Magic number not found at $len\n"
50 if ($raw_magic ne $magic_number);
51print STDERR "Found magic number at $len\n";
52
53$p -= 12;
54my $raw_info = substr($buf, $p, 12);
55
56my @info = unpack("CCCCCxxxN", $raw_info);
57my ($algo, $hash, $id_type, $name_len, $kid_len, $sig_len) = @info;
58
59if ($id_type == 0) {
60 print STDERR "Found PGP key identifier\n";
61} elsif ($id_type == 1) {
62 print STDERR "Found X.509 cert identifier\n";
63} elsif ($id_type == 2) {
64 print STDERR "Found PKCS#7/CMS encapsulation\n";
65} else {
66 print STDERR "Found unsupported identifier type $id_type\n";
67}
68
69#
70# Extract the three pieces of info data
71#
72die "Insufficient name+kid+sig data in file\n"
73 unless ($p >= $name_len + $kid_len + $sig_len);
74
75$p -= $sig_len;
76my $raw_sig = substr($buf, $p, $sig_len);
77$p -= $kid_len;
78my $raw_kid = substr($buf, $p, $kid_len);
79$p -= $name_len;
80my $raw_name = substr($buf, $p, $name_len);
81
82my $module_len = $p;
83
84if ($sig_len > 0) {
85 print STDERR "Found $sig_len bytes of signature [";
86 my $n = $sig_len > 16 ? 16 : $sig_len;
87 foreach my $i (unpack("C" x $n, substr($raw_sig, 0, $n))) {
88 printf STDERR "%02x", $i;
89 }
90 print STDERR "]\n";
91}
92
93if ($kid_len > 0) {
94 print STDERR "Found $kid_len bytes of key identifier [";
95 my $n = $kid_len > 16 ? 16 : $kid_len;
96 foreach my $i (unpack("C" x $n, substr($raw_kid, 0, $n))) {
97 printf STDERR "%02x", $i;
98 }
99 print STDERR "]\n";
100}
101
102if ($name_len > 0) {
103 print STDERR "Found $name_len bytes of signer's name [$raw_name]\n";
104}
105
106#
107# Produce the requested output
108#
109if ($part eq "-0") {
110 # The unsigned module, no signature data at all
111 binmode(STDOUT);
112 print substr($buf, 0, $module_len);
113} elsif ($part eq "-a") {
114 # All of the signature data, including magic number
115 binmode(STDOUT);
116 print substr($buf, $module_len);
117} elsif ($part eq "-d") {
118 # Just the descriptor values as a sequence of numbers
119 print join(" ", @info), "\n";
120} elsif ($part eq "-n") {
121 # Just the signer's name
122 print STDERR "No signer's name for PKCS#7 message type sig\n"
123 if ($id_type == 2);
124 binmode(STDOUT);
125 print $raw_name;
126} elsif ($part eq "-k") {
127 # Just the key identifier
128 print STDERR "No key ID for PKCS#7 message type sig\n"
129 if ($id_type == 2);
130 binmode(STDOUT);
131 print $raw_kid;
132} elsif ($part eq "-s") {
133 # Just the crypto signature or PKCS#7 message
134 binmode(STDOUT);
135 print $raw_sig;
136}
diff --git a/scripts/extract-sys-certs.pl b/scripts/extract-sys-certs.pl
new file mode 100755
index 000000000000..d476e7d1fd88
--- /dev/null
+++ b/scripts/extract-sys-certs.pl
@@ -0,0 +1,144 @@
1#!/usr/bin/perl -w
2#
3use strict;
4use Math::BigInt;
5use Fcntl "SEEK_SET";
6
7die "Format: $0 [-s <systemmap-file>] <vmlinux-file> <keyring-file>\n"
8 if ($#ARGV != 1 && $#ARGV != 3 ||
9 $#ARGV == 3 && $ARGV[0] ne "-s");
10
11my $sysmap = "";
12if ($#ARGV == 3) {
13 shift;
14 $sysmap = $ARGV[0];
15 shift;
16}
17
18my $vmlinux = $ARGV[0];
19my $keyring = $ARGV[1];
20
21#
22# Parse the vmlinux section table
23#
24open FD, "objdump -h $vmlinux |" || die $vmlinux;
25my @lines = <FD>;
26close(FD) || die $vmlinux;
27
28my @sections = ();
29
30foreach my $line (@lines) {
31 chomp($line);
32 if ($line =~ /\s*([0-9]+)\s+(\S+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+2[*][*]([0-9]+)/
33 ) {
34 my $seg = $1;
35 my $name = $2;
36 my $len = Math::BigInt->new("0x" . $3);
37 my $vma = Math::BigInt->new("0x" . $4);
38 my $lma = Math::BigInt->new("0x" . $5);
39 my $foff = Math::BigInt->new("0x" . $6);
40 my $align = 2 ** $7;
41
42 push @sections, { name => $name,
43 vma => $vma,
44 len => $len,
45 foff => $foff };
46 }
47}
48
49print "Have $#sections sections\n";
50
51#
52# Try and parse the vmlinux symbol table. If the vmlinux file has been created
53# from a vmlinuz file with extract-vmlinux then the symbol table will be empty.
54#
55open FD, "nm $vmlinux 2>/dev/null |" || die $vmlinux;
56@lines = <FD>;
57close(FD) || die $vmlinux;
58
59my %symbols = ();
60my $nr_symbols = 0;
61
62sub parse_symbols(@) {
63 foreach my $line (@_) {
64 chomp($line);
65 if ($line =~ /([0-9a-f]+)\s([a-zA-Z])\s(\S+)/
66 ) {
67 my $addr = "0x" . $1;
68 my $type = $2;
69 my $name = $3;
70
71 $symbols{$name} = $addr;
72 $nr_symbols++;
73 }
74 }
75}
76parse_symbols(@lines);
77
78if ($nr_symbols == 0 && $sysmap ne "") {
79 print "No symbols in vmlinux, trying $sysmap\n";
80
81 open FD, "<$sysmap" || die $sysmap;
82 @lines = <FD>;
83 close(FD) || die $sysmap;
84 parse_symbols(@lines);
85}
86
87die "No symbols available\n"
88 if ($nr_symbols == 0);
89
90print "Have $nr_symbols symbols\n";
91
92die "Can't find system certificate list"
93 unless (exists($symbols{"__cert_list_start"}) &&
94 exists($symbols{"__cert_list_end"}));
95
96my $start = Math::BigInt->new($symbols{"__cert_list_start"});
97my $end = Math::BigInt->new($symbols{"__cert_list_end"});
98my $size = $end - $start;
99
100printf "Have %u bytes of certs at VMA 0x%x\n", $size, $start;
101
102my $s = undef;
103foreach my $sec (@sections) {
104 my $s_name = $sec->{name};
105 my $s_vma = $sec->{vma};
106 my $s_len = $sec->{len};
107 my $s_foff = $sec->{foff};
108 my $s_vend = $s_vma + $s_len;
109
110 next unless ($start >= $s_vma);
111 next if ($start >= $s_vend);
112
113 die "Cert object partially overflows section $s_name\n"
114 if ($end > $s_vend);
115
116 die "Cert object in multiple sections: ", $s_name, " and ", $s->{name}, "\n"
117 if ($s);
118 $s = $sec;
119}
120
121die "Cert object not inside a section\n"
122 unless ($s);
123
124print "Certificate list in section ", $s->{name}, "\n";
125
126my $foff = $start - $s->{vma} + $s->{foff};
127
128printf "Certificate list at file offset 0x%x\n", $foff;
129
130open FD, "<$vmlinux" || die $vmlinux;
131binmode(FD);
132die $vmlinux if (!defined(sysseek(FD, $foff, SEEK_SET)));
133my $buf = "";
134my $len = sysread(FD, $buf, $size);
135die "$vmlinux" if (!defined($len));
136die "Short read on $vmlinux\n" if ($len != $size);
137close(FD) || die $vmlinux;
138
139open FD, ">$keyring" || die $keyring;
140binmode(FD);
141$len = syswrite(FD, $buf, $size);
142die "$keyring" if (!defined($len));
143die "Short write on $keyring\n" if ($len != $size);
144close(FD) || die $keyring;
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 98bae869f6d0..cab641a12dd5 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -781,6 +781,7 @@ MAINTAINER field selection options:
781 --git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers) 781 --git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
782 --git-min-percent => minimum percentage of commits required (default: $email_git_min_percent) 782 --git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
783 --git-blame => use git blame to find modified commits for patch or file 783 --git-blame => use git blame to find modified commits for patch or file
784 --git-blame-signatures => when used with --git-blame, also include all commit signers
784 --git-since => git history to use (default: $email_git_since) 785 --git-since => git history to use (default: $email_git_since)
785 --hg-since => hg history to use (default: $email_hg_since) 786 --hg-since => hg history to use (default: $email_hg_since)
786 --interactive => display a menu (mostly useful if used with the --git option) 787 --interactive => display a menu (mostly useful if used with the --git option)
@@ -812,7 +813,7 @@ Other options:
812 --help => show this help information 813 --help => show this help information
813 814
814Default options: 815Default options:
815 [--email --nogit --git-fallback --m --n --l --multiline -pattern-depth=0 816 [--email --nogit --git-fallback --m --r --n --l --multiline --pattern-depth=0
816 --remove-duplicates --rolestats] 817 --remove-duplicates --rolestats]
817 818
818Notes: 819Notes:
@@ -844,6 +845,9 @@ Notes:
844 Entries in this file can be any command line argument. 845 Entries in this file can be any command line argument.
845 This file is prepended to any additional command line arguments. 846 This file is prepended to any additional command line arguments.
846 Multiple lines and # comments are allowed. 847 Multiple lines and # comments are allowed.
848 Most options have both positive and negative forms.
849 The negative forms for --<foo> are --no<foo> and --no-<foo>.
850
847EOT 851EOT
848} 852}
849 853
@@ -970,20 +974,29 @@ sub find_ending_index {
970 return $index; 974 return $index;
971} 975}
972 976
973sub get_maintainer_role { 977sub get_subsystem_name {
974 my ($index) = @_; 978 my ($index) = @_;
975 979
976 my $i;
977 my $start = find_starting_index($index); 980 my $start = find_starting_index($index);
978 my $end = find_ending_index($index);
979 981
980 my $role = "unknown";
981 my $subsystem = $typevalue[$start]; 982 my $subsystem = $typevalue[$start];
982 if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) { 983 if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) {
983 $subsystem = substr($subsystem, 0, $output_section_maxlen - 3); 984 $subsystem = substr($subsystem, 0, $output_section_maxlen - 3);
984 $subsystem =~ s/\s*$//; 985 $subsystem =~ s/\s*$//;
985 $subsystem = $subsystem . "..."; 986 $subsystem = $subsystem . "...";
986 } 987 }
988 return $subsystem;
989}
990
991sub get_maintainer_role {
992 my ($index) = @_;
993
994 my $i;
995 my $start = find_starting_index($index);
996 my $end = find_ending_index($index);
997
998 my $role = "unknown";
999 my $subsystem = get_subsystem_name($index);
987 1000
988 for ($i = $start + 1; $i < $end; $i++) { 1001 for ($i = $start + 1; $i < $end; $i++) {
989 my $tv = $typevalue[$i]; 1002 my $tv = $typevalue[$i];
@@ -1017,16 +1030,7 @@ sub get_maintainer_role {
1017sub get_list_role { 1030sub get_list_role {
1018 my ($index) = @_; 1031 my ($index) = @_;
1019 1032
1020 my $i; 1033 my $subsystem = get_subsystem_name($index);
1021 my $start = find_starting_index($index);
1022 my $end = find_ending_index($index);
1023
1024 my $subsystem = $typevalue[$start];
1025 if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) {
1026 $subsystem = substr($subsystem, 0, $output_section_maxlen - 3);
1027 $subsystem =~ s/\s*$//;
1028 $subsystem = $subsystem . "...";
1029 }
1030 1034
1031 if ($subsystem eq "THE REST") { 1035 if ($subsystem eq "THE REST") {
1032 $subsystem = ""; 1036 $subsystem = "";
@@ -1114,7 +1118,8 @@ sub add_categories {
1114 } 1118 }
1115 } 1119 }
1116 if ($email_reviewer) { 1120 if ($email_reviewer) {
1117 push_email_addresses($pvalue, 'reviewer'); 1121 my $subsystem = get_subsystem_name($i);
1122 push_email_addresses($pvalue, "reviewer:$subsystem");
1118 } 1123 }
1119 } elsif ($ptype eq "T") { 1124 } elsif ($ptype eq "T") {
1120 push(@scm, $pvalue); 1125 push(@scm, $pvalue);
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index aceaaed09811..d79cba4ce3eb 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -96,9 +96,12 @@ savedefconfig: $(obj)/conf
96defconfig: $(obj)/conf 96defconfig: $(obj)/conf
97ifeq ($(KBUILD_DEFCONFIG),) 97ifeq ($(KBUILD_DEFCONFIG),)
98 $< $(silent) --defconfig $(Kconfig) 98 $< $(silent) --defconfig $(Kconfig)
99else 99else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
100 @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" 100 @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
101 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) 101 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
102else
103 @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"
104 $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
102endif 105endif
103 106
104%_defconfig: $(obj)/conf 107%_defconfig: $(obj)/conf
@@ -226,49 +229,21 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
226 229
227# Qt needs some extra effort... 230# Qt needs some extra effort...
228$(obj)/.tmp_qtcheck: 231$(obj)/.tmp_qtcheck:
229 @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ 232 @set -e; $(kecho) " CHECK qt"; \
230 if ! pkg-config --exists QtCore 2> /dev/null; then \ 233 if pkg-config --exists Qt5Core; then \
231 echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ 234 cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
232 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 235 libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \
233 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 236 moc=`pkg-config --variable=host_bins Qt5Core`/moc; \
234 if [ -n "$$pkg" ]; then \ 237 elif pkg-config --exists QtCore; then \
235 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 238 cflags=`pkg-config --cflags QtCore QtGui`; \
236 libs="\$$(shell pkg-config $$pkg --libs)"; \ 239 libs=`pkg-config --libs QtCore QtGui`; \
237 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 240 moc=`pkg-config --variable=moc_location QtCore`; \
238 dir="$$(pkg-config $$pkg --variable=prefix)"; \
239 else \
240 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
241 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
242 done; \
243 if [ -z "$$dir" ]; then \
244 echo >&2 "*"; \
245 echo >&2 "* Unable to find any Qt installation. Please make sure that"; \
246 echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \
247 echo >&2 "* either qmake can be found or install pkg-config or set"; \
248 echo >&2 "* the QTDIR environment variable to the correct location."; \
249 echo >&2 "*"; \
250 false; \
251 fi; \
252 libpath=$$dir/lib; lib=qt; osdir=""; \
253 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
254 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
255 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
256 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
257 cflags="-I$$dir/include"; \
258 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
259 moc="$$dir/bin/moc"; \
260 fi; \
261 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
262 echo "*"; \
263 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
264 echo "*"; \
265 moc="/usr/bin/moc"; \
266 fi; \
267 else \ 241 else \
268 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ 242 echo >&2 "*"; \
269 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ 243 echo >&2 "* Could not find Qt via pkg-config."; \
270 moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ 244 echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
271 [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ 245 echo >&2 "*"; \
246 exit 1; \
272 fi; \ 247 fi; \
273 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 248 echo "KC_QT_CFLAGS=$$cflags" > $@; \
274 echo "KC_QT_LIBS=$$libs" >> $@; \ 249 echo "KC_QT_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 667d1aa23711..cbf4996dd9c1 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1113,7 +1113,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1113 fn(data, e->left.sym, e->left.sym->name); 1113 fn(data, e->left.sym, e->left.sym->name);
1114 else 1114 else
1115 fn(data, NULL, "<choice>"); 1115 fn(data, NULL, "<choice>");
1116 fn(data, NULL, e->type == E_LEQ ? ">=" : ">"); 1116 fn(data, NULL, e->type == E_GEQ ? ">=" : ">");
1117 fn(data, e->right.sym, e->right.sym->name); 1117 fn(data, e->right.sym, e->right.sym->name);
1118 break; 1118 break;
1119 case E_UNEQUAL: 1119 case E_UNEQUAL:
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 0d883b37882a..67d131447631 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -32,7 +32,7 @@ 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 echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
36} 36}
37 37
38RUNMAKE=true 38RUNMAKE=true
@@ -77,11 +77,19 @@ while true; do
77 esac 77 esac
78done 78done
79 79
80if [ "$#" -lt 2 ] ; then 80if [ "$#" -lt 1 ] ; then
81 usage 81 usage
82 exit 82 exit
83fi 83fi
84 84
85if [ -z "$KCONFIG_CONFIG" ]; then
86 if [ "$OUTPUT" != . ]; then
87 KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config")
88 else
89 KCONFIG_CONFIG=.config
90 fi
91fi
92
85INITFILE=$1 93INITFILE=$1
86shift; 94shift;
87 95
@@ -124,9 +132,9 @@ for MERGE_FILE in $MERGE_LIST ; do
124done 132done
125 133
126if [ "$RUNMAKE" = "false" ]; then 134if [ "$RUNMAKE" = "false" ]; then
127 cp $TMP_FILE $OUTPUT/.config 135 cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
128 echo "#" 136 echo "#"
129 echo "# merged configuration written to $OUTPUT/.config (needs make)" 137 echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
130 echo "#" 138 echo "#"
131 clean_up 139 clean_up
132 exit 140 exit
@@ -150,7 +158,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
150for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do 158for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
151 159
152 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 160 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
153 ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config) 161 ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
154 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then 162 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
155 echo "Value requested for $CFG not in final .config" 163 echo "Value requested for $CFG not in final .config"
156 echo "Requested value: $REQUESTED_VAL" 164 echo "Requested value: $REQUESTED_VAL"
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c3bb7fe8dfa6..91b7e6fbc364 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1,32 +1,17 @@
1/* 1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
3 * Released under the terms of the GNU GPL v2.0. 4 * Released under the terms of the GNU GPL v2.0.
4 */ 5 */
5 6
6#include <qglobal.h> 7#include <qglobal.h>
7 8
8#if QT_VERSION < 0x040000 9#include <QMainWindow>
9#include <stddef.h> 10#include <QList>
10#include <qmainwindow.h>
11#include <qvbox.h>
12#include <qvaluelist.h>
13#include <qtextbrowser.h> 11#include <qtextbrowser.h>
14#include <qaction.h> 12#include <QAction>
15#include <qheader.h> 13#include <QFileDialog>
16#include <qfiledialog.h> 14#include <QMenu>
17#include <qdragobject.h>
18#include <qpopupmenu.h>
19#else
20#include <q3mainwindow.h>
21#include <q3vbox.h>
22#include <q3valuelist.h>
23#include <q3textbrowser.h>
24#include <q3action.h>
25#include <q3header.h>
26#include <q3filedialog.h>
27#include <q3dragobject.h>
28#include <q3popupmenu.h>
29#endif
30 15
31#include <qapplication.h> 16#include <qapplication.h>
32#include <qdesktopwidget.h> 17#include <qdesktopwidget.h>
@@ -57,7 +42,7 @@
57static QApplication *configApp; 42static QApplication *configApp;
58static ConfigSettings *configSettings; 43static ConfigSettings *configSettings;
59 44
60Q3Action *ConfigMainWindow::saveAction; 45QAction *ConfigMainWindow::saveAction;
61 46
62static inline QString qgettext(const char* str) 47static inline QString qgettext(const char* str)
63{ 48{
@@ -66,7 +51,7 @@ static inline QString qgettext(const char* str)
66 51
67static inline QString qgettext(const QString& str) 52static inline QString qgettext(const QString& str)
68{ 53{
69 return QString::fromLocal8Bit(gettext(str.latin1())); 54 return QString::fromLocal8Bit(gettext(str.toLatin1()));
70} 55}
71 56
72ConfigSettings::ConfigSettings() 57ConfigSettings::ConfigSettings()
@@ -77,10 +62,10 @@ ConfigSettings::ConfigSettings()
77/** 62/**
78 * Reads a list of integer values from the application settings. 63 * Reads a list of integer values from the application settings.
79 */ 64 */
80Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) 65QList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
81{ 66{
82 Q3ValueList<int> result; 67 QList<int> result;
83 QStringList entryList = readListEntry(key, ok); 68 QStringList entryList = value(key).toStringList();
84 QStringList::Iterator it; 69 QStringList::Iterator it;
85 70
86 for (it = entryList.begin(); it != entryList.end(); ++it) 71 for (it = entryList.begin(); it != entryList.end(); ++it)
@@ -92,14 +77,16 @@ Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
92/** 77/**
93 * Writes a list of integer values to the application settings. 78 * Writes a list of integer values to the application settings.
94 */ 79 */
95bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value) 80bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
96{ 81{
97 QStringList stringList; 82 QStringList stringList;
98 Q3ValueList<int>::ConstIterator it; 83 QList<int>::ConstIterator it;
99 84
100 for (it = value.begin(); it != value.end(); ++it) 85 for (it = value.begin(); it != value.end(); ++it)
101 stringList.push_back(QString::number(*it)); 86 stringList.push_back(QString::number(*it));
102 return writeEntry(key, stringList); 87 setValue(key, stringList);
88
89 return true;
103} 90}
104 91
105 92
@@ -109,9 +96,6 @@ bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& valu
109 */ 96 */
110void ConfigItem::okRename(int col) 97void ConfigItem::okRename(int col)
111{ 98{
112 Parent::okRename(col);
113 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
114 listView()->updateList(this);
115} 99}
116 100
117/* 101/*
@@ -149,11 +133,11 @@ void ConfigItem::updateMenu(void)
149 } else { 133 } else {
150 if (sym) 134 if (sym)
151 break; 135 break;
152 setPixmap(promptColIdx, 0); 136 setPixmap(promptColIdx, QIcon());
153 } 137 }
154 goto set_prompt; 138 goto set_prompt;
155 case P_COMMENT: 139 case P_COMMENT:
156 setPixmap(promptColIdx, 0); 140 setPixmap(promptColIdx, QIcon());
157 goto set_prompt; 141 goto set_prompt;
158 default: 142 default:
159 ; 143 ;
@@ -170,7 +154,7 @@ void ConfigItem::updateMenu(void)
170 char ch; 154 char ch;
171 155
172 if (!sym_is_changable(sym) && list->optMode == normalOpt) { 156 if (!sym_is_changable(sym) && list->optMode == normalOpt) {
173 setPixmap(promptColIdx, 0); 157 setPixmap(promptColIdx, QIcon());
174 setText(noColIdx, QString::null); 158 setText(noColIdx, QString::null);
175 setText(modColIdx, QString::null); 159 setText(modColIdx, QString::null);
176 setText(yesColIdx, QString::null); 160 setText(yesColIdx, QString::null);
@@ -216,9 +200,6 @@ void ConfigItem::updateMenu(void)
216 200
217 data = sym_get_string_value(sym); 201 data = sym_get_string_value(sym);
218 202
219 int i = list->mapIdx(dataColIdx);
220 if (i >= 0)
221 setRenameEnabled(i, TRUE);
222 setText(dataColIdx, data); 203 setText(dataColIdx, data);
223 if (type == S_STRING) 204 if (type == S_STRING)
224 prompt = QString("%1: %2").arg(prompt).arg(data); 205 prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -250,18 +231,6 @@ void ConfigItem::testUpdateMenu(bool v)
250 updateMenu(); 231 updateMenu();
251} 232}
252 233
253void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
254{
255 ConfigList* list = listView();
256
257 if (visible) {
258 if (isSelected() && !list->hasFocus() && list->mode == menuMode)
259 Parent::paintCell(p, list->inactivedColorGroup, column, width, align);
260 else
261 Parent::paintCell(p, cg, column, width, align);
262 } else
263 Parent::paintCell(p, list->disabledColorGroup, column, width, align);
264}
265 234
266/* 235/*
267 * construct a menu entry 236 * construct a menu entry
@@ -274,7 +243,7 @@ void ConfigItem::init(void)
274 menu->data = this; 243 menu->data = this;
275 244
276 if (list->mode != fullMode) 245 if (list->mode != fullMode)
277 setOpen(TRUE); 246 setExpanded(true);
278 sym_calc_value(menu->sym); 247 sym_calc_value(menu->sym);
279 } 248 }
280 updateMenu(); 249 updateMenu();
@@ -299,7 +268,7 @@ ConfigItem::~ConfigItem(void)
299ConfigLineEdit::ConfigLineEdit(ConfigView* parent) 268ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
300 : Parent(parent) 269 : Parent(parent)
301{ 270{
302 connect(this, SIGNAL(lostFocus()), SLOT(hide())); 271 connect(this, SIGNAL(editingFinished()), SLOT(hide()));
303} 272}
304 273
305void ConfigLineEdit::show(ConfigItem* i) 274void ConfigLineEdit::show(ConfigItem* i)
@@ -320,7 +289,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
320 break; 289 break;
321 case Qt::Key_Return: 290 case Qt::Key_Return:
322 case Qt::Key_Enter: 291 case Qt::Key_Enter:
323 sym_set_string_value(item->menu->sym, text().latin1()); 292 sym_set_string_value(item->menu->sym, text().toLatin1());
324 parent()->updateList(item); 293 parent()->updateList(item);
325 break; 294 break;
326 default: 295 default:
@@ -333,39 +302,39 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
333} 302}
334 303
335ConfigList::ConfigList(ConfigView* p, const char *name) 304ConfigList::ConfigList(ConfigView* p, const char *name)
336 : Parent(p, name), 305 : Parent(p),
337 updateAll(false), 306 updateAll(false),
338 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 307 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
339 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 308 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
340 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), 309 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
341 showName(false), showRange(false), showData(false), optMode(normalOpt), 310 showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
342 rootEntry(0), headerPopup(0) 311 rootEntry(0), headerPopup(0)
343{ 312{
344 int i; 313 int i;
345 314
346 setSorting(-1); 315 setObjectName(name);
347 setRootIsDecorated(TRUE); 316 setSortingEnabled(false);
348 disabledColorGroup = palette().active(); 317 setRootIsDecorated(true);
349 disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); 318
350 inactivedColorGroup = palette().active(); 319 setVerticalScrollMode(ScrollPerPixel);
351 inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); 320 setHorizontalScrollMode(ScrollPerPixel);
321
322 setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value"));
352 323
353 connect(this, SIGNAL(selectionChanged(void)), 324 connect(this, SIGNAL(itemSelectionChanged(void)),
354 SLOT(updateSelection(void))); 325 SLOT(updateSelection(void)));
355 326
356 if (name) { 327 if (name) {
357 configSettings->beginGroup(name); 328 configSettings->beginGroup(name);
358 showName = configSettings->readBoolEntry("/showName", false); 329 showName = configSettings->value("/showName", false).toBool();
359 showRange = configSettings->readBoolEntry("/showRange", false); 330 showRange = configSettings->value("/showRange", false).toBool();
360 showData = configSettings->readBoolEntry("/showData", false); 331 showData = configSettings->value("/showData", false).toBool();
361 optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); 332 optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
362 configSettings->endGroup(); 333 configSettings->endGroup();
363 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 334 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
364 } 335 }
365 336
366 for (i = 0; i < colNr; i++) 337 addColumn(promptColIdx);
367 colMap[i] = colRevMap[i] = -1;
368 addColumn(promptColIdx, _("Option"));
369 338
370 reinit(); 339 reinit();
371} 340}
@@ -390,26 +359,26 @@ void ConfigList::reinit(void)
390 removeColumn(nameColIdx); 359 removeColumn(nameColIdx);
391 360
392 if (showName) 361 if (showName)
393 addColumn(nameColIdx, _("Name")); 362 addColumn(nameColIdx);
394 if (showRange) { 363 if (showRange) {
395 addColumn(noColIdx, "N"); 364 addColumn(noColIdx);
396 addColumn(modColIdx, "M"); 365 addColumn(modColIdx);
397 addColumn(yesColIdx, "Y"); 366 addColumn(yesColIdx);
398 } 367 }
399 if (showData) 368 if (showData)
400 addColumn(dataColIdx, _("Value")); 369 addColumn(dataColIdx);
401 370
402 updateListAll(); 371 updateListAll();
403} 372}
404 373
405void ConfigList::saveSettings(void) 374void ConfigList::saveSettings(void)
406{ 375{
407 if (name()) { 376 if (!objectName().isEmpty()) {
408 configSettings->beginGroup(name()); 377 configSettings->beginGroup(objectName());
409 configSettings->writeEntry("/showName", showName); 378 configSettings->setValue("/showName", showName);
410 configSettings->writeEntry("/showRange", showRange); 379 configSettings->setValue("/showRange", showRange);
411 configSettings->writeEntry("/showData", showData); 380 configSettings->setValue("/showData", showData);
412 configSettings->writeEntry("/optionMode", (int)optMode); 381 configSettings->setValue("/optionMode", (int)optMode);
413 configSettings->endGroup(); 382 configSettings->endGroup();
414 } 383 }
415} 384}
@@ -431,7 +400,10 @@ void ConfigList::updateSelection(void)
431 struct menu *menu; 400 struct menu *menu;
432 enum prop_type type; 401 enum prop_type type;
433 402
434 ConfigItem* item = (ConfigItem*)selectedItem(); 403 if (selectedItems().count() == 0)
404 return;
405
406 ConfigItem* item = (ConfigItem*)selectedItems().first();
435 if (!item) 407 if (!item)
436 return; 408 return;
437 409
@@ -451,21 +423,23 @@ void ConfigList::updateList(ConfigItem* item)
451 if (!rootEntry) { 423 if (!rootEntry) {
452 if (mode != listMode) 424 if (mode != listMode)
453 goto update; 425 goto update;
454 Q3ListViewItemIterator it(this); 426 QTreeWidgetItemIterator it(this);
455 ConfigItem* item; 427 ConfigItem* item;
456 428
457 for (; it.current(); ++it) { 429 while (*it) {
458 item = (ConfigItem*)it.current(); 430 item = (ConfigItem*)(*it);
459 if (!item->menu) 431 if (!item->menu)
460 continue; 432 continue;
461 item->testUpdateMenu(menu_is_visible(item->menu)); 433 item->testUpdateMenu(menu_is_visible(item->menu));
434
435 ++it;
462 } 436 }
463 return; 437 return;
464 } 438 }
465 439
466 if (rootEntry != &rootmenu && (mode == singleMode || 440 if (rootEntry != &rootmenu && (mode == singleMode ||
467 (mode == symbolMode && rootEntry->parent != &rootmenu))) { 441 (mode == symbolMode && rootEntry->parent != &rootmenu))) {
468 item = firstChild(); 442 item = (ConfigItem *)topLevelItem(0);
469 if (!item) 443 if (!item)
470 item = new ConfigItem(this, 0, true); 444 item = new ConfigItem(this, 0, true);
471 last = item; 445 last = item;
@@ -479,12 +453,14 @@ void ConfigList::updateList(ConfigItem* item)
479 item->testUpdateMenu(true); 453 item->testUpdateMenu(true);
480 454
481 updateMenuList(item, rootEntry); 455 updateMenuList(item, rootEntry);
482 triggerUpdate(); 456 update();
457 resizeColumnToContents(0);
483 return; 458 return;
484 } 459 }
485update: 460update:
486 updateMenuList(this, rootEntry); 461 updateMenuList(this, rootEntry);
487 triggerUpdate(); 462 update();
463 resizeColumnToContents(0);
488} 464}
489 465
490void ConfigList::setValue(ConfigItem* item, tristate val) 466void ConfigList::setValue(ConfigItem* item, tristate val)
@@ -506,7 +482,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
506 if (!sym_set_tristate_value(sym, val)) 482 if (!sym_set_tristate_value(sym, val))
507 return; 483 return;
508 if (oldval == no && item->menu->list) 484 if (oldval == no && item->menu->list)
509 item->setOpen(TRUE); 485 item->setExpanded(true);
510 parent()->updateList(item); 486 parent()->updateList(item);
511 break; 487 break;
512 } 488 }
@@ -524,7 +500,7 @@ void ConfigList::changeValue(ConfigItem* item)
524 sym = menu->sym; 500 sym = menu->sym;
525 if (!sym) { 501 if (!sym) {
526 if (item->menu->list) 502 if (item->menu->list)
527 item->setOpen(!item->isOpen()); 503 item->setExpanded(!item->isExpanded());
528 return; 504 return;
529 } 505 }
530 506
@@ -536,9 +512,9 @@ void ConfigList::changeValue(ConfigItem* item)
536 newexpr = sym_toggle_tristate_value(sym); 512 newexpr = sym_toggle_tristate_value(sym);
537 if (item->menu->list) { 513 if (item->menu->list) {
538 if (oldexpr == newexpr) 514 if (oldexpr == newexpr)
539 item->setOpen(!item->isOpen()); 515 item->setExpanded(!item->isExpanded());
540 else if (oldexpr == no) 516 else if (oldexpr == no)
541 item->setOpen(TRUE); 517 item->setExpanded(true);
542 } 518 }
543 if (oldexpr != newexpr) 519 if (oldexpr != newexpr)
544 parent()->updateList(item); 520 parent()->updateList(item);
@@ -546,10 +522,7 @@ void ConfigList::changeValue(ConfigItem* item)
546 case S_INT: 522 case S_INT:
547 case S_HEX: 523 case S_HEX:
548 case S_STRING: 524 case S_STRING:
549 if (colMap[dataColIdx] >= 0) 525 parent()->lineEdit->show(item);
550 item->startRename(colMap[dataColIdx]);
551 else
552 parent()->lineEdit->show(item);
553 break; 526 break;
554 } 527 }
555} 528}
@@ -566,8 +539,10 @@ void ConfigList::setRootMenu(struct menu *menu)
566 updateMenuList(this, 0); 539 updateMenuList(this, 0);
567 rootEntry = menu; 540 rootEntry = menu;
568 updateListAll(); 541 updateListAll();
569 setSelected(currentItem(), hasFocus()); 542 if (currentItem()) {
570 ensureItemVisible(currentItem()); 543 currentItem()->setSelected(hasFocus());
544 scrollToItem(currentItem());
545 }
571} 546}
572 547
573void ConfigList::setParentMenu(void) 548void ConfigList::setParentMenu(void)
@@ -580,13 +555,16 @@ void ConfigList::setParentMenu(void)
580 return; 555 return;
581 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 556 setRootMenu(menu_get_parent_menu(rootEntry->parent));
582 557
583 Q3ListViewItemIterator it(this); 558 QTreeWidgetItemIterator it(this);
584 for (; (item = (ConfigItem*)it.current()); it++) { 559 while (*it) {
560 item = (ConfigItem *)(*it);
585 if (item->menu == oldroot) { 561 if (item->menu == oldroot) {
586 setCurrentItem(item); 562 setCurrentItem(item);
587 ensureItemVisible(item); 563 scrollToItem(item);
588 break; 564 break;
589 } 565 }
566
567 ++it;
590 } 568 }
591} 569}
592 570
@@ -597,8 +575,7 @@ void ConfigList::setParentMenu(void)
597 * parent: either the menu list widget or a menu entry widget 575 * parent: either the menu list widget or a menu entry widget
598 * menu: entry to be updated 576 * menu: entry to be updated
599 */ 577 */
600template <class P> 578void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
601void ConfigList::updateMenuList(P* parent, struct menu* menu)
602{ 579{
603 struct menu* child; 580 struct menu* child;
604 ConfigItem* item; 581 ConfigItem* item;
@@ -607,8 +584,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
607 enum prop_type type; 584 enum prop_type type;
608 585
609 if (!menu) { 586 if (!menu) {
610 while ((item = parent->firstChild())) 587 while (parent->childCount() > 0)
611 delete item; 588 {
589 delete parent->takeChild(0);
590 }
591
612 return; 592 return;
613 } 593 }
614 594
@@ -660,9 +640,74 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
660 } 640 }
661} 641}
662 642
643void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
644{
645 struct menu* child;
646 ConfigItem* item;
647 ConfigItem* last;
648 bool visible;
649 enum prop_type type;
650
651 if (!menu) {
652 while (parent->topLevelItemCount() > 0)
653 {
654 delete parent->takeTopLevelItem(0);
655 }
656
657 return;
658 }
659
660 last = (ConfigItem*)parent->topLevelItem(0);
661 if (last && !last->goParent)
662 last = 0;
663 for (child = menu->list; child; child = child->next) {
664 item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0);
665 type = child->prompt ? child->prompt->type : P_UNKNOWN;
666
667 switch (mode) {
668 case menuMode:
669 if (!(child->flags & MENU_ROOT))
670 goto hide;
671 break;
672 case symbolMode:
673 if (child->flags & MENU_ROOT)
674 goto hide;
675 break;
676 default:
677 break;
678 }
679
680 visible = menu_is_visible(child);
681 if (!menuSkip(child)) {
682 if (!child->sym && !child->list && !child->prompt)
683 continue;
684 if (!item || item->menu != child)
685 item = new ConfigItem(parent, last, child, visible);
686 else
687 item->testUpdateMenu(visible);
688
689 if (mode == fullMode || mode == menuMode || type != P_MENU)
690 updateMenuList(item, child);
691 else
692 updateMenuList(item, 0);
693 last = item;
694 continue;
695 }
696 hide:
697 if (item && item->menu == child) {
698 last = (ConfigItem*)parent->topLevelItem(0);
699 if (last == item)
700 last = 0;
701 else while (last->nextSibling() != item)
702 last = last->nextSibling();
703 delete item;
704 }
705 }
706}
707
663void ConfigList::keyPressEvent(QKeyEvent* ev) 708void ConfigList::keyPressEvent(QKeyEvent* ev)
664{ 709{
665 Q3ListViewItem* i = currentItem(); 710 QTreeWidgetItem* i = currentItem();
666 ConfigItem* item; 711 ConfigItem* item;
667 struct menu *menu; 712 struct menu *menu;
668 enum prop_type type; 713 enum prop_type type;
@@ -714,20 +759,20 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
714 ev->accept(); 759 ev->accept();
715} 760}
716 761
717void ConfigList::contentsMousePressEvent(QMouseEvent* e) 762void ConfigList::mousePressEvent(QMouseEvent* e)
718{ 763{
719 //QPoint p(contentsToViewport(e->pos())); 764 //QPoint p(contentsToViewport(e->pos()));
720 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); 765 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
721 Parent::contentsMousePressEvent(e); 766 Parent::mousePressEvent(e);
722} 767}
723 768
724void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) 769void ConfigList::mouseReleaseEvent(QMouseEvent* e)
725{ 770{
726 QPoint p(contentsToViewport(e->pos())); 771 QPoint p = e->pos();
727 ConfigItem* item = (ConfigItem*)itemAt(p); 772 ConfigItem* item = (ConfigItem*)itemAt(p);
728 struct menu *menu; 773 struct menu *menu;
729 enum prop_type ptype; 774 enum prop_type ptype;
730 const QPixmap* pm; 775 QIcon icon;
731 int idx, x; 776 int idx, x;
732 777
733 if (!item) 778 if (!item)
@@ -735,14 +780,13 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
735 780
736 menu = item->menu; 781 menu = item->menu;
737 x = header()->offset() + p.x(); 782 x = header()->offset() + p.x();
738 idx = colRevMap[header()->sectionAt(x)]; 783 idx = header()->logicalIndexAt(x);
739 switch (idx) { 784 switch (idx) {
740 case promptColIdx: 785 case promptColIdx:
741 pm = item->pixmap(promptColIdx); 786 icon = item->pixmap(promptColIdx);
742 if (pm) { 787 if (!icon.isNull()) {
743 int off = header()->sectionPos(0) + itemMargin() + 788 int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly.
744 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); 789 if (x >= off && x < off + icon.availableSizes().first().width()) {
745 if (x >= off && x < off + pm->width()) {
746 if (item->goParent) { 790 if (item->goParent) {
747 emit parentSelected(); 791 emit parentSelected();
748 break; 792 break;
@@ -773,19 +817,19 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
773 817
774skip: 818skip:
775 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); 819 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
776 Parent::contentsMouseReleaseEvent(e); 820 Parent::mouseReleaseEvent(e);
777} 821}
778 822
779void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) 823void ConfigList::mouseMoveEvent(QMouseEvent* e)
780{ 824{
781 //QPoint p(contentsToViewport(e->pos())); 825 //QPoint p(contentsToViewport(e->pos()));
782 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); 826 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
783 Parent::contentsMouseMoveEvent(e); 827 Parent::mouseMoveEvent(e);
784} 828}
785 829
786void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) 830void ConfigList::mouseDoubleClickEvent(QMouseEvent* e)
787{ 831{
788 QPoint p(contentsToViewport(e->pos())); 832 QPoint p = e->pos(); // TODO: Check if this works(was contentsToViewport).
789 ConfigItem* item = (ConfigItem*)itemAt(p); 833 ConfigItem* item = (ConfigItem*)itemAt(p);
790 struct menu *menu; 834 struct menu *menu;
791 enum prop_type ptype; 835 enum prop_type ptype;
@@ -807,7 +851,7 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
807 851
808skip: 852skip:
809 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); 853 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
810 Parent::contentsMouseDoubleClickEvent(e); 854 Parent::mouseDoubleClickEvent(e);
811} 855}
812 856
813void ConfigList::focusInEvent(QFocusEvent *e) 857void ConfigList::focusInEvent(QFocusEvent *e)
@@ -818,7 +862,7 @@ void ConfigList::focusInEvent(QFocusEvent *e)
818 862
819 ConfigItem* item = (ConfigItem *)currentItem(); 863 ConfigItem* item = (ConfigItem *)currentItem();
820 if (item) { 864 if (item) {
821 setSelected(item, TRUE); 865 item->setSelected(true);
822 menu = item->menu; 866 menu = item->menu;
823 } 867 }
824 emit gotFocus(menu); 868 emit gotFocus(menu);
@@ -828,33 +872,33 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
828{ 872{
829 if (e->y() <= header()->geometry().bottom()) { 873 if (e->y() <= header()->geometry().bottom()) {
830 if (!headerPopup) { 874 if (!headerPopup) {
831 Q3Action *action; 875 QAction *action;
832 876
833 headerPopup = new Q3PopupMenu(this); 877 headerPopup = new QMenu(this);
834 action = new Q3Action(NULL, _("Show Name"), 0, this); 878 action = new QAction(_("Show Name"), this);
835 action->setToggleAction(TRUE); 879 action->setCheckable(true);
836 connect(action, SIGNAL(toggled(bool)), 880 connect(action, SIGNAL(toggled(bool)),
837 parent(), SLOT(setShowName(bool))); 881 parent(), SLOT(setShowName(bool)));
838 connect(parent(), SIGNAL(showNameChanged(bool)), 882 connect(parent(), SIGNAL(showNameChanged(bool)),
839 action, SLOT(setOn(bool))); 883 action, SLOT(setOn(bool)));
840 action->setOn(showName); 884 action->setChecked(showName);
841 action->addTo(headerPopup); 885 headerPopup->addAction(action);
842 action = new Q3Action(NULL, _("Show Range"), 0, this); 886 action = new QAction(_("Show Range"), this);
843 action->setToggleAction(TRUE); 887 action->setCheckable(true);
844 connect(action, SIGNAL(toggled(bool)), 888 connect(action, SIGNAL(toggled(bool)),
845 parent(), SLOT(setShowRange(bool))); 889 parent(), SLOT(setShowRange(bool)));
846 connect(parent(), SIGNAL(showRangeChanged(bool)), 890 connect(parent(), SIGNAL(showRangeChanged(bool)),
847 action, SLOT(setOn(bool))); 891 action, SLOT(setOn(bool)));
848 action->setOn(showRange); 892 action->setChecked(showRange);
849 action->addTo(headerPopup); 893 headerPopup->addAction(action);
850 action = new Q3Action(NULL, _("Show Data"), 0, this); 894 action = new QAction(_("Show Data"), this);
851 action->setToggleAction(TRUE); 895 action->setCheckable(true);
852 connect(action, SIGNAL(toggled(bool)), 896 connect(action, SIGNAL(toggled(bool)),
853 parent(), SLOT(setShowData(bool))); 897 parent(), SLOT(setShowData(bool)));
854 connect(parent(), SIGNAL(showDataChanged(bool)), 898 connect(parent(), SIGNAL(showDataChanged(bool)),
855 action, SLOT(setOn(bool))); 899 action, SLOT(setOn(bool)));
856 action->setOn(showData); 900 action->setChecked(showData);
857 action->addTo(headerPopup); 901 headerPopup->addAction(action);
858 } 902 }
859 headerPopup->exec(e->globalPos()); 903 headerPopup->exec(e->globalPos());
860 e->accept(); 904 e->accept();
@@ -868,11 +912,17 @@ QAction *ConfigView::showAllAction;
868QAction *ConfigView::showPromptAction; 912QAction *ConfigView::showPromptAction;
869 913
870ConfigView::ConfigView(QWidget* parent, const char *name) 914ConfigView::ConfigView(QWidget* parent, const char *name)
871 : Parent(parent, name) 915 : Parent(parent)
872{ 916{
873 list = new ConfigList(this, name); 917 setObjectName(name);
918 QVBoxLayout *verticalLayout = new QVBoxLayout(this);
919 verticalLayout->setContentsMargins(0, 0, 0, 0);
920
921 list = new ConfigList(this);
922 verticalLayout->addWidget(list);
874 lineEdit = new ConfigLineEdit(this); 923 lineEdit = new ConfigLineEdit(this);
875 lineEdit->hide(); 924 lineEdit->hide();
925 verticalLayout->addWidget(lineEdit);
876 926
877 this->nextView = viewList; 927 this->nextView = viewList;
878 viewList = this; 928 viewList = this;
@@ -931,10 +981,13 @@ void ConfigView::setShowData(bool b)
931 981
932void ConfigList::setAllOpen(bool open) 982void ConfigList::setAllOpen(bool open)
933{ 983{
934 Q3ListViewItemIterator it(this); 984 QTreeWidgetItemIterator it(this);
985
986 while (*it) {
987 (*it)->setExpanded(open);
935 988
936 for (; it.current(); it++) 989 ++it;
937 it.current()->setOpen(open); 990 }
938} 991}
939 992
940void ConfigView::updateList(ConfigItem* item) 993void ConfigView::updateList(ConfigItem* item)
@@ -954,11 +1007,14 @@ void ConfigView::updateListAll(void)
954} 1007}
955 1008
956ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 1009ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
957 : Parent(parent, name), sym(0), _menu(0) 1010 : Parent(parent), sym(0), _menu(0)
958{ 1011{
959 if (name) { 1012 setObjectName(name);
960 configSettings->beginGroup(name); 1013
961 _showDebug = configSettings->readBoolEntry("/showDebug", false); 1014
1015 if (!objectName().isEmpty()) {
1016 configSettings->beginGroup(objectName());
1017 _showDebug = configSettings->value("/showDebug", false).toBool();
962 configSettings->endGroup(); 1018 configSettings->endGroup();
963 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 1019 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
964 } 1020 }
@@ -966,9 +1022,9 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
966 1022
967void ConfigInfoView::saveSettings(void) 1023void ConfigInfoView::saveSettings(void)
968{ 1024{
969 if (name()) { 1025 if (!objectName().isEmpty()) {
970 configSettings->beginGroup(name()); 1026 configSettings->beginGroup(objectName());
971 configSettings->writeEntry("/showDebug", showDebug()); 1027 configSettings->setValue("/showDebug", showDebug());
972 configSettings->endGroup(); 1028 configSettings->endGroup();
973 } 1029 }
974} 1030}
@@ -1127,8 +1183,8 @@ QString ConfigInfoView::print_filter(const QString &str)
1127{ 1183{
1128 QRegExp re("[<>&\"\\n]"); 1184 QRegExp re("[<>&\"\\n]");
1129 QString res = str; 1185 QString res = str;
1130 for (int i = 0; (i = res.find(re, i)) >= 0;) { 1186 for (int i = 0; (i = res.indexOf(re, i)) >= 0;) {
1131 switch (res[i].latin1()) { 1187 switch (res[i].toLatin1()) {
1132 case '<': 1188 case '<':
1133 res.replace(i, 1, "&lt;"); 1189 res.replace(i, 1, "&lt;");
1134 i += 4; 1190 i += 4;
@@ -1167,37 +1223,42 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1167 *text += str2; 1223 *text += str2;
1168} 1224}
1169 1225
1170Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) 1226QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
1171{ 1227{
1172 Q3PopupMenu* popup = Parent::createPopupMenu(pos); 1228 QMenu* popup = Parent::createStandardContextMenu(pos);
1173 Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); 1229 QAction* action = new QAction(_("Show Debug Info"), popup);
1174 action->setToggleAction(TRUE); 1230 action->setCheckable(true);
1175 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1231 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1176 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1232 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
1177 action->setOn(showDebug()); 1233 action->setChecked(showDebug());
1178 popup->insertSeparator(); 1234 popup->addSeparator();
1179 action->addTo(popup); 1235 popup->addAction(action);
1180 return popup; 1236 return popup;
1181} 1237}
1182 1238
1183void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e) 1239void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e)
1184{ 1240{
1185 Parent::contentsContextMenuEvent(e); 1241 Parent::contextMenuEvent(e);
1186} 1242}
1187 1243
1188ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) 1244ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
1189 : Parent(parent, name), result(NULL) 1245 : Parent(parent), result(NULL)
1190{ 1246{
1191 setCaption("Search Config"); 1247 setObjectName(name);
1248 setWindowTitle("Search Config");
1192 1249
1193 QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); 1250 QVBoxLayout* layout1 = new QVBoxLayout(this);
1194 QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); 1251 layout1->setContentsMargins(11, 11, 11, 11);
1252 layout1->setSpacing(6);
1253 QHBoxLayout* layout2 = new QHBoxLayout(0);
1254 layout2->setContentsMargins(0, 0, 0, 0);
1255 layout2->setSpacing(6);
1195 layout2->addWidget(new QLabel(_("Find:"), this)); 1256 layout2->addWidget(new QLabel(_("Find:"), this));
1196 editField = new QLineEdit(this); 1257 editField = new QLineEdit(this);
1197 connect(editField, SIGNAL(returnPressed()), SLOT(search())); 1258 connect(editField, SIGNAL(returnPressed()), SLOT(search()));
1198 layout2->addWidget(editField); 1259 layout2->addWidget(editField);
1199 searchButton = new QPushButton(_("Search"), this); 1260 searchButton = new QPushButton(_("Search"), this);
1200 searchButton->setAutoDefault(FALSE); 1261 searchButton->setAutoDefault(false);
1201 connect(searchButton, SIGNAL(clicked()), SLOT(search())); 1262 connect(searchButton, SIGNAL(clicked()), SLOT(search()));
1202 layout2->addWidget(searchButton); 1263 layout2->addWidget(searchButton);
1203 layout1->addLayout(layout2); 1264 layout1->addLayout(layout2);
@@ -1215,19 +1276,19 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1215 layout1->addWidget(split); 1276 layout1->addWidget(split);
1216 1277
1217 if (name) { 1278 if (name) {
1218 int x, y, width, height; 1279 QVariant x, y;
1280 int width, height;
1219 bool ok; 1281 bool ok;
1220 1282
1221 configSettings->beginGroup(name); 1283 configSettings->beginGroup(name);
1222 width = configSettings->readNumEntry("/window width", parent->width() / 2); 1284 width = configSettings->value("/window width", parent->width() / 2).toInt();
1223 height = configSettings->readNumEntry("/window height", parent->height() / 2); 1285 height = configSettings->value("/window height", parent->height() / 2).toInt();
1224 resize(width, height); 1286 resize(width, height);
1225 x = configSettings->readNumEntry("/window x", 0, &ok); 1287 x = configSettings->value("/window x");
1226 if (ok) 1288 y = configSettings->value("/window y");
1227 y = configSettings->readNumEntry("/window y", 0, &ok); 1289 if ((x.isValid())&&(y.isValid()))
1228 if (ok) 1290 move(x.toInt(), y.toInt());
1229 move(x, y); 1291 QList<int> sizes = configSettings->readSizes("/split", &ok);
1230 Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
1231 if (ok) 1292 if (ok)
1232 split->setSizes(sizes); 1293 split->setSizes(sizes);
1233 configSettings->endGroup(); 1294 configSettings->endGroup();
@@ -1237,12 +1298,12 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1237 1298
1238void ConfigSearchWindow::saveSettings(void) 1299void ConfigSearchWindow::saveSettings(void)
1239{ 1300{
1240 if (name()) { 1301 if (!objectName().isEmpty()) {
1241 configSettings->beginGroup(name()); 1302 configSettings->beginGroup(objectName());
1242 configSettings->writeEntry("/window x", pos().x()); 1303 configSettings->setValue("/window x", pos().x());
1243 configSettings->writeEntry("/window y", pos().y()); 1304 configSettings->setValue("/window y", pos().y());
1244 configSettings->writeEntry("/window width", size().width()); 1305 configSettings->setValue("/window width", size().width());
1245 configSettings->writeEntry("/window height", size().height()); 1306 configSettings->setValue("/window height", size().height());
1246 configSettings->writeSizes("/split", split->sizes()); 1307 configSettings->writeSizes("/split", split->sizes());
1247 configSettings->endGroup(); 1308 configSettings->endGroup();
1248 } 1309 }
@@ -1258,7 +1319,7 @@ void ConfigSearchWindow::search(void)
1258 list->list->clear(); 1319 list->list->clear();
1259 info->clear(); 1320 info->clear();
1260 1321
1261 result = sym_re_search(editField->text().latin1()); 1322 result = sym_re_search(editField->text().toLatin1());
1262 if (!result) 1323 if (!result)
1263 return; 1324 return;
1264 for (p = result; *p; p++) { 1325 for (p = result; *p; p++) {
@@ -1275,29 +1336,25 @@ ConfigMainWindow::ConfigMainWindow(void)
1275 : searchWindow(0) 1336 : searchWindow(0)
1276{ 1337{
1277 QMenuBar* menu; 1338 QMenuBar* menu;
1278 bool ok; 1339 bool ok = true;
1279 int x, y, width, height; 1340 QVariant x, y;
1341 int width, height;
1280 char title[256]; 1342 char title[256];
1281 1343
1282 QDesktopWidget *d = configApp->desktop(); 1344 QDesktopWidget *d = configApp->desktop();
1283 snprintf(title, sizeof(title), "%s%s", 1345 snprintf(title, sizeof(title), "%s%s",
1284 rootmenu.prompt->text, 1346 rootmenu.prompt->text,
1285#if QT_VERSION < 0x040000
1286 " (Qt3)"
1287#else
1288 "" 1347 ""
1289#endif
1290 ); 1348 );
1291 setCaption(title); 1349 setWindowTitle(title);
1292 1350
1293 width = configSettings->readNumEntry("/window width", d->width() - 64); 1351 width = configSettings->value("/window width", d->width() - 64).toInt();
1294 height = configSettings->readNumEntry("/window height", d->height() - 64); 1352 height = configSettings->value("/window height", d->height() - 64).toInt();
1295 resize(width, height); 1353 resize(width, height);
1296 x = configSettings->readNumEntry("/window x", 0, &ok); 1354 x = configSettings->value("/window x");
1297 if (ok) 1355 y = configSettings->value("/window y");
1298 y = configSettings->readNumEntry("/window y", 0, &ok); 1356 if ((x.isValid())&&(y.isValid()))
1299 if (ok) 1357 move(x.toInt(), y.toInt());
1300 move(x, y);
1301 1358
1302 split1 = new QSplitter(this); 1359 split1 = new QSplitter(this);
1303 split1->setOrientation(Qt::Horizontal); 1360 split1->setOrientation(Qt::Horizontal);
@@ -1314,127 +1371,115 @@ ConfigMainWindow::ConfigMainWindow(void)
1314 configList = configView->list; 1371 configList = configView->list;
1315 1372
1316 helpText = new ConfigInfoView(split2, "help"); 1373 helpText = new ConfigInfoView(split2, "help");
1317 helpText->setTextFormat(Qt::RichText);
1318 1374
1319 setTabOrder(configList, helpText); 1375 setTabOrder(configList, helpText);
1320 configList->setFocus(); 1376 configList->setFocus();
1321 1377
1322 menu = menuBar(); 1378 menu = menuBar();
1323 toolBar = new Q3ToolBar("Tools", this); 1379 toolBar = new QToolBar("Tools", this);
1324 1380 addToolBar(toolBar);
1325 backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); 1381
1326 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1382 backAction = new QAction(QPixmap(xpm_back), _("Back"), this);
1327 backAction->setEnabled(FALSE); 1383 connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
1328 Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); 1384 backAction->setEnabled(false);
1329 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1385 QAction *quitAction = new QAction(_("&Quit"), this);
1330 Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); 1386 quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
1331 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1387 connect(quitAction, SIGNAL(triggered(bool)), SLOT(close()));
1332 saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); 1388 QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this);
1333 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1389 loadAction->setShortcut(Qt::CTRL + Qt::Key_L);
1390 connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig()));
1391 saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this);
1392 saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
1393 connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
1334 conf_set_changed_callback(conf_changed); 1394 conf_set_changed_callback(conf_changed);
1335 // Set saveAction's initial state 1395 // Set saveAction's initial state
1336 conf_changed(); 1396 conf_changed();
1337 Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); 1397 QAction *saveAsAction = new QAction(_("Save &As..."), this);
1338 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1398 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
1339 Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); 1399 QAction *searchAction = new QAction(_("&Find"), this);
1340 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1400 searchAction->setShortcut(Qt::CTRL + Qt::Key_F);
1341 Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); 1401 connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig()));
1342 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1402 singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this);
1343 Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); 1403 singleViewAction->setCheckable(true);
1344 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 1404 connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView()));
1345 Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); 1405 splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this);
1346 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1406 splitViewAction->setCheckable(true);
1347 1407 connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView()));
1348 Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); 1408 fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this);
1349 showNameAction->setToggleAction(TRUE); 1409 fullViewAction->setCheckable(true);
1410 connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView()));
1411
1412 QAction *showNameAction = new QAction(_("Show Name"), this);
1413 showNameAction->setCheckable(true);
1350 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1414 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1351 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1415 showNameAction->setChecked(configView->showName());
1352 showNameAction->setOn(configView->showName()); 1416 QAction *showRangeAction = new QAction(_("Show Range"), this);
1353 Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); 1417 showRangeAction->setCheckable(true);
1354 showRangeAction->setToggleAction(TRUE);
1355 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1418 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1356 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1419 QAction *showDataAction = new QAction(_("Show Data"), this);
1357 showRangeAction->setOn(configList->showRange); 1420 showDataAction->setCheckable(true);
1358 Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
1359 showDataAction->setToggleAction(TRUE);
1360 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1421 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1361 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
1362 showDataAction->setOn(configList->showData);
1363 1422
1364 QActionGroup *optGroup = new QActionGroup(this); 1423 QActionGroup *optGroup = new QActionGroup(this);
1365 optGroup->setExclusive(TRUE); 1424 optGroup->setExclusive(true);
1366 connect(optGroup, SIGNAL(selected(QAction *)), configView, 1425 connect(optGroup, SIGNAL(triggered(QAction*)), configView,
1367 SLOT(setOptionMode(QAction *))); 1426 SLOT(setOptionMode(QAction *)));
1368 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1427 connect(optGroup, SIGNAL(triggered(QAction *)), menuView,
1369 SLOT(setOptionMode(QAction *))); 1428 SLOT(setOptionMode(QAction *)));
1370 1429
1371#if QT_VERSION >= 0x040000
1372 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); 1430 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
1373 configView->showAllAction = new QAction(_("Show All Options"), optGroup); 1431 configView->showAllAction = new QAction(_("Show All Options"), optGroup);
1374 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); 1432 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
1375#else 1433 configView->showNormalAction->setCheckable(true);
1376 configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup); 1434 configView->showAllAction->setCheckable(true);
1377 configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup); 1435 configView->showPromptAction->setCheckable(true);
1378 configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup); 1436
1379#endif 1437 QAction *showDebugAction = new QAction( _("Show Debug Info"), this);
1380 configView->showNormalAction->setToggleAction(TRUE); 1438 showDebugAction->setCheckable(true);
1381 configView->showNormalAction->setOn(configList->optMode == normalOpt);
1382 configView->showAllAction->setToggleAction(TRUE);
1383 configView->showAllAction->setOn(configList->optMode == allOpt);
1384 configView->showPromptAction->setToggleAction(TRUE);
1385 configView->showPromptAction->setOn(configList->optMode == promptOpt);
1386
1387 Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
1388 showDebugAction->setToggleAction(TRUE);
1389 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1439 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1390 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1440 showDebugAction->setChecked(helpText->showDebug());
1391 showDebugAction->setOn(helpText->showDebug());
1392 1441
1393 Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); 1442 QAction *showIntroAction = new QAction( _("Introduction"), this);
1394 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1443 connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro()));
1395 Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); 1444 QAction *showAboutAction = new QAction( _("About"), this);
1396 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1445 connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout()));
1397 1446
1398 // init tool bar 1447 // init tool bar
1399 backAction->addTo(toolBar); 1448 toolBar->addAction(backAction);
1400 toolBar->addSeparator(); 1449 toolBar->addSeparator();
1401 loadAction->addTo(toolBar); 1450 toolBar->addAction(loadAction);
1402 saveAction->addTo(toolBar); 1451 toolBar->addAction(saveAction);
1403 toolBar->addSeparator(); 1452 toolBar->addSeparator();
1404 singleViewAction->addTo(toolBar); 1453 toolBar->addAction(singleViewAction);
1405 splitViewAction->addTo(toolBar); 1454 toolBar->addAction(splitViewAction);
1406 fullViewAction->addTo(toolBar); 1455 toolBar->addAction(fullViewAction);
1407 1456
1408 // create config menu 1457 // create config menu
1409 Q3PopupMenu* config = new Q3PopupMenu(this); 1458 QMenu* config = menu->addMenu(_("&File"));
1410 menu->insertItem(_("&File"), config); 1459 config->addAction(loadAction);
1411 loadAction->addTo(config); 1460 config->addAction(saveAction);
1412 saveAction->addTo(config); 1461 config->addAction(saveAsAction);
1413 saveAsAction->addTo(config); 1462 config->addSeparator();
1414 config->insertSeparator(); 1463 config->addAction(quitAction);
1415 quitAction->addTo(config);
1416 1464
1417 // create edit menu 1465 // create edit menu
1418 Q3PopupMenu* editMenu = new Q3PopupMenu(this); 1466 QMenu* editMenu = menu->addMenu(_("&Edit"));
1419 menu->insertItem(_("&Edit"), editMenu); 1467 editMenu->addAction(searchAction);
1420 searchAction->addTo(editMenu);
1421 1468
1422 // create options menu 1469 // create options menu
1423 Q3PopupMenu* optionMenu = new Q3PopupMenu(this); 1470 QMenu* optionMenu = menu->addMenu(_("&Option"));
1424 menu->insertItem(_("&Option"), optionMenu); 1471 optionMenu->addAction(showNameAction);
1425 showNameAction->addTo(optionMenu); 1472 optionMenu->addAction(showRangeAction);
1426 showRangeAction->addTo(optionMenu); 1473 optionMenu->addAction(showDataAction);
1427 showDataAction->addTo(optionMenu); 1474 optionMenu->addSeparator();
1428 optionMenu->insertSeparator(); 1475 optionMenu->addActions(optGroup->actions());
1429 optGroup->addTo(optionMenu); 1476 optionMenu->addSeparator();
1430 optionMenu->insertSeparator();
1431 1477
1432 // create help menu 1478 // create help menu
1433 Q3PopupMenu* helpMenu = new Q3PopupMenu(this); 1479 menu->addSeparator();
1434 menu->insertSeparator(); 1480 QMenu* helpMenu = menu->addMenu(_("&Help"));
1435 menu->insertItem(_("&Help"), helpMenu); 1481 helpMenu->addAction(showIntroAction);
1436 showIntroAction->addTo(helpMenu); 1482 helpMenu->addAction(showAboutAction);
1437 showAboutAction->addTo(helpMenu);
1438 1483
1439 connect(configList, SIGNAL(menuChanged(struct menu *)), 1484 connect(configList, SIGNAL(menuChanged(struct menu *)),
1440 helpText, SLOT(setInfo(struct menu *))); 1485 helpText, SLOT(setInfo(struct menu *)));
@@ -1456,7 +1501,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1456 connect(helpText, SIGNAL(menuSelected(struct menu *)), 1501 connect(helpText, SIGNAL(menuSelected(struct menu *)),
1457 SLOT(setMenuLink(struct menu *))); 1502 SLOT(setMenuLink(struct menu *)));
1458 1503
1459 QString listMode = configSettings->readEntry("/listMode", "symbol"); 1504 QString listMode = configSettings->value("/listMode", "symbol").toString();
1460 if (listMode == "single") 1505 if (listMode == "single")
1461 showSingleView(); 1506 showSingleView();
1462 else if (listMode == "full") 1507 else if (listMode == "full")
@@ -1465,7 +1510,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1465 showSplitView(); 1510 showSplitView();
1466 1511
1467 // UI setup done, restore splitter positions 1512 // UI setup done, restore splitter positions
1468 Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); 1513 QList<int> sizes = configSettings->readSizes("/split1", &ok);
1469 if (ok) 1514 if (ok)
1470 split1->setSizes(sizes); 1515 split1->setSizes(sizes);
1471 1516
@@ -1476,7 +1521,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1476 1521
1477void ConfigMainWindow::loadConfig(void) 1522void ConfigMainWindow::loadConfig(void)
1478{ 1523{
1479 QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); 1524 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname());
1480 if (s.isNull()) 1525 if (s.isNull())
1481 return; 1526 return;
1482 if (conf_read(QFile::encodeName(s))) 1527 if (conf_read(QFile::encodeName(s)))
@@ -1495,7 +1540,7 @@ bool ConfigMainWindow::saveConfig(void)
1495 1540
1496void ConfigMainWindow::saveConfigAs(void) 1541void ConfigMainWindow::saveConfigAs(void)
1497{ 1542{
1498 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); 1543 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname());
1499 if (s.isNull()) 1544 if (s.isNull())
1500 return; 1545 return;
1501 saveConfig(); 1546 saveConfig();
@@ -1512,9 +1557,9 @@ void ConfigMainWindow::changeMenu(struct menu *menu)
1512{ 1557{
1513 configList->setRootMenu(menu); 1558 configList->setRootMenu(menu);
1514 if (configList->rootEntry->parent == &rootmenu) 1559 if (configList->rootEntry->parent == &rootmenu)
1515 backAction->setEnabled(FALSE); 1560 backAction->setEnabled(false);
1516 else 1561 else
1517 backAction->setEnabled(TRUE); 1562 backAction->setEnabled(true);
1518} 1563}
1519 1564
1520void ConfigMainWindow::setMenuLink(struct menu *menu) 1565void ConfigMainWindow::setMenuLink(struct menu *menu)
@@ -1546,8 +1591,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1546 return; 1591 return;
1547 item = menuList->findConfigItem(parent); 1592 item = menuList->findConfigItem(parent);
1548 if (item) { 1593 if (item) {
1549 menuList->setSelected(item, TRUE); 1594 item->setSelected(true);
1550 menuList->ensureItemVisible(item); 1595 menuList->scrollToItem(item);
1551 } 1596 }
1552 list->setRootMenu(parent); 1597 list->setRootMenu(parent);
1553 } 1598 }
@@ -1562,8 +1607,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1562 if (list) { 1607 if (list) {
1563 item = list->findConfigItem(menu); 1608 item = list->findConfigItem(menu);
1564 if (item) { 1609 if (item) {
1565 list->setSelected(item, TRUE); 1610 item->setSelected(true);
1566 list->ensureItemVisible(item); 1611 list->scrollToItem(item);
1567 list->setFocus(); 1612 list->setFocus();
1568 } 1613 }
1569 } 1614 }
@@ -1577,15 +1622,21 @@ void ConfigMainWindow::listFocusChanged(void)
1577 1622
1578void ConfigMainWindow::goBack(void) 1623void ConfigMainWindow::goBack(void)
1579{ 1624{
1580 ConfigItem* item; 1625 ConfigItem* item, *oldSelection;
1581 1626
1582 configList->setParentMenu(); 1627 configList->setParentMenu();
1583 if (configList->rootEntry == &rootmenu) 1628 if (configList->rootEntry == &rootmenu)
1584 backAction->setEnabled(FALSE); 1629 backAction->setEnabled(false);
1585 item = (ConfigItem*)menuList->selectedItem(); 1630
1631 if (menuList->selectedItems().count() == 0)
1632 return;
1633
1634 item = (ConfigItem*)menuList->selectedItems().first();
1635 oldSelection = item;
1586 while (item) { 1636 while (item) {
1587 if (item->menu == configList->rootEntry) { 1637 if (item->menu == configList->rootEntry) {
1588 menuList->setSelected(item, TRUE); 1638 oldSelection->setSelected(false);
1639 item->setSelected(true);
1589 break; 1640 break;
1590 } 1641 }
1591 item = (ConfigItem*)item->parent(); 1642 item = (ConfigItem*)item->parent();
@@ -1594,6 +1645,13 @@ void ConfigMainWindow::goBack(void)
1594 1645
1595void ConfigMainWindow::showSingleView(void) 1646void ConfigMainWindow::showSingleView(void)
1596{ 1647{
1648 singleViewAction->setEnabled(false);
1649 singleViewAction->setChecked(true);
1650 splitViewAction->setEnabled(true);
1651 splitViewAction->setChecked(false);
1652 fullViewAction->setEnabled(true);
1653 fullViewAction->setChecked(false);
1654
1597 menuView->hide(); 1655 menuView->hide();
1598 menuList->setRootMenu(0); 1656 menuList->setRootMenu(0);
1599 configList->mode = singleMode; 1657 configList->mode = singleMode;
@@ -1601,28 +1659,41 @@ void ConfigMainWindow::showSingleView(void)
1601 configList->updateListAll(); 1659 configList->updateListAll();
1602 else 1660 else
1603 configList->setRootMenu(&rootmenu); 1661 configList->setRootMenu(&rootmenu);
1604 configList->setAllOpen(TRUE);
1605 configList->setFocus(); 1662 configList->setFocus();
1606} 1663}
1607 1664
1608void ConfigMainWindow::showSplitView(void) 1665void ConfigMainWindow::showSplitView(void)
1609{ 1666{
1667 singleViewAction->setEnabled(true);
1668 singleViewAction->setChecked(false);
1669 splitViewAction->setEnabled(false);
1670 splitViewAction->setChecked(true);
1671 fullViewAction->setEnabled(true);
1672 fullViewAction->setChecked(false);
1673
1610 configList->mode = symbolMode; 1674 configList->mode = symbolMode;
1611 if (configList->rootEntry == &rootmenu) 1675 if (configList->rootEntry == &rootmenu)
1612 configList->updateListAll(); 1676 configList->updateListAll();
1613 else 1677 else
1614 configList->setRootMenu(&rootmenu); 1678 configList->setRootMenu(&rootmenu);
1615 configList->setAllOpen(TRUE); 1679 configList->setAllOpen(true);
1616 configApp->processEvents(); 1680 configApp->processEvents();
1617 menuList->mode = menuMode; 1681 menuList->mode = menuMode;
1618 menuList->setRootMenu(&rootmenu); 1682 menuList->setRootMenu(&rootmenu);
1619 menuList->setAllOpen(TRUE); 1683 menuList->setAllOpen(true);
1620 menuView->show(); 1684 menuView->show();
1621 menuList->setFocus(); 1685 menuList->setFocus();
1622} 1686}
1623 1687
1624void ConfigMainWindow::showFullView(void) 1688void ConfigMainWindow::showFullView(void)
1625{ 1689{
1690 singleViewAction->setEnabled(true);
1691 singleViewAction->setChecked(false);
1692 splitViewAction->setEnabled(true);
1693 splitViewAction->setChecked(false);
1694 fullViewAction->setEnabled(false);
1695 fullViewAction->setChecked(true);
1696
1626 menuView->hide(); 1697 menuView->hide();
1627 menuList->setRootMenu(0); 1698 menuList->setRootMenu(0);
1628 configList->mode = fullMode; 1699 configList->mode = fullMode;
@@ -1630,7 +1701,6 @@ void ConfigMainWindow::showFullView(void)
1630 configList->updateListAll(); 1701 configList->updateListAll();
1631 else 1702 else
1632 configList->setRootMenu(&rootmenu); 1703 configList->setRootMenu(&rootmenu);
1633 configList->setAllOpen(FALSE);
1634 configList->setFocus(); 1704 configList->setFocus();
1635} 1705}
1636 1706
@@ -1684,7 +1754,8 @@ void ConfigMainWindow::showIntro(void)
1684 1754
1685void ConfigMainWindow::showAbout(void) 1755void ConfigMainWindow::showAbout(void)
1686{ 1756{
1687 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" 1757 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n"
1758 "Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>.\n\n"
1688 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); 1759 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n");
1689 1760
1690 QMessageBox::information(this, "qconf", str); 1761 QMessageBox::information(this, "qconf", str);
@@ -1692,10 +1763,10 @@ void ConfigMainWindow::showAbout(void)
1692 1763
1693void ConfigMainWindow::saveSettings(void) 1764void ConfigMainWindow::saveSettings(void)
1694{ 1765{
1695 configSettings->writeEntry("/window x", pos().x()); 1766 configSettings->setValue("/window x", pos().x());
1696 configSettings->writeEntry("/window y", pos().y()); 1767 configSettings->setValue("/window y", pos().y());
1697 configSettings->writeEntry("/window width", size().width()); 1768 configSettings->setValue("/window width", size().width());
1698 configSettings->writeEntry("/window height", size().height()); 1769 configSettings->setValue("/window height", size().height());
1699 1770
1700 QString entry; 1771 QString entry;
1701 switch(configList->mode) { 1772 switch(configList->mode) {
@@ -1714,7 +1785,7 @@ void ConfigMainWindow::saveSettings(void)
1714 default: 1785 default:
1715 break; 1786 break;
1716 } 1787 }
1717 configSettings->writeEntry("/listMode", entry); 1788 configSettings->setValue("/listMode", entry);
1718 1789
1719 configSettings->writeSizes("/split1", split1->sizes()); 1790 configSettings->writeSizes("/split1", split1->sizes());
1720 configSettings->writeSizes("/split2", split2->sizes()); 1791 configSettings->writeSizes("/split2", split2->sizes());
@@ -1746,7 +1817,7 @@ static const char *progname;
1746 1817
1747static void usage(void) 1818static void usage(void)
1748{ 1819{
1749 printf(_("%s [-s] <config>\n"), progname); 1820 printf(_("%s [-s] <config>\n").toLatin1().constData(), progname);
1750 exit(0); 1821 exit(0);
1751} 1822}
1752 1823
@@ -1785,7 +1856,6 @@ int main(int ac, char** av)
1785 v = new ConfigMainWindow(); 1856 v = new ConfigMainWindow();
1786 1857
1787 //zconfdump(stdout); 1858 //zconfdump(stdout);
1788 configApp->setMainWidget(v);
1789 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); 1859 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1790 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); 1860 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
1791 v->show(); 1861 v->show();
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b6f9e8..a40036d1b059 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,18 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#if QT_VERSION < 0x040000 6#include <QTextBrowser>
7#include <qlistview.h> 7#include <QTreeWidget>
8#else 8#include <QMainWindow>
9#include <q3listview.h> 9#include <QHeaderView>
10#endif
11#include <qsettings.h> 10#include <qsettings.h>
12 11#include <QPushButton>
13#if QT_VERSION < 0x040000 12#include <QSettings>
14#define Q3ValueList QValueList 13#include <QLineEdit>
15#define Q3PopupMenu QPopupMenu 14#include <QSplitter>
16#define Q3ListView QListView 15#include <QCheckBox>
17#define Q3ListViewItem QListViewItem 16#include <QDialog>
18#define Q3VBox QVBox 17#include "expr.h"
19#define Q3TextBrowser QTextBrowser
20#define Q3MainWindow QMainWindow
21#define Q3Action QAction
22#define Q3ToolBar QToolBar
23#define Q3ListViewItemIterator QListViewItemIterator
24#define Q3FileDialog QFileDialog
25#endif
26 18
27class ConfigView; 19class ConfigView;
28class ConfigList; 20class ConfigList;
@@ -33,8 +25,8 @@ class ConfigMainWindow;
33class ConfigSettings : public QSettings { 25class ConfigSettings : public QSettings {
34public: 26public:
35 ConfigSettings(); 27 ConfigSettings();
36 Q3ValueList<int> readSizes(const QString& key, bool *ok); 28 QList<int> readSizes(const QString& key, bool *ok);
37 bool writeSizes(const QString& key, const Q3ValueList<int>& value); 29 bool writeSizes(const QString& key, const QList<int>& value);
38}; 30};
39 31
40enum colIdx { 32enum colIdx {
@@ -47,9 +39,9 @@ enum optionMode {
47 normalOpt = 0, allOpt, promptOpt 39 normalOpt = 0, allOpt, promptOpt
48}; 40};
49 41
50class ConfigList : public Q3ListView { 42class ConfigList : public QTreeWidget {
51 Q_OBJECT 43 Q_OBJECT
52 typedef class Q3ListView Parent; 44 typedef class QTreeWidget Parent;
53public: 45public:
54 ConfigList(ConfigView* p, const char *name = 0); 46 ConfigList(ConfigView* p, const char *name = 0);
55 void reinit(void); 47 void reinit(void);
@@ -61,10 +53,10 @@ public:
61 53
62protected: 54protected:
63 void keyPressEvent(QKeyEvent *e); 55 void keyPressEvent(QKeyEvent *e);
64 void contentsMousePressEvent(QMouseEvent *e); 56 void mousePressEvent(QMouseEvent *e);
65 void contentsMouseReleaseEvent(QMouseEvent *e); 57 void mouseReleaseEvent(QMouseEvent *e);
66 void contentsMouseMoveEvent(QMouseEvent *e); 58 void mouseMoveEvent(QMouseEvent *e);
67 void contentsMouseDoubleClickEvent(QMouseEvent *e); 59 void mouseDoubleClickEvent(QMouseEvent *e);
68 void focusInEvent(QFocusEvent *e); 60 void focusInEvent(QFocusEvent *e);
69 void contextMenuEvent(QContextMenuEvent *e); 61 void contextMenuEvent(QContextMenuEvent *e);
70 62
@@ -95,32 +87,23 @@ public:
95 } 87 }
96 ConfigItem* firstChild() const 88 ConfigItem* firstChild() const
97 { 89 {
98 return (ConfigItem *)Parent::firstChild(); 90 return (ConfigItem *)children().first();
99 }
100 int mapIdx(colIdx idx)
101 {
102 return colMap[idx];
103 } 91 }
104 void addColumn(colIdx idx, const QString& label) 92 void addColumn(colIdx idx)
105 { 93 {
106 colMap[idx] = Parent::addColumn(label); 94 showColumn(idx);
107 colRevMap[colMap[idx]] = idx;
108 } 95 }
109 void removeColumn(colIdx idx) 96 void removeColumn(colIdx idx)
110 { 97 {
111 int col = colMap[idx]; 98 hideColumn(idx);
112 if (col >= 0) {
113 Parent::removeColumn(col);
114 colRevMap[col] = colMap[idx] = -1;
115 }
116 } 99 }
117 void setAllOpen(bool open); 100 void setAllOpen(bool open);
118 void setParentMenu(void); 101 void setParentMenu(void);
119 102
120 bool menuSkip(struct menu *); 103 bool menuSkip(struct menu *);
121 104
122 template <class P> 105 void updateMenuList(ConfigItem *parent, struct menu*);
123 void updateMenuList(P*, struct menu*); 106 void updateMenuList(ConfigList *parent, struct menu*);
124 107
125 bool updateAll; 108 bool updateAll;
126 109
@@ -132,30 +115,26 @@ public:
132 enum listMode mode; 115 enum listMode mode;
133 enum optionMode optMode; 116 enum optionMode optMode;
134 struct menu *rootEntry; 117 struct menu *rootEntry;
135 QColorGroup disabledColorGroup; 118 QPalette disabledColorGroup;
136 QColorGroup inactivedColorGroup; 119 QPalette inactivedColorGroup;
137 Q3PopupMenu* headerPopup; 120 QMenu* headerPopup;
138
139private:
140 int colMap[colNr];
141 int colRevMap[colNr];
142}; 121};
143 122
144class ConfigItem : public Q3ListViewItem { 123class ConfigItem : public QTreeWidgetItem {
145 typedef class Q3ListViewItem Parent; 124 typedef class QTreeWidgetItem Parent;
146public: 125public:
147 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v) 126 ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
148 : Parent(parent, after), menu(m), visible(v), goParent(false) 127 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
149 { 128 {
150 init(); 129 init();
151 } 130 }
152 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) 131 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
153 : Parent(parent, after), menu(m), visible(v), goParent(false) 132 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
154 { 133 {
155 init(); 134 init();
156 } 135 }
157 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v) 136 ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
158 : Parent(parent, after), menu(0), visible(v), goParent(true) 137 : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
159 { 138 {
160 init(); 139 init();
161 } 140 }
@@ -166,33 +145,43 @@ public:
166 void testUpdateMenu(bool v); 145 void testUpdateMenu(bool v);
167 ConfigList* listView() const 146 ConfigList* listView() const
168 { 147 {
169 return (ConfigList*)Parent::listView(); 148 return (ConfigList*)Parent::treeWidget();
170 } 149 }
171 ConfigItem* firstChild() const 150 ConfigItem* firstChild() const
172 { 151 {
173 return (ConfigItem *)Parent::firstChild(); 152 return (ConfigItem *)Parent::child(0);
174 } 153 }
175 ConfigItem* nextSibling() const 154 ConfigItem* nextSibling()
176 { 155 {
177 return (ConfigItem *)Parent::nextSibling(); 156 ConfigItem *ret = NULL;
157 ConfigItem *_parent = (ConfigItem *)parent();
158
159 if(_parent) {
160 ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1);
161 } else {
162 QTreeWidget *_treeWidget = treeWidget();
163 ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1);
164 }
165
166 return ret;
178 } 167 }
179 void setText(colIdx idx, const QString& text) 168 void setText(colIdx idx, const QString& text)
180 { 169 {
181 Parent::setText(listView()->mapIdx(idx), text); 170 Parent::setText(idx, text);
182 } 171 }
183 QString text(colIdx idx) const 172 QString text(colIdx idx) const
184 { 173 {
185 return Parent::text(listView()->mapIdx(idx)); 174 return Parent::text(idx);
186 } 175 }
187 void setPixmap(colIdx idx, const QPixmap& pm) 176 void setPixmap(colIdx idx, const QIcon &icon)
188 { 177 {
189 Parent::setPixmap(listView()->mapIdx(idx), pm); 178 Parent::setIcon(idx, icon);
190 } 179 }
191 const QPixmap* pixmap(colIdx idx) const 180 const QIcon pixmap(colIdx idx) const
192 { 181 {
193 return Parent::pixmap(listView()->mapIdx(idx)); 182 return icon(idx);
194 } 183 }
195 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); 184 // TODO: Implement paintCell
196 185
197 ConfigItem* nextItem; 186 ConfigItem* nextItem;
198 struct menu *menu; 187 struct menu *menu;
@@ -216,9 +205,9 @@ public:
216 ConfigItem *item; 205 ConfigItem *item;
217}; 206};
218 207
219class ConfigView : public Q3VBox { 208class ConfigView : public QWidget {
220 Q_OBJECT 209 Q_OBJECT
221 typedef class Q3VBox Parent; 210 typedef class QWidget Parent;
222public: 211public:
223 ConfigView(QWidget* parent, const char *name = 0); 212 ConfigView(QWidget* parent, const char *name = 0);
224 ~ConfigView(void); 213 ~ConfigView(void);
@@ -249,9 +238,9 @@ public:
249 static QAction *showPromptAction; 238 static QAction *showPromptAction;
250}; 239};
251 240
252class ConfigInfoView : public Q3TextBrowser { 241class ConfigInfoView : public QTextBrowser {
253 Q_OBJECT 242 Q_OBJECT
254 typedef class Q3TextBrowser Parent; 243 typedef class QTextBrowser Parent;
255public: 244public:
256 ConfigInfoView(QWidget* parent, const char *name = 0); 245 ConfigInfoView(QWidget* parent, const char *name = 0);
257 bool showDebug(void) const { return _showDebug; } 246 bool showDebug(void) const { return _showDebug; }
@@ -271,8 +260,8 @@ protected:
271 QString debug_info(struct symbol *sym); 260 QString debug_info(struct symbol *sym);
272 static QString print_filter(const QString &str); 261 static QString print_filter(const QString &str);
273 static void expr_print_help(void *data, struct symbol *sym, const char *str); 262 static void expr_print_help(void *data, struct symbol *sym, const char *str);
274 Q3PopupMenu* createPopupMenu(const QPoint& pos); 263 QMenu *createStandardContextMenu(const QPoint & pos);
275 void contentsContextMenuEvent(QContextMenuEvent *e); 264 void contextMenuEvent(QContextMenuEvent *e);
276 265
277 struct symbol *sym; 266 struct symbol *sym;
278 struct menu *_menu; 267 struct menu *_menu;
@@ -299,10 +288,10 @@ protected:
299 struct symbol **result; 288 struct symbol **result;
300}; 289};
301 290
302class ConfigMainWindow : public Q3MainWindow { 291class ConfigMainWindow : public QMainWindow {
303 Q_OBJECT 292 Q_OBJECT
304 293
305 static Q3Action *saveAction; 294 static QAction *saveAction;
306 static void conf_changed(void); 295 static void conf_changed(void);
307public: 296public:
308 ConfigMainWindow(void); 297 ConfigMainWindow(void);
@@ -331,8 +320,11 @@ protected:
331 ConfigView *configView; 320 ConfigView *configView;
332 ConfigList *configList; 321 ConfigList *configList;
333 ConfigInfoView *helpText; 322 ConfigInfoView *helpText;
334 Q3ToolBar *toolBar; 323 QToolBar *toolBar;
335 Q3Action *backAction; 324 QAction *backAction;
336 QSplitter* split1; 325 QAction *singleViewAction;
337 QSplitter* split2; 326 QAction *splitViewAction;
327 QAction *fullViewAction;
328 QSplitter *split1;
329 QSplitter *split2;
338}; 330};
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 50878dc025a5..25cf0c2c0c79 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1116,6 +1116,8 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1116 if (stack->sym == last_sym) 1116 if (stack->sym == last_sym)
1117 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1117 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1118 prop->file->name, prop->lineno); 1118 prop->file->name, prop->lineno);
1119 fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
1120 fprintf(stderr, "subsection \"Kconfig recursive dependency limitations\"\n");
1119 if (stack->expr) { 1121 if (stack->expr) {
1120 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1122 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1121 prop->file->name, prop->lineno, 1123 prop->file->name, prop->lineno,
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 9a08fb5c1af6..638a38e1b419 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -206,59 +206,73 @@ my $type_env = '(\$\w+)';
206# One for each output format 206# One for each output format
207 207
208# these work fairly well 208# these work fairly well
209my %highlights_html = ( $type_constant, "<i>\$1</i>", 209my @highlights_html = (
210 $type_func, "<b>\$1</b>", 210 [$type_constant, "<i>\$1</i>"],
211 $type_struct_xml, "<i>\$1</i>", 211 [$type_func, "<b>\$1</b>"],
212 $type_env, "<b><i>\$1</i></b>", 212 [$type_struct_xml, "<i>\$1</i>"],
213 $type_param, "<tt><b>\$1</b></tt>" ); 213 [$type_env, "<b><i>\$1</i></b>"],
214 [$type_param, "<tt><b>\$1</b></tt>"]
215 );
214my $local_lt = "\\\\\\\\lt:"; 216my $local_lt = "\\\\\\\\lt:";
215my $local_gt = "\\\\\\\\gt:"; 217my $local_gt = "\\\\\\\\gt:";
216my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 218my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
217 219
218# html version 5 220# html version 5
219my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", 221my @highlights_html5 = (
220 $type_func, "<span class=\"func\">\$1</span>", 222 [$type_constant, "<span class=\"const\">\$1</span>"],
221 $type_struct_xml, "<span class=\"struct\">\$1</span>", 223 [$type_func, "<span class=\"func\">\$1</span>"],
222 $type_env, "<span class=\"env\">\$1</span>", 224 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
223 $type_param, "<span class=\"param\">\$1</span>" ); 225 [$type_env, "<span class=\"env\">\$1</span>"],
226 [$type_param, "<span class=\"param\">\$1</span>]"]
227 );
224my $blankline_html5 = $local_lt . "br /" . $local_gt; 228my $blankline_html5 = $local_lt . "br /" . $local_gt;
225 229
226# XML, docbook format 230# XML, docbook format
227my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 231my @highlights_xml = (
228 $type_constant, "<constant>\$1</constant>", 232 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
229 $type_func, "<function>\$1</function>", 233 [$type_constant, "<constant>\$1</constant>"],
230 $type_struct_xml, "<structname>\$1</structname>", 234 [$type_struct_xml, "<structname>\$1</structname>"],
231 $type_env, "<envar>\$1</envar>", 235 [$type_param, "<parameter>\$1</parameter>"],
232 $type_param, "<parameter>\$1</parameter>" ); 236 [$type_func, "<function>\$1</function>"],
237 [$type_env, "<envar>\$1</envar>"]
238 );
233my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; 239my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
234 240
235# gnome, docbook format 241# gnome, docbook format
236my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>", 242my @highlights_gnome = (
237 $type_func, "<function>\$1</function>", 243 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
238 $type_struct, "<structname>\$1</structname>", 244 [$type_func, "<function>\$1</function>"],
239 $type_env, "<envar>\$1</envar>", 245 [$type_struct, "<structname>\$1</structname>"],
240 $type_param, "<parameter>\$1</parameter>" ); 246 [$type_env, "<envar>\$1</envar>"],
247 [$type_param, "<parameter>\$1</parameter>" ]
248 );
241my $blankline_gnome = "</para><para>\n"; 249my $blankline_gnome = "</para><para>\n";
242 250
243# these are pretty rough 251# these are pretty rough
244my %highlights_man = ( $type_constant, "\$1", 252my @highlights_man = (
245 $type_func, "\\\\fB\$1\\\\fP", 253 [$type_constant, "\$1"],
246 $type_struct, "\\\\fI\$1\\\\fP", 254 [$type_func, "\\\\fB\$1\\\\fP"],
247 $type_param, "\\\\fI\$1\\\\fP" ); 255 [$type_struct, "\\\\fI\$1\\\\fP"],
256 [$type_param, "\\\\fI\$1\\\\fP"]
257 );
248my $blankline_man = ""; 258my $blankline_man = "";
249 259
250# text-mode 260# text-mode
251my %highlights_text = ( $type_constant, "\$1", 261my @highlights_text = (
252 $type_func, "\$1", 262 [$type_constant, "\$1"],
253 $type_struct, "\$1", 263 [$type_func, "\$1"],
254 $type_param, "\$1" ); 264 [$type_struct, "\$1"],
265 [$type_param, "\$1"]
266 );
255my $blankline_text = ""; 267my $blankline_text = "";
256 268
257# list mode 269# list mode
258my %highlights_list = ( $type_constant, "\$1", 270my @highlights_list = (
259 $type_func, "\$1", 271 [$type_constant, "\$1"],
260 $type_struct, "\$1", 272 [$type_func, "\$1"],
261 $type_param, "\$1" ); 273 [$type_struct, "\$1"],
274 [$type_param, "\$1"]
275 );
262my $blankline_list = ""; 276my $blankline_list = "";
263 277
264# read arguments 278# read arguments
@@ -273,7 +287,7 @@ my $verbose = 0;
273my $output_mode = "man"; 287my $output_mode = "man";
274my $output_preformatted = 0; 288my $output_preformatted = 0;
275my $no_doc_sections = 0; 289my $no_doc_sections = 0;
276my %highlights = %highlights_man; 290my @highlights = @highlights_man;
277my $blankline = $blankline_man; 291my $blankline = $blankline_man;
278my $modulename = "Kernel API"; 292my $modulename = "Kernel API";
279my $function_only = 0; 293my $function_only = 0;
@@ -374,31 +388,31 @@ while ($ARGV[0] =~ m/^-(.*)/) {
374 my $cmd = shift @ARGV; 388 my $cmd = shift @ARGV;
375 if ($cmd eq "-html") { 389 if ($cmd eq "-html") {
376 $output_mode = "html"; 390 $output_mode = "html";
377 %highlights = %highlights_html; 391 @highlights = @highlights_html;
378 $blankline = $blankline_html; 392 $blankline = $blankline_html;
379 } elsif ($cmd eq "-html5") { 393 } elsif ($cmd eq "-html5") {
380 $output_mode = "html5"; 394 $output_mode = "html5";
381 %highlights = %highlights_html5; 395 @highlights = @highlights_html5;
382 $blankline = $blankline_html5; 396 $blankline = $blankline_html5;
383 } elsif ($cmd eq "-man") { 397 } elsif ($cmd eq "-man") {
384 $output_mode = "man"; 398 $output_mode = "man";
385 %highlights = %highlights_man; 399 @highlights = @highlights_man;
386 $blankline = $blankline_man; 400 $blankline = $blankline_man;
387 } elsif ($cmd eq "-text") { 401 } elsif ($cmd eq "-text") {
388 $output_mode = "text"; 402 $output_mode = "text";
389 %highlights = %highlights_text; 403 @highlights = @highlights_text;
390 $blankline = $blankline_text; 404 $blankline = $blankline_text;
391 } elsif ($cmd eq "-docbook") { 405 } elsif ($cmd eq "-docbook") {
392 $output_mode = "xml"; 406 $output_mode = "xml";
393 %highlights = %highlights_xml; 407 @highlights = @highlights_xml;
394 $blankline = $blankline_xml; 408 $blankline = $blankline_xml;
395 } elsif ($cmd eq "-list") { 409 } elsif ($cmd eq "-list") {
396 $output_mode = "list"; 410 $output_mode = "list";
397 %highlights = %highlights_list; 411 @highlights = @highlights_list;
398 $blankline = $blankline_list; 412 $blankline = $blankline_list;
399 } elsif ($cmd eq "-gnome") { 413 } elsif ($cmd eq "-gnome") {
400 $output_mode = "gnome"; 414 $output_mode = "gnome";
401 %highlights = %highlights_gnome; 415 @highlights = @highlights_gnome;
402 $blankline = $blankline_gnome; 416 $blankline = $blankline_gnome;
403 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 417 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
404 $modulename = shift @ARGV; 418 $modulename = shift @ARGV;
@@ -1746,7 +1760,7 @@ sub output_declaration {
1746 my $func = "output_${functype}_$output_mode"; 1760 my $func = "output_${functype}_$output_mode";
1747 if (($function_only==0) || 1761 if (($function_only==0) ||
1748 ( $function_only == 1 && defined($function_table{$name})) || 1762 ( $function_only == 1 && defined($function_table{$name})) ||
1749 ( $function_only == 2 && !defined($function_table{$name}))) 1763 ( $function_only == 2 && !($functype eq "function" && defined($function_table{$name}))))
1750 { 1764 {
1751 &$func(@_); 1765 &$func(@_);
1752 $section_counter++; 1766 $section_counter++;
@@ -1791,8 +1805,8 @@ sub dump_struct($$) {
1791 $nested = $1; 1805 $nested = $1;
1792 1806
1793 # ignore members marked private: 1807 # ignore members marked private:
1794 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; 1808 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
1795 $members =~ s/\/\*\s*private:.*//gos; 1809 $members =~ s/\/\*\s*private:.*//gosi;
1796 # strip comments: 1810 # strip comments:
1797 $members =~ s/\/\*.*?\*\///gos; 1811 $members =~ s/\/\*.*?\*\///gos;
1798 $nested =~ s/\/\*.*?\*\///gos; 1812 $nested =~ s/\/\*.*?\*\///gos;
@@ -1869,6 +1883,31 @@ sub dump_typedef($$) {
1869 my $file = shift; 1883 my $file = shift;
1870 1884
1871 $x =~ s@/\*.*?\*/@@gos; # strip comments. 1885 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1886
1887 # Parse function prototypes
1888 if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/) {
1889 # Function typedefs
1890 $return_type = $1;
1891 $declaration_name = $2;
1892 my $args = $3;
1893
1894 create_parameterlist($args, ',', $file);
1895
1896 output_declaration($declaration_name,
1897 'function',
1898 {'function' => $declaration_name,
1899 'module' => $modulename,
1900 'functiontype' => $return_type,
1901 'parameterlist' => \@parameterlist,
1902 'parameterdescs' => \%parameterdescs,
1903 'parametertypes' => \%parametertypes,
1904 'sectionlist' => \@sectionlist,
1905 'sections' => \%sections,
1906 'purpose' => $declaration_purpose
1907 });
1908 return;
1909 }
1910
1872 while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) { 1911 while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
1873 $x =~ s/\(*.\)\s*;$/;/; 1912 $x =~ s/\(*.\)\s*;$/;/;
1874 $x =~ s/\[*.\]\s*;$/;/; 1913 $x =~ s/\[*.\]\s*;$/;/;
@@ -2391,12 +2430,13 @@ sub process_file($) {
2391 my $descr; 2430 my $descr;
2392 my $in_purpose = 0; 2431 my $in_purpose = 0;
2393 my $initial_section_counter = $section_counter; 2432 my $initial_section_counter = $section_counter;
2433 my ($orig_file) = @_;
2394 2434
2395 if (defined($ENV{'SRCTREE'})) { 2435 if (defined($ENV{'SRCTREE'})) {
2396 $file = "$ENV{'SRCTREE'}" . "/" . "@_"; 2436 $file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
2397 } 2437 }
2398 else { 2438 else {
2399 $file = "@_"; 2439 $file = $orig_file;
2400 } 2440 }
2401 if (defined($source_map{$file})) { 2441 if (defined($source_map{$file})) {
2402 $file = $source_map{$file}; 2442 $file = $source_map{$file};
@@ -2640,7 +2680,7 @@ sub process_file($) {
2640 print "<refentry>\n"; 2680 print "<refentry>\n";
2641 print " <refnamediv>\n"; 2681 print " <refnamediv>\n";
2642 print " <refname>\n"; 2682 print " <refname>\n";
2643 print " ${file}\n"; 2683 print " ${orig_file}\n";
2644 print " </refname>\n"; 2684 print " </refname>\n";
2645 print " <refpurpose>\n"; 2685 print " <refpurpose>\n";
2646 print " Document generation inconsistency\n"; 2686 print " Document generation inconsistency\n";
@@ -2654,7 +2694,7 @@ sub process_file($) {
2654 print " <para>\n"; 2694 print " <para>\n";
2655 print " The template for this document tried to insert\n"; 2695 print " The template for this document tried to insert\n";
2656 print " the structured comment from the file\n"; 2696 print " the structured comment from the file\n";
2657 print " <filename>${file}</filename> at this point,\n"; 2697 print " <filename>${orig_file}</filename> at this point,\n";
2658 print " but none was found.\n"; 2698 print " but none was found.\n";
2659 print " This dummy section is inserted to allow\n"; 2699 print " This dummy section is inserted to allow\n";
2660 print " generation to continue.\n"; 2700 print " generation to continue.\n";
@@ -2671,9 +2711,11 @@ $kernelversion = get_kernel_version();
2671 2711
2672# generate a sequence of code that will splice in highlighting information 2712# generate a sequence of code that will splice in highlighting information
2673# using the s// operator. 2713# using the s// operator.
2674foreach my $pattern (sort keys %highlights) { 2714for (my $k = 0; $k < @highlights; $k++) {
2675# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n"; 2715 my $pattern = $highlights[$k][0];
2676 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; 2716 my $result = $highlights[$k][1];
2717# print STDERR "scanning pattern:$pattern, highlight:($result)\n";
2718 $dohighlight .= "\$contents =~ s:$pattern:$result:gs;\n";
2677} 2719}
2678 2720
2679# Read the file that maps relative names to absolute names for 2721# Read the file that maps relative names to absolute names for
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index e70fcd12eeeb..840b97328b39 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -185,6 +185,7 @@ int main(void)
185 DEVID(mei_cl_device_id); 185 DEVID(mei_cl_device_id);
186 DEVID_FIELD(mei_cl_device_id, name); 186 DEVID_FIELD(mei_cl_device_id, name);
187 DEVID_FIELD(mei_cl_device_id, uuid); 187 DEVID_FIELD(mei_cl_device_id, uuid);
188 DEVID_FIELD(mei_cl_device_id, version);
188 189
189 DEVID(rio_device_id); 190 DEVID(rio_device_id);
190 DEVID_FIELD(rio_device_id, did); 191 DEVID_FIELD(rio_device_id, did);
@@ -196,5 +197,10 @@ int main(void)
196 DEVID_FIELD(ulpi_device_id, vendor); 197 DEVID_FIELD(ulpi_device_id, vendor);
197 DEVID_FIELD(ulpi_device_id, product); 198 DEVID_FIELD(ulpi_device_id, product);
198 199
200 DEVID(hda_device_id);
201 DEVID_FIELD(hda_device_id, vendor_id);
202 DEVID_FIELD(hda_device_id, rev_id);
203 DEVID_FIELD(hda_device_id, api_version);
204
199 return 0; 205 return 0;
200} 206}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 5f2088209132..5b96206e9aab 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -137,10 +137,12 @@ static inline void add_wildcard(char *str)
137static inline void add_uuid(char *str, uuid_le uuid) 137static inline void add_uuid(char *str, uuid_le uuid)
138{ 138{
139 int len = strlen(str); 139 int len = strlen(str);
140 int i;
141 140
142 for (i = 0; i < 16; i++) 141 sprintf(str + len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
143 sprintf(str + len + (i << 1), "%02x", uuid.b[i]); 142 uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
143 uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
144 uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
145 uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
144} 146}
145 147
146/** 148/**
@@ -1200,16 +1202,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias)
1200} 1202}
1201ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); 1203ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry);
1202 1204
1203/* Looks like: mei:S:uuid */ 1205/* Looks like: mei:S:uuid:N:* */
1204static int do_mei_entry(const char *filename, void *symval, 1206static int do_mei_entry(const char *filename, void *symval,
1205 char *alias) 1207 char *alias)
1206{ 1208{
1207 DEF_FIELD_ADDR(symval, mei_cl_device_id, name); 1209 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1208 DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid); 1210 DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid);
1211 DEF_FIELD(symval, mei_cl_device_id, version);
1209 1212
1210 sprintf(alias, MEI_CL_MODULE_PREFIX); 1213 sprintf(alias, MEI_CL_MODULE_PREFIX);
1211 sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); 1214 sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*");
1212 add_uuid(alias, *uuid); 1215 add_uuid(alias, *uuid);
1216 ADD(alias, ":", version != MEI_CL_VERSION_ANY, version);
1213 1217
1214 strcat(alias, ":*"); 1218 strcat(alias, ":*");
1215 1219
@@ -1250,6 +1254,23 @@ static int do_ulpi_entry(const char *filename, void *symval,
1250} 1254}
1251ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry); 1255ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry);
1252 1256
1257/* Looks like: hdaudio:vNrNaN */
1258static int do_hda_entry(const char *filename, void *symval, char *alias)
1259{
1260 DEF_FIELD(symval, hda_device_id, vendor_id);
1261 DEF_FIELD(symval, hda_device_id, rev_id);
1262 DEF_FIELD(symval, hda_device_id, api_version);
1263
1264 strcpy(alias, "hdaudio:");
1265 ADD(alias, "v", vendor_id != 0, vendor_id);
1266 ADD(alias, "r", rev_id != 0, rev_id);
1267 ADD(alias, "a", api_version != 0, api_version);
1268
1269 add_wildcard(alias);
1270 return 1;
1271}
1272ADD_TO_DEVTABLE("hdaudio", hda_device_id, do_hda_entry);
1273
1253/* Does namelen bytes of name exactly match the symbol? */ 1274/* Does namelen bytes of name exactly match the symbol? */
1254static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1275static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1255{ 1276{
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 12d3db3bd46b..e080746e1a6b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -38,6 +38,7 @@ static int warn_unresolved = 0;
38/* How a symbol is exported */ 38/* How a symbol is exported */
39static int sec_mismatch_count = 0; 39static int sec_mismatch_count = 0;
40static int sec_mismatch_verbose = 1; 40static int sec_mismatch_verbose = 1;
41static int sec_mismatch_fatal = 0;
41/* ignore missing files */ 42/* ignore missing files */
42static int ignore_missing_files; 43static int ignore_missing_files;
43 44
@@ -833,6 +834,8 @@ static const char *const section_white_list[] =
833 ".xt.lit", /* xtensa */ 834 ".xt.lit", /* xtensa */
834 ".arcextmap*", /* arc */ 835 ".arcextmap*", /* arc */
835 ".gnu.linkonce.arcext*", /* arc : modules */ 836 ".gnu.linkonce.arcext*", /* arc : modules */
837 ".cmem*", /* EZchip */
838 ".fmt_slot*", /* EZchip */
836 ".gnu.lto*", 839 ".gnu.lto*",
837 NULL 840 NULL
838}; 841};
@@ -2133,6 +2136,11 @@ static void add_staging_flag(struct buffer *b, const char *name)
2133 buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); 2136 buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
2134} 2137}
2135 2138
2139/* In kernel, this size is defined in linux/module.h;
2140 * here we use Elf_Addr instead of long for covering cross-compile
2141 */
2142#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
2143
2136/** 2144/**
2137 * Record CRCs for unresolved symbols 2145 * Record CRCs for unresolved symbols
2138 **/ 2146 **/
@@ -2177,6 +2185,12 @@ static int add_versions(struct buffer *b, struct module *mod)
2177 s->name, mod->name); 2185 s->name, mod->name);
2178 continue; 2186 continue;
2179 } 2187 }
2188 if (strlen(s->name) >= MODULE_NAME_LEN) {
2189 merror("too long symbol \"%s\" [%s.ko]\n",
2190 s->name, mod->name);
2191 err = 1;
2192 break;
2193 }
2180 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n", 2194 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
2181 s->crc, s->name); 2195 s->crc, s->name);
2182 } 2196 }
@@ -2374,7 +2388,7 @@ int main(int argc, char **argv)
2374 struct ext_sym_list *extsym_iter; 2388 struct ext_sym_list *extsym_iter;
2375 struct ext_sym_list *extsym_start = NULL; 2389 struct ext_sym_list *extsym_start = NULL;
2376 2390
2377 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) { 2391 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
2378 switch (opt) { 2392 switch (opt) {
2379 case 'i': 2393 case 'i':
2380 kernel_read = optarg; 2394 kernel_read = optarg;
@@ -2415,6 +2429,9 @@ int main(int argc, char **argv)
2415 case 'w': 2429 case 'w':
2416 warn_unresolved = 1; 2430 warn_unresolved = 1;
2417 break; 2431 break;
2432 case 'E':
2433 sec_mismatch_fatal = 1;
2434 break;
2418 default: 2435 default:
2419 exit(1); 2436 exit(1);
2420 } 2437 }
@@ -2464,14 +2481,20 @@ int main(int argc, char **argv)
2464 sprintf(fname, "%s.mod.c", mod->name); 2481 sprintf(fname, "%s.mod.c", mod->name);
2465 write_if_changed(&buf, fname); 2482 write_if_changed(&buf, fname);
2466 } 2483 }
2467
2468 if (dump_write) 2484 if (dump_write)
2469 write_dump(dump_write); 2485 write_dump(dump_write);
2470 if (sec_mismatch_count && !sec_mismatch_verbose) 2486 if (sec_mismatch_count) {
2471 warn("modpost: Found %d section mismatch(es).\n" 2487 if (!sec_mismatch_verbose) {
2472 "To see full details build your kernel with:\n" 2488 warn("modpost: Found %d section mismatch(es).\n"
2473 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", 2489 "To see full details build your kernel with:\n"
2474 sec_mismatch_count); 2490 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
2491 sec_mismatch_count);
2492 }
2493 if (sec_mismatch_fatal) {
2494 fatal("modpost: Section mismatches detected.\n"
2495 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
2496 }
2497 }
2475 2498
2476 return err; 2499 return err;
2477} 2500}
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 0cd46e129920..6c3b038ef40d 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -52,7 +52,16 @@ set_debarch() {
52 arm64) 52 arm64)
53 debarch=arm64 ;; 53 debarch=arm64 ;;
54 arm*) 54 arm*)
55 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; 55 if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then
56 if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then
57 debarch=armhf
58 else
59 debarch=armel
60 fi
61 else
62 debarch=arm
63 fi
64 ;;
56 *) 65 *)
57 debarch=$(dpkg --print-architecture) 66 debarch=$(dpkg --print-architecture)
58 echo "" >&2 67 echo "" >&2
@@ -115,7 +124,7 @@ esac
115BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" 124BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
116 125
117# Setup the directory structure 126# Setup the directory structure
118rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" 127rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
119mkdir -m 755 -p "$tmpdir/DEBIAN" 128mkdir -m 755 -p "$tmpdir/DEBIAN"
120mkdir -p "$tmpdir/lib" "$tmpdir/boot" 129mkdir -p "$tmpdir/lib" "$tmpdir/boot"
121mkdir -p "$fwdir/lib/firmware/$version/" 130mkdir -p "$fwdir/lib/firmware/$version/"
@@ -408,7 +417,7 @@ binary-arch:
408 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg 417 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
409 418
410clean: 419clean:
411 rm -rf debian/*tmp 420 rm -rf debian/*tmp debian/files
412 mv debian/ debian.backup # debian/ might be cleaned away 421 mv debian/ debian.backup # debian/ might be cleaned away
413 \$(MAKE) clean 422 \$(MAKE) clean
414 mv debian.backup debian 423 mv debian.backup debian
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 3d1984e59a30..698768bdc581 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -42,6 +42,7 @@
42 42
43#ifndef EM_AARCH64 43#ifndef EM_AARCH64
44#define EM_AARCH64 183 44#define EM_AARCH64 183
45#define R_AARCH64_NONE 0
45#define R_AARCH64_ABS64 257 46#define R_AARCH64_ABS64 257
46#endif 47#endif
47 48
@@ -160,6 +161,22 @@ static int make_nop_x86(void *map, size_t const offset)
160 return 0; 161 return 0;
161} 162}
162 163
164static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
165static int make_nop_arm64(void *map, size_t const offset)
166{
167 uint32_t *ptr;
168
169 ptr = map + offset;
170 /* bl <_mcount> is 0x94000000 before relocation */
171 if (*ptr != 0x94000000)
172 return -1;
173
174 /* Convert to nop */
175 ulseek(fd_map, offset, SEEK_SET);
176 uwrite(fd_map, ideal_nop, 4);
177 return 0;
178}
179
163/* 180/*
164 * Get the whole file as a programming convenience in order to avoid 181 * Get the whole file as a programming convenience in order to avoid
165 * malloc+lseek+read+free of many pieces. If successful, then mmap 182 * malloc+lseek+read+free of many pieces. If successful, then mmap
@@ -345,6 +362,7 @@ do_file(char const *const fname)
345 break; 362 break;
346 case EM_386: 363 case EM_386:
347 reltype = R_386_32; 364 reltype = R_386_32;
365 rel_type_nop = R_386_NONE;
348 make_nop = make_nop_x86; 366 make_nop = make_nop_x86;
349 ideal_nop = ideal_nop5_x86_32; 367 ideal_nop = ideal_nop5_x86_32;
350 mcount_adjust_32 = -1; 368 mcount_adjust_32 = -1;
@@ -353,7 +371,12 @@ do_file(char const *const fname)
353 altmcount = "__gnu_mcount_nc"; 371 altmcount = "__gnu_mcount_nc";
354 break; 372 break;
355 case EM_AARCH64: 373 case EM_AARCH64:
356 reltype = R_AARCH64_ABS64; gpfx = '_'; break; 374 reltype = R_AARCH64_ABS64;
375 make_nop = make_nop_arm64;
376 rel_type_nop = R_AARCH64_NONE;
377 ideal_nop = ideal_nop4_arm64;
378 gpfx = '_';
379 break;
357 case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break; 380 case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break;
358 case EM_METAG: reltype = R_METAG_ADDR32; 381 case EM_METAG: reltype = R_METAG_ADDR32;
359 altmcount = "_mcount_wrapper"; 382 altmcount = "_mcount_wrapper";
@@ -371,6 +394,7 @@ do_file(char const *const fname)
371 make_nop = make_nop_x86; 394 make_nop = make_nop_x86;
372 ideal_nop = ideal_nop5_x86_64; 395 ideal_nop = ideal_nop5_x86_64;
373 reltype = R_X86_64_64; 396 reltype = R_X86_64_64;
397 rel_type_nop = R_X86_64_NONE;
374 mcount_adjust_64 = -1; 398 mcount_adjust_64 = -1;
375 break; 399 break;
376 } /* end switch */ 400 } /* end switch */
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a225b0..b9897e2be404 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
377 377
378 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { 378 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
379 if (make_nop) 379 if (make_nop)
380 ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); 380 ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
381 if (warn_on_notrace_sect && !once) { 381 if (warn_on_notrace_sect && !once) {
382 printf("Section %s has mcount callers being ignored\n", 382 printf("Section %s has mcount callers being ignored\n",
383 txtname); 383 txtname);
diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index c3899ca4811c..250a7a645033 100755
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -20,13 +20,34 @@
20#include <getopt.h> 20#include <getopt.h>
21#include <err.h> 21#include <err.h>
22#include <arpa/inet.h> 22#include <arpa/inet.h>
23#include <openssl/opensslv.h>
23#include <openssl/bio.h> 24#include <openssl/bio.h>
24#include <openssl/evp.h> 25#include <openssl/evp.h>
25#include <openssl/pem.h> 26#include <openssl/pem.h>
26#include <openssl/cms.h>
27#include <openssl/err.h> 27#include <openssl/err.h>
28#include <openssl/engine.h> 28#include <openssl/engine.h>
29 29
30/*
31 * Use CMS if we have openssl-1.0.0 or newer available - otherwise we have to
32 * assume that it's not available and its header file is missing and that we
33 * should use PKCS#7 instead. Switching to the older PKCS#7 format restricts
34 * the options we have on specifying the X.509 certificate we want.
35 *
36 * Further, older versions of OpenSSL don't support manually adding signers to
37 * the PKCS#7 message so have to accept that we get a certificate included in
38 * the signature message. Nor do such older versions of OpenSSL support
39 * signing with anything other than SHA1 - so we're stuck with that if such is
40 * the case.
41 */
42#if OPENSSL_VERSION_NUMBER < 0x10000000L
43#define USE_PKCS7
44#endif
45#ifndef USE_PKCS7
46#include <openssl/cms.h>
47#else
48#include <openssl/pkcs7.h>
49#endif
50
30struct module_signature { 51struct module_signature {
31 uint8_t algo; /* Public-key crypto algorithm [0] */ 52 uint8_t algo; /* Public-key crypto algorithm [0] */
32 uint8_t hash; /* Digest algorithm [0] */ 53 uint8_t hash; /* Digest algorithm [0] */
@@ -110,30 +131,42 @@ int main(int argc, char **argv)
110 struct module_signature sig_info = { .id_type = PKEY_ID_PKCS7 }; 131 struct module_signature sig_info = { .id_type = PKEY_ID_PKCS7 };
111 char *hash_algo = NULL; 132 char *hash_algo = NULL;
112 char *private_key_name, *x509_name, *module_name, *dest_name; 133 char *private_key_name, *x509_name, *module_name, *dest_name;
113 bool save_cms = false, replace_orig; 134 bool save_sig = false, replace_orig;
114 bool sign_only = false; 135 bool sign_only = false;
115 unsigned char buf[4096]; 136 unsigned char buf[4096];
116 unsigned long module_size, cms_size; 137 unsigned long module_size, sig_size;
117 unsigned int use_keyid = 0, use_signed_attrs = CMS_NOATTR; 138 unsigned int use_signed_attrs;
118 const EVP_MD *digest_algo; 139 const EVP_MD *digest_algo;
119 EVP_PKEY *private_key; 140 EVP_PKEY *private_key;
141#ifndef USE_PKCS7
120 CMS_ContentInfo *cms; 142 CMS_ContentInfo *cms;
143 unsigned int use_keyid = 0;
144#else
145 PKCS7 *pkcs7;
146#endif
121 X509 *x509; 147 X509 *x509;
122 BIO *b, *bd = NULL, *bm; 148 BIO *b, *bd = NULL, *bm;
123 int opt, n; 149 int opt, n;
124
125 OpenSSL_add_all_algorithms(); 150 OpenSSL_add_all_algorithms();
126 ERR_load_crypto_strings(); 151 ERR_load_crypto_strings();
127 ERR_clear_error(); 152 ERR_clear_error();
128 153
129 key_pass = getenv("KBUILD_SIGN_PIN"); 154 key_pass = getenv("KBUILD_SIGN_PIN");
130 155
156#ifndef USE_PKCS7
157 use_signed_attrs = CMS_NOATTR;
158#else
159 use_signed_attrs = PKCS7_NOATTR;
160#endif
161
131 do { 162 do {
132 opt = getopt(argc, argv, "dpk"); 163 opt = getopt(argc, argv, "dpk");
133 switch (opt) { 164 switch (opt) {
134 case 'p': save_cms = true; break; 165 case 'p': save_sig = true; break;
135 case 'd': sign_only = true; save_cms = true; break; 166 case 'd': sign_only = true; save_sig = true; break;
167#ifndef USE_PKCS7
136 case 'k': use_keyid = CMS_USE_KEYID; break; 168 case 'k': use_keyid = CMS_USE_KEYID; break;
169#endif
137 case -1: break; 170 case -1: break;
138 default: format(); 171 default: format();
139 } 172 }
@@ -157,6 +190,14 @@ int main(int argc, char **argv)
157 replace_orig = true; 190 replace_orig = true;
158 } 191 }
159 192
193#ifdef USE_PKCS7
194 if (strcmp(hash_algo, "sha1") != 0) {
195 fprintf(stderr, "sign-file: %s only supports SHA1 signing\n",
196 OPENSSL_VERSION_TEXT);
197 exit(3);
198 }
199#endif
200
160 /* Read the private key and the X.509 cert the PKCS#7 message 201 /* Read the private key and the X.509 cert the PKCS#7 message
161 * will point to. 202 * will point to.
162 */ 203 */
@@ -213,7 +254,8 @@ int main(int argc, char **argv)
213 bm = BIO_new_file(module_name, "rb"); 254 bm = BIO_new_file(module_name, "rb");
214 ERR(!bm, "%s", module_name); 255 ERR(!bm, "%s", module_name);
215 256
216 /* Load the CMS message from the digest buffer. */ 257#ifndef USE_PKCS7
258 /* Load the signature message from the digest buffer. */
217 cms = CMS_sign(NULL, NULL, NULL, NULL, 259 cms = CMS_sign(NULL, NULL, NULL, NULL,
218 CMS_NOCERTS | CMS_PARTIAL | CMS_BINARY | CMS_DETACHED | CMS_STREAM); 260 CMS_NOCERTS | CMS_PARTIAL | CMS_BINARY | CMS_DETACHED | CMS_STREAM);
219 ERR(!cms, "CMS_sign"); 261 ERR(!cms, "CMS_sign");
@@ -221,17 +263,31 @@ int main(int argc, char **argv)
221 ERR(!CMS_add1_signer(cms, x509, private_key, digest_algo, 263 ERR(!CMS_add1_signer(cms, x509, private_key, digest_algo,
222 CMS_NOCERTS | CMS_BINARY | CMS_NOSMIMECAP | 264 CMS_NOCERTS | CMS_BINARY | CMS_NOSMIMECAP |
223 use_keyid | use_signed_attrs), 265 use_keyid | use_signed_attrs),
224 "CMS_sign_add_signer"); 266 "CMS_add1_signer");
225 ERR(CMS_final(cms, bm, NULL, CMS_NOCERTS | CMS_BINARY) < 0, 267 ERR(CMS_final(cms, bm, NULL, CMS_NOCERTS | CMS_BINARY) < 0,
226 "CMS_final"); 268 "CMS_final");
227 269
228 if (save_cms) { 270#else
229 char *cms_name; 271 pkcs7 = PKCS7_sign(x509, private_key, NULL, bm,
272 PKCS7_NOCERTS | PKCS7_BINARY |
273 PKCS7_DETACHED | use_signed_attrs);
274 ERR(!pkcs7, "PKCS7_sign");
275#endif
230 276
231 ERR(asprintf(&cms_name, "%s.p7s", module_name) < 0, "asprintf"); 277 if (save_sig) {
232 b = BIO_new_file(cms_name, "wb"); 278 char *sig_file_name;
233 ERR(!b, "%s", cms_name); 279
234 ERR(i2d_CMS_bio_stream(b, cms, NULL, 0) < 0, "%s", cms_name); 280 ERR(asprintf(&sig_file_name, "%s.p7s", module_name) < 0,
281 "asprintf");
282 b = BIO_new_file(sig_file_name, "wb");
283 ERR(!b, "%s", sig_file_name);
284#ifndef USE_PKCS7
285 ERR(i2d_CMS_bio_stream(b, cms, NULL, 0) < 0,
286 "%s", sig_file_name);
287#else
288 ERR(i2d_PKCS7_bio(b, pkcs7) < 0,
289 "%s", sig_file_name);
290#endif
235 BIO_free(b); 291 BIO_free(b);
236 } 292 }
237 293
@@ -247,9 +303,13 @@ int main(int argc, char **argv)
247 ERR(n < 0, "%s", module_name); 303 ERR(n < 0, "%s", module_name);
248 module_size = BIO_number_written(bd); 304 module_size = BIO_number_written(bd);
249 305
306#ifndef USE_PKCS7
250 ERR(i2d_CMS_bio_stream(bd, cms, NULL, 0) < 0, "%s", dest_name); 307 ERR(i2d_CMS_bio_stream(bd, cms, NULL, 0) < 0, "%s", dest_name);
251 cms_size = BIO_number_written(bd) - module_size; 308#else
252 sig_info.sig_len = htonl(cms_size); 309 ERR(i2d_PKCS7_bio(bd, pkcs7) < 0, "%s", dest_name);
310#endif
311 sig_size = BIO_number_written(bd) - module_size;
312 sig_info.sig_len = htonl(sig_size);
253 ERR(BIO_write(bd, &sig_info, sizeof(sig_info)) < 0, "%s", dest_name); 313 ERR(BIO_write(bd, &sig_info, sizeof(sig_info)) < 0, "%s", dest_name);
254 ERR(BIO_write(bd, magic_number, sizeof(magic_number) - 1) < 0, "%s", dest_name); 314 ERR(BIO_write(bd, magic_number, sizeof(magic_number) - 1) < 0, "%s", dest_name);
255 315
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 8e5aee6d9da2..262889046703 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -198,6 +198,8 @@ exuberant()
198 --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ 198 --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
199 --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ 199 --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
200 --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ 200 --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
201 --regex-c++='/DEF_MMIO_(IN|OUT)_(X|D)\(([^,]*),\s*[^)]*\)/\3/' \
202 --regex-c++='/DEBUGGER_BOILERPLATE\(([^,]*)\)/\1/' \
201 --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ 203 --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \
202 --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ 204 --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \
203 --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ 205 --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7de36df4eaa5..024a11ac8b97 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -11,47 +11,95 @@ echo ' '
11uname -a 11uname -a
12echo ' ' 12echo ' '
13 13
14gcc -dumpversion 2>&1| awk \ 14gcc -dumpversion 2>&1 |
15'NR==1{print "Gnu C ", $1}' 15awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
16 16 match($0, /[0-9]+([.]?[0-9]+)+/)
17make --version 2>&1 | awk -F, '{print $1}' | awk \ 17 printf("GNU C\t\t\t%s\n",
18 '/GNU Make/{print "Gnu make ",$NF}' 18 substr($0,RSTART,RLENGTH))
19 19}'
20echo "binutils $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')" 20
21 21make --version 2>&1 |
22echo -n "util-linux " 22awk '/GNU Make/{
23fdformat --version | awk '{print $NF}' | sed -e s/^util-linux-// -e s/\)$// 23 match($0, /[0-9]+([.]?[0-9]+)+/)
24 24 printf("GNU Make\t\t%s\n",
25echo -n "mount " 25 substr($0,RSTART,RLENGTH))
26mount --version | awk '{print $NF}' | sed -e s/^mount-// -e s/\)$// 26}'
27 27
28depmod -V 2>&1 | awk 'NR==1 {print "module-init-tools ",$NF}' 28ld -v 2>&1 |
29 29awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
30tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ 30 match($0, /[0-9]+([.]?[0-9]+)+/)
31'NR==1 {print "e2fsprogs ", $2}' 31 printf("Binutils\t\t%s\n",
32 32 substr($0,RSTART,RLENGTH))
33fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ 33}'
34'NR==1 {print "jfsutils ", $3}' 34
35 35mount --version 2>&1 |
36reiserfsck -V 2>&1 | grep ^reiserfsck | awk \ 36awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
37'NR==1{print "reiserfsprogs ", $2}' 37 match($0, /[0-9]+([.]?[0-9]+)+/)
38 $0 = substr($0,RSTART,RLENGTH)
39 printf("Util-linux\t\t%s\nMount\t\t\t%s\n",$0,$0)
40}'
41
42depmod -V 2>&1 |
43awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
44 match($0, /[0-9]+([.]?[0-9]+)+/)
45 printf("Module-init-tools\t%s\n",
46 substr($0,RSTART,RLENGTH))
47}'
48
49tune2fs 2>&1 |
50awk '/^tune2fs/{
51 match($0, /[0-9]+([.]?[0-9]+)+/)
52 printf("E2fsprogs\t\t%s\n",
53 substr($0,RSTART,RLENGTH))
54}'
55
56fsck.jfs -V 2>&1 |
57awk '/version/{
58 match($0, /[0-9]+([.]?[0-9]+)+/)
59 printf("Jfsutils\t\t%s\n",
60 substr($0,RSTART,RLENGTH))
61}'
62
63reiserfsck -V 2>&1 |
64awk '/^reiserfsck/{
65 match($0, /[0-9]+([.]?[0-9]+)+/)
66 printf("Reiserfsprogs\t\t%s\n",
67 substr($0,RSTART,RLENGTH))
68}'
38 69
39fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \ 70fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
40'NR==1{print "reiser4progs ", $2}' 71'NR==1{print "reiser4progs ", $2}'
41 72
42xfs_db -V 2>&1 | grep version | awk \ 73xfs_db -V 2>&1 |
43'NR==1{print "xfsprogs ", $3}' 74awk '/version/{
75 match($0, /[0-9]+([.]?[0-9]+)+/)
76 printf("Xfsprogs\t\t%s\n",
77 substr($0,RSTART,RLENGTH))
78}'
44 79
45pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils ", $2}' 80pccardctl -V 2>&1 |
81awk '/pcmciautils/{
82 match($0, /[0-9]+([.]?[0-9]+)+/)
83 printf("Pcmciautils\t\t%s\n",
84 substr($0,RSTART,RLENGTH))
85}'
46 86
47cardmgr -V 2>&1| grep version | awk \ 87cardmgr -V 2>&1| grep version | awk \
48'NR==1{print "pcmcia-cs ", $3}' 88'NR==1{print "pcmcia-cs ", $3}'
49 89
50quota -V 2>&1 | grep version | awk \ 90quota -V 2>&1 |
51'NR==1{print "quota-tools ", $NF}' 91awk '/version/{
92 match($0, /[0-9]+([.]?[0-9]+)+/)
93 printf("Quota-tools\t\t%s\n",
94 substr($0,RSTART,RLENGTH))
95}'
52 96
53pppd --version 2>&1| grep version | awk \ 97pppd --version 2>&1 |
54'NR==1{print "PPP ", $3}' 98awk '/version/{
99 match($0, /[0-9]+([.]?[0-9]+)+/)
100 printf("PPP\t\t\t%s\n",
101 substr($0,RSTART,RLENGTH))
102}'
55 103
56isdnctrl 2>&1 | grep version | awk \ 104isdnctrl 2>&1 | grep version | awk \
57'NR==1{print "isdn4k-utils ", $NF}' 105'NR==1{print "isdn4k-utils ", $NF}'
@@ -59,40 +107,87 @@ isdnctrl 2>&1 | grep version | awk \
59showmount --version 2>&1 | grep nfs-utils | awk \ 107showmount --version 2>&1 | grep nfs-utils | awk \
60'NR==1{print "nfs-utils ", $NF}' 108'NR==1{print "nfs-utils ", $NF}'
61 109
62echo -n "Linux C Library " 110test -r /proc/self/maps &&
63sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps 111sed '
64 112 /.*libc-\(.*\)\.so$/!d
65ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 113 s//Linux C Library\t\t\1/
66'NR==1{print "Dynamic linker (ldd) ", $NF}' 114 q
67 115' /proc/self/maps
68ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \ 116
69 '{print "Linux C++ Library " $4"."$5"."$6}' 117ldd --version 2>&1 |
70 118awk '/^ldd/{
71ps --version 2>&1 | grep version | awk \ 119 match($0, /[0-9]+([.]?[0-9]+)+/)
72'NR==1{print "Procps ", $NF}' 120 printf("Dynamic linker (ldd)\t%s\n",
73 121 substr($0,RSTART,RLENGTH))
74ifconfig --version 2>&1 | grep tools | awk \ 122}'
75'NR==1{print "Net-tools ", $NF}' 123
76 124libcpp=`ldconfig -p 2>/dev/null |
77# Kbd needs 'loadkeys -h', 125 awk '/(libg|stdc)[+]+\.so/ {
78loadkeys -h 2>&1 | awk \ 126 print $NF
79'(NR==1 && ($3 !~ /option/)) {print "Kbd ", $3}' 127 exit
80 128 }
81# while console-tools needs 'loadkeys -V'. 129'`
82loadkeys -V 2>&1 | awk \ 130test -r "$libcpp" &&
83'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools ", $3}' 131ls -l $libcpp |
132sed '
133 s!.*so\.!!
134 s!^!Linux C++ Library\t!
135'
136ps --version 2>&1 |
137awk '/version/{
138 match($0, /[0-9]+([.]?[0-9]+)+/)
139 printf("Procps\t\t\t%s\n",
140 substr($0,RSTART,RLENGTH))
141}'
142
143ifconfig --version 2>&1 |
144awk '/tools/{
145 match($0, /[0-9]+([.]?[0-9]+)+/)
146 printf("Net-tools\t\t%s\n",
147 substr($0,RSTART,RLENGTH))
148}'
149
150loadkeys -V 2>&1 |
151awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
152 match($0, /[0-9]+([.]?[0-9]+)+/)
153 $0 = substr($0,RSTART,RLENGTH)
154 printf("Kbd\t\t\t%s\nConsole-tools\t\t%s\n",$0,$0)
155}'
84 156
85oprofiled --version 2>&1 | awk \ 157oprofiled --version 2>&1 | awk \
86'(NR==1 && ($2 == "oprofile")) {print "oprofile ", $3}' 158'(NR==1 && ($2 == "oprofile")) {print "oprofile ", $3}'
87 159
88expr --v 2>&1 | awk 'NR==1{print "Sh-utils ", $NF}' 160expr --v 2>&1 |
89 161awk '/^expr/{
90udevinfo -V 2>&1 | grep version | awk '{print "udev ", $3}' 162 match($0, /[0-9]+([.]?[0-9]+)+/)
91 163 printf("Sh-utils\t\t%s\n",
92iwconfig --version 2>&1 | awk \ 164 substr($0,RSTART,RLENGTH))
93'(NR==1 && ($3 == "version")) {print "wireless-tools ",$4}' 165}'
94 166
95if [ -e /proc/modules ]; then 167udevadm --version 2>&1 |
96 X=`cat /proc/modules | sed -e "s/ .*$//"` 168awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
97 echo "Modules Loaded "$X 169 match($0, /[0-9]+([.]?[0-9]+)+/)
98fi 170 printf("Udev\t\t\t%s\n",
171 substr($0,RSTART,RLENGTH))
172}'
173
174iwconfig --version 2>&1 |
175awk '/version/{
176 match($0, /[0-9]+([.]?[0-9]+)+/)
177 printf("Wireless-tools\t\t%s\n",
178 substr($0,RSTART,RLENGTH))
179}'
180
181test -e /proc/modules &&
182sort /proc/modules |
183sed '
184 s/ .*//
185 H
186${
187 g
188 s/^\n/Modules Loaded\t\t/
189 y/\n/ /
190 q
191}
192 d
193'