From: <vl...@us...> - 2008-07-09 17:28:37
|
Revision: 445 http://scst.svn.sourceforge.net/scst/?rev=445&view=rev Author: vlnb Date: 2008-07-09 10:28:36 -0700 (Wed, 09 Jul 2008) Log Message: ----------- The patch below implements the following changes: - The script specialize-patch now acts as if #define INSIDE_KERNEL_TREE 1 is effective. - The script generate-kernel-patch now renames sBUG_ON() into BUG_ON() and sBUG() into BUG(). The same script removes the definitions of the sBUG_ON(), sBUG() and WARN_ON_ONCE() macro's from the header file scst_debug.h. The last macro is only removed for kernel versions later than 2.6.19. This patch has been tested as follows: - Compared the output of the command "scripts/generate-kernel-patch 2.6.25" before and after the changes. - Verified the newly generated patch with checkpatch. Checkpatch statistics are now as follows: 521 WARNING: line over 80 characters 12 WARNING: consider using strict_strtoul in preference to simple_strtoul 10 WARNING: printk() should include KERN_ facility level 3 WARNING: CVS style keyword markers, these will _not_ be updated 2 WARNING: do not add new typedefs 1 WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt - Verified that the generated kernel patch still applies cleanly to the 2.6.25.10 kernel and that this kernel still compiles, installs and boots fine. Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/scripts/generate-kernel-patch trunk/scripts/specialize-patch trunk/scst/include/scst_debug.h Modified: trunk/scripts/generate-kernel-patch =================================================================== --- trunk/scripts/generate-kernel-patch 2008-07-09 17:19:24 UTC (rev 444) +++ trunk/scripts/generate-kernel-patch 2008-07-09 17:28:36 UTC (rev 445) @@ -64,9 +64,10 @@ @@ -0,0 +1,$(wc -l "$1" | { read a b; echo $a; }) @@ EOF if [ "${2%.[ch]}" != "$2" ]; then - sed -e 's/^ \([^ ]*:\)$/\1/' -e 's/^/+/' < "$1" + sed -e 's/sBUG(/BUG(/g' -e 's/sBUG_ON(/BUG_ON(/g' -e 's/^/+/' \ + -e 's/^ \([^ ]*:\)$/\1/' < "$1" else - sed -e 's/^/+/' < "$1" + sed -e 's/sBUG(/BUG(/g' -e 's/sBUG_ON(/BUG_ON(/g' -e 's/^/+/' < "$1" fi fi } Modified: trunk/scripts/specialize-patch =================================================================== --- trunk/scripts/specialize-patch 2008-07-09 17:19:24 UTC (rev 444) +++ trunk/scripts/specialize-patch 2008-07-09 17:28:36 UTC (rev 445) @@ -46,11 +46,13 @@ gsub("LINUX_VERSION_CODE", LINUX_VERSION_CODE, stmnt) + gsub("defined\\(INSIDE_KERNEL_TREE\\)", "1", stmnt) + do { last_stmnt = stmnt - pattern = "! ([0-9]+)" + pattern = "! *([0-9]+)" while (match(stmnt, pattern, op) != 0) { sub(pattern, op[1] == 0, stmnt) @@ -110,7 +112,7 @@ { # Only act on preprocessor conditional expressions with regard to the Linux # kernel version, and do not interpret other expressions. - if ($0 ~ "LINUX_VERSION_CODE") + if ($0 ~ "LINUX_VERSION_CODE" || $0 ~ "INSIDE_KERNEL_TREE") { $0 = evaluated } Modified: trunk/scst/include/scst_debug.h =================================================================== --- trunk/scst/include/scst_debug.h 2008-07-09 17:19:24 UTC (rev 444) +++ trunk/scst/include/scst_debug.h 2008-07-09 17:28:36 UTC (rev 445) @@ -39,6 +39,7 @@ #define DEBUG #endif +#if !defined(INSIDE_KERNEL_TREE) #ifdef DEBUG #ifndef EXTRACHECKS @@ -69,8 +70,9 @@ #define sBUG_ON(p) BUG_ON(p) #endif +#endif -#ifndef WARN_ON_ONCE +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19) #define WARN_ON_ONCE(condition) ({ \ static int __warned; \ typeof(condition) __ret_warn_once = (condition); \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |