KernelNewbies:

Your Name

Roel Kluin

Email: MailTo(12o3l AT SPAMFREE tiscali DOT nl) ...


CategoryHomepage

Based on Linus' script to get the email address of a maintainer, I wrote this script to get the address of a list rather than a maintainers address for mailing.

git log --since="1 year ago"  "$@" | sed -n "s/^    .[-a-z]*by: \(.*\) <.*$/\1/p" |
sort | uniq | sort -n -r | while read name; do
        sed -n "/^P:[ \t]*.*$name/,/^$/{
                s/^L:[ \t]*\(.*\)$/\1/p
        }" ./MAINTAINERS
done | sort | uniq -c | sort -n -r | while read nr list; do
        tot=`grep -c "^L:\W*.*$list.*" ./MAINTAINERS`
        echo "`expr $nr / \( $tot + 1 \)` $nr $tot $list"
done | sort -r | cut -d " " -f2- | while read nr tot list; do
        echo -e "$nr/$tot Acks were commited by maintainers of list $list"
done

some scripts for configuring a kernel:

To translate a module name (as listed in modprobe -l or modinfo -n module) into a kernel .config option:

mod="${1%.ko}";
dir="${1%/*}";
sed -e :a -e '/\\$/N; s/\\\n//; ta' "${dir#*/kernel/}/Makefile" | \
sed -n "s/^obj-\$(CONFIG_\([A-Z0-9_]*\))\W*+=\W*"${mod##*/}"\.o$/\1/p";

a stupid sed script to check ioremap/iounmap balancing (can be adapted for others)

git-grep -l '[^A-Za-z0-9]ioremap' | while read g; do
echo "--------------------------[ $g ]--------------------------"
sed -n "/[^A-Za-z0-9]ioremap.*(\(.*\))/,/^[}{]$/{
s/\(.*return.*\)/\1\t\t-------return/
tp
s/\(.*goto.*\)/\1\t\t------goto/
tp
s/\(.*iounmap.*\)/\1\t\t<----/
tp
s/\(.*ioremap.*\)/\1\t\t---->/
Tp
=
:p
p
}" $g
done | less

using:

# seperators: 
s[0]="[[:blank:]]*";
S[0]="[[:blank:]]\+"    
Q[0]="[^A-Za-z0-9_]"

# used for a variable/function name:
V[0]="[A-Za-z_]\+[A-Za-z0-9_]*"

# parents:
p[0]="[A-Za-z_]\+[A-Za-z0-9_]*\."               
P[0]="[A-Za-z_]\+[A-Za-z0-9_]*->"

# for arrays
b[0]="\[[0-9]\+\]"
B[0]="\[[A-Z_]\+[A-Z0-9_]*\]"

for f in $(git-grep -l "struct\W*sk_buff"); do
sed -n "s/^.*struct${S}sk_buff${s}\*${s}\(${V}\)$Q.*$/\1/p" $f | sort | uniq | while read n; do
sed -n "/struct${s}sk_buff${s}\*${s}${n}/,/^[{}].*$/{ /kfree(${s}${n}${s})/= }" $f | while read q; do
if [ -n "$q" ]; then 
echo -e "kfreeing sk_buff $n at line $q in $f\n$q";
sed -n "/struct${s}sk_buff${s}\*${s}${n}/,/^[{}].*$/p" $f;
fi
done
done
done 2>&1 | less

KernelNewbies: RoelKluin (last edited 2007-11-07 20:04:36 by 82-171-216-234)