aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2010-08-31Coccinelle: Add null/kmerr.cocciNicolas Palix
This semantic patch looks for kmalloc etc that are not followed by a NULL check. It only gives a report in the case where there is some error handling code later in the function, which may be helpful in determining what the error handling code for the call to kmalloc etc should be. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add null/eno.cocciNicolas Palix
The various basic memory allocation functions don't return ERR_PTR Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-02scripts/dtc: Fix a resource leakMartin Ettl
during a check of the current git head of the linux kernel with the static code analysis tool cppcheck (http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page) the tool discovered a resource leak in linux-2.6/scripts/dtc/fstree.c. Please refer the attached patch, that fixes the issue. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15363 Signed-off-by: Martin Ettl <ettl.martin@gmx.de> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-28Add support for the C variable in the coccicheck scriptNicolas Palix
This patch makes it possible to use the Coccinelle checker with the C variable of the build system. To check only newly edited code, the following command may be used: 'make C={1,2} CHECK="scripts/coccicheck"' This runs every semantic patch in scripts/coccinelle by default. The COCCI variable may additionally be used to only apply a single semantic patch. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Merge branch 'kbuild/coccinelle' into kbuild/miscMichal Marek
2010-06-12Add scripts/coccinelle/deref_null.cocciNicolas Palix
Add a Coccinelle file to identify the dereferences of NULL variables This semantic patch identifies when a variable is known to be NULL after a test, but it is still dereferenced later. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/err_cast.cocciNicolas Palix
Add a Coccinelle file to use the ERR_CAST function Before the release 2.6.25, one had to use ERR_PTR(PTR_ERR(...)) to convert the pointer type of an error. Since then, the function ERR_CAST has been available for that purpose. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/resource_size.cocciNicolas Palix
This semantic patch replaces explicit computations of resource size by a call to resource_size. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/alloc/kzalloc-simple.cocciNicolas Palix
This semantic patch replaces a pair of calls to kmalloc and memset by a single call to kzalloc. It only looks for simple cases to avoid false positives. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/alloc/drop_kmalloc_cast.cocciNicolas Palix
The purpose of this semantic patch is to remove useless casts, as mentioned in the Linux documentation. See Chapter 14 in Documentation/CodingStyle for more information. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add a target to use the Coccinelle checkerNicolas Palix
A 'coccicheck' target is added. It can be called with four different modes. Each one generates a different kind of output, i.e. context, patch, org, report, according to the corresponding mode to be activated. The new target calls the 'coccicheck' front-end in the 'scripts' directory with the MODE argument. Every SmPL file in the subdirectories of 'scripts/coccinelle' is then given to the front-end and applied to the entire source tree. The four modes behave as follows: 'report' generates a list in the following format: file:line:column-column: message 'patch' proposes a fix, when possible. 'context' highlights lines of interest and their context in a diff-like style. Lines of interest are indicated with '-'. 'org' generates a report in the Org mode format of Emacs. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-04scripts: decodecode: remove bashismsRabin Vincent
Remove bashisms to make scripts/decodecode work with other shells. Signed-off-by: Rabin Vincent <rabin@rab.in> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-03checkkconfigsymbols.sh: Kconfig symbols sometimes have lowercase lettersRoland Dreier
Quite a few Kconfig symbols contain lowercase letters. The current checkkconfigsymbols.sh code only contains A-Z in the regexp it uses to find config symbols in source code, so it comes up with the wrong symbol to look for in Kconfig files and then generates false positives when it doesn't find that wrong symbol. For example checking drivers/net generates a false positive for MAC89 because the the actual config option is MAC89x0. Fix this by also adding a-z to the regexp. Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-03scripts: add nconf into gitignore fileAmérico Wang
scripts/kconfig/nconf is generated by 'make nconfig', add it into .gitignore. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14gconfig: add support to show hidden options that have promptsLi Zefan
There's a button in gconfig to "Show all options", but I think normally we are not interested in those configs which have no prompt and thus can't be changed, so here I add a new button to show hidden options which have prompts. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14menuconfig: add support to show hidden options which have promptsLi Zefan
Usage: Press <Z> to show all config symbols which have prompts. Quote Tim Bird: | I've been bitten by this numerous times. I most often | use ftrace on ARM, but when I go back to x86, I almost | always go through a sequence of searching for the | function graph tracer in the menus, then realizing it's | completely missing until I disable CC_OPTIMIZE_FOR_SIZE. | | Is there any way to have the menu item appear, but be | unsettable unless the SIZE option is disabled? I'm | not a Kconfig guru... I myself found this useful too. For example, I need to test ftrace/tracing and want to be sure all the tracing features are enabled, so I enter the "Tracers" menu, and press <Z> to see if there is any config hidden. I also noticed gconfig and xconfig have a button "Show all options", but that's a bit too much, and I think normally what we are not interested in those configs which have no prompt thus can't be changed by users. Exmaple: --- Tracers -*- Kernel Function Tracer - - Kernel Function Graph Tracer [*] Interrupts-off Latency Tracer - - Preemption-off Latency Tracer [*] Sysprof Tracer Here you can see 2 tracers are not selectable, and then can find out how to make them selectable. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14gconfig: remove show_debug optionLi Zefan
This option is a no-op, so remove it. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14gconfig: remove dbg_print_ptype() and dbg_print_stype()Li Zefan
Just use sym_get_type() and prop_get_type_name(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14kconfig: fix zconfdump()Li Zefan
zconfdump(), which is used for debugging, can't recognize P_SELECT, P_RANGE and P_MENU (if associated with a symbol, aka "menuconfig"), and output something like this: config X86 boolean default y unknown prop 6! unknown prop 6! unknown prop 6! ... Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-04-14kconfig: some small fixesLi Zefan
- fix a typo in documentation - fix a typo in a printk on error - fix comments in dialog_inputbox() Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-23kbuild: Include gen_initramfs_list.sh and the file list in the .d fileJason Gunthorpe
Expand the dependency set used for the initrd to include the CONFIG_INITRAMFS_SOURCE file and the generator script itself. Otherwise changing the initramfs file list does not rebuild the CPIO. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-23kconfig: recalc symbol value before showing search resultsLi Zefan
A symbol's value won't be recalc-ed until we save config file or enter the menu where the symbol sits. So If I enable OPTIMIZE_FOR_SIZE, and search FUNCTION_GRAPH_TRACER: Symbol: FUNCTION_GRAPH_TRACER [=y] Prompt: Kernel Function Graph Tracer Defined at kernel/trace/Kconfig:140 Depends on: ... [=y] && (!X86_32 [=y] || !CC_OPTIMIZE_FOR_SIZE [=y]) ... From the dependency it should result in FUNCTION_GRAPH_TRACER=n, but it still shows FUNCTION_GRAPH_TRACER=y. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-23headerdep: perlcritic warningStephen Hemminger
Minor perlcritic warning: headerdep.pl: "return" statement with explicit "undef" at line 84, column 2. See page 199 of PBP. (Severity: 5) The rationale according to PBP is that an explicit return of undef (contrary to most people's expectations) doesn't always evaluate as false. It has to with the fact that perl return value depends on context the function is called. If function is used in list context, the appropriate return value for false is an empty list; whereas in scalar context the return value for false is undefined. By just using a "return" both cases are handled. In the context of a trivial script this doesn't matter. But one script may be cut-paste into later code (most people like me only know 50% of perl), that is why perlcritic always complains Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-11scripts/Makefile.lib: Align the output of LZOWu Zhangjin
The output of LZO is not aligned with the other output: ... CC drivers/usb/mon/usbmon.mod.o LZO arch/mips/boot/compressed/vmlinux.lzo ... This patch fixes it. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-08Revert "kbuild: specify absolute paths for cscope"Michal Marek
This reverts commit eb8f844c0a41c4529a7d06b7801296eca9ae67aa. Ian Campbell writes: > I keep my kernel source tree on a more powerful build box where I run my > builds etc (including "make cscope") but run my editor from my > workstation with an NFS mount to the source. This worked fine for me > using relative paths for cscope. Using absolute paths in cscope breaks > this previously working setup because the root path is not the same on > both systems. I guess this is similar to moving the source tree around. > > Without wanting to start a flamewar it really sounds to me like we are > working around a vim (or cscope) bug here, emacs with cscope bindings > works fine in this configuration. Given that absolute paths can be forced by make O=. cscope, change the default back to relative paths. Ian Campbell <ijc@hellion.org.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07headers_install: use local file handlesStephen Hemminger
Better practice to use 3 arg open and local file handles. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07headers_check: fix perl warningsStephen Hemminger
According to PBP; best way practice is to use local reference for file handle and three argument open. Also perl prototypes are a mistake. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07export_report: fix perl warningsStephen Hemminger
Use local file handles, use three argument open. Don't modify arguments in perl grep (use sed instead) Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07profile2linkerlist: fix perl warningsStephen Hemminger
Turn on strict checking. Simplify code by using "unless" statement. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07namespace: perlcritic warningsStephen Hemminger
Use local file handle not global. Make loop and other variables local in scope. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Cc: Hui Zhu <teawater@gmail.com> Cc: Cong Wang <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07checkversion: perl cleanupStephen Hemminger
Turn on strict checking. Use three arguement open Standard practice in perl is to use undef not zero for false Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Cc: Cong Wang <amwang@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07checkincludes: fix perlcritic warningsStephen Hemminger
Turn on strict checking. Use local file handles. Use three argument open. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Cc: Cong Wang <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07scripts: improve checkstackStephen Hemminger
Cleanup checkstack script: * Turn on strict checking * Fix resulting error message because the declaration syntax was incorrect. * Remove incorrect and misleading use of prototype - prototype not required for this type of sort function because $a and $b are being used in this contex - if prototype was being used it should be for both arguments * Use closure for sort function Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Cong Wang <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07kbuild: deb-pkg md5sumsFEJES Jozsef
This patch creates the standard md5sums file for 'make deb-pkg' just like the dh_md5sums debhelper script. Signed-off-by: Jozsef Fejes <fejes@joco.name> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-03tags: Add the ability to make tags for all archs using "all"John Kacur
make ALLSOURCE_ARCHS=all tags - Document this in kbuild.txt Without this change you have to type each arch separately. Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-03tags: Fix spelling error in comment (is->if)John Kacur
Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-22tags: Use $SRCARCHMichal Marek
$ make mrproper $ make tags GEN tags find: `arch/x86_64/': No such file or directory Caused by commit f81b1be (tags: include headers before source files) Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-17tags: include headers before source filesGuennadi Liakhovetski
Currently looking up a structure definition in TAGS / tags takes one to one of multiple "static struct X" definitions in arch sources, which makes it for many structs practically impossible to get to the required header. This patch changes the order of sources being tagged to first scan architecture includes, then the top-level include/ directory, and only then the rest. It also takes into account, that many architectures have more than one include directory, i.e., not only arch/$ARCH/include, but also arch/$ARCH/mach-X/include etc. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> [mmarek@suse.cz: fix 'var+=text' bashism] Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-05markup_oops.pl: minor fixesHui Zhu
1. Fix a little format issue. 2. Check the return of "Getopt::Long::GetOptions". Output usage and exit if it get error. 3. Change $ARGV[$#ARGV] to $ARGV[0]. 4. Change the code which get $modulefile from modinfo. Replace the pipeline with `modinfo -F filename $module`. 4. Change usage from "Specify the module directory name" to "Specify the module filename". Signed-off-by: Hui Zhu <teawater@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-05markup_oops.pl: add options to improve cross-sompilation environmentsHui Zhu
The markup_oops.pl have 3 troubles to support cross-compiler environment: 1. It use objdump directly. 2. It use modinfo to get the message of module. 3. It use hex function that cannot support 64-bit number in 32-bit arch. This patch add 3 options to markup_oops.pl: 1. -c CROSS_COMPILE Specify the prefix used for toolchain. 2. -m MODULE_DIRNAME Specify the module directory name. 3. Change hex function to Math::BigInt->from_hex. After this patch, parse the x8664 oops in x86, we can: cat amd64m | perl ~/kernel/tmp/m.pl -c /home/teawater/kernel/bin/x8664- -m ./e.ko vmlinux Thanks, Hui Signed-off-by: Hui Zhu <teawater@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: ozan@pardus.org.tr Cc: Matthew Wilcox <willy@linux.intel.com> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02Merge branch 'modpost' of git://git.pengutronix.de/git/ukl/linux-2.6 into ↵Michal Marek
kbuild/for-next Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02scripts: use %_tmppath in "make rpm-pkg"John Saalwaechter
The mkspec script hardcodes "/var/tmp" into the generated rpm spec file's BuildRoot. The user, however, may have a custom setting for %_tmppath, which should be used in BuildRoot. This patch changes mkspec's BuildRoot output to appropriately use %_tmppath. Signed-off-by: John Saalwaechter <saalwaechter@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02markup_oops.pl: fix for faulting instruction in the first line of a rangeHui Zhu
I got a "No matching code found" when I use markup_oops.pl parse a error in a x86_64 module. cat e.c int init_module(void) { char *buf = 0; buf[0] = 3; return 0; } void cleanup_module(void) { //char *buf = 0; //buf[0] = 3; } MODULE_AUTHOR("Hui Zhu"); MODULE_LICENSE("GPL"); 0000000000000000 <init_module>: init_module(): /home/teawater/study/kernel/stack2core/example/e.c:10 0: c6 04 25 00 00 00 00 movb $0x3,0x0 7: 03 /home/teawater/study/kernel/stack2core/example/e.c:13 8: 31 c0 xor %eax,%eax a: c3 retq b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 0000000000000010 <cleanup_module>: cleanup_module(): /home/teawater/study/kernel/stack2core/example/e.c:20 10: f3 c3 repz retq 12: 90 nop 13: 90 nop Disassembly of section .modinfo: This is because the faulting instruction "movb $0x3,0x0" is the first line of the range. In the markup_oops.pl: main::(./scripts/markup_oops.pl:245): 245: if (InRange($1, $target)) { DB<2> p $line ffffffffa001b000: c6 04 25 00 00 00 00 movb $0x3,0x0 DB<3> p $counter 0 It just set $center in next loop. So it cannot get the $center. And even if $center is set to the right value 0. if ($center == 0) { print "No matching code found \n"; exit; } The first line $center will be 0, so I change the default value to -1. Signed-off-by: Hui Zhu <teawater@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02scripts: change scripts to use system python instead of envDon Zickus
Just a small change to a couple of scripts to go from #!/usr/bin/env python to #!/usr/bin/python This shouldn't effect anyone, unless they don't install python there. In preparation for python3, Fedora is doing a big push to change the scripts to use the system python. This allows developers to put the python3 in their path without fear of breaking existing scripts. Now I am pretty sure anyone using python3 for testing purposes will probably not run any of the scripts I changed, but Fedora has this automated tool that checks for this stuff so I thought I would try to push it upstream. Signed-off-by: Don Zickus <dzickus@redhat.com> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02scripts/kallsyms: suppress build warningHimanshu Chauhan
Suppress a warn_unused_result warning. fgets is called as a part of error handling. It is called just to drop a line and return immediately. read_map is reading the file in a loop and read_symbol reads line by line. So I think there is no point in using return value for useful checking. Other checks like 3 items were returned or !EOF have already been done. Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org> Cc: WANG Cong <xiyou.wangcong@gmail.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02scripts/mkcompile_h: don't test for hardcoded pathsMichal Marek
Don't test for /bin/{dnsdomainname,domainname}, simply try to execute the command and check if it returned something. Reported-by: Glenn Sommer <glemsom@gmail.com> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Tested-by: Glenn Sommer <glemsom@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02Improve kconfig symbol hashingAndi Kleen
While looking for something else I noticed that the symbol hash function used by kconfig is quite poor. It doesn't use any of the standard hash techniques but simply adds up the string and then uses power of two masking, which is both known to perform poorly. The current x86 kconfig has over 7000 symbols. When I instrumented it showed that the minimum hash chain length was 16 and a significant number of them was over 30. It didn't help that the hash table size was only 256 buckets. This patch increases the hash table size to a larger prime and switches to a FNV32 hash. I played around with a couple of hash functions, but that one seemed to perform best with reasonable hash table sizes. Increasing the hash table size even further didn't seem like a good idea, because there are a couple of global walks which walk the complete hash table. I also moved the unnamed bucket to 0. It's still the longest of all the buckets (44 entries), but hopefully it's not often hit except for the global walk which doesn't care. The result is a much nicer distribution: (first column bucket length, second number of buckets with that length) 1: 3505 2: 1236 3: 294 4: 52 5: 3 47: 1 <--- this is the unnamed symbols bucket There are still some 5+ buckets, but increasing the hash table even more would be likely not worth it. This also cleans up the code slightly by removing hard coded magic numbers. I didn't notice a big performance difference either way on my Nehalem system, but I presume it'll help somewhat on slower systems. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02nconfig: minor fixNir Tzachar
This patch fixes two problems reported by Jan Engelhardt: 1) Border is now properly placed, to always be visible 2) Long menu items are properly displayed Reported-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02nconfig: mark local functions as suchMichal Marek
scripts/kconfig/nconf.gui.c:23: warning: no previous prototype for 'set_normal_colors' scripts/kconfig/nconf.gui.c:68: warning: no previous prototype for 'normal_color_theme' scripts/kconfig/nconf.gui.c:100: warning: no previous prototype for 'no_colors_theme' scripts/kconfig/nconf.c:455: warning: no previous prototype for 'process_special_keys' scripts/kconfig/nconf.c:487: warning: no previous prototype for 'get_next_hot' scripts/kconfig/nconf.c:506: warning: no previous prototype for 'canbhot' scripts/kconfig/nconf.c:514: warning: no previous prototype for 'is_hot' scripts/kconfig/nconf.c:522: warning: no previous prototype for 'make_hot' scripts/kconfig/nconf.c:582: warning: no previous prototype for 'item_make' scripts/kconfig/nconf.c:626: warning: no previous prototype for 'item_add_str' scripts/kconfig/nconf.c:656: warning: no previous prototype for 'item_tag' scripts/kconfig/nconf.c:668: warning: no previous prototype for 'curses_item_index' scripts/kconfig/nconf.c:673: warning: no previous prototype for 'item_data' scripts/kconfig/nconf.c:684: warning: no previous prototype for 'item_is_tag' scripts/kconfig/nconf.c:691: warning: no previous prototype for 'set_config_filename' Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02kconfig: new configuration interface (nconfig)nir.tzachar@gmail.com
This patch was inspired by the kernel projects page, where an ncurses replacement for menuconfig was mentioned (by Sam Ravnborg). Building on menuconfig, this patch implements a more modern look interface using ncurses and ncurses' satellite libraries (menu, panel, form). The implementation does not depend on lxdialog, which is currently distributed with the kernel. Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>