1#!/bin/bash 2 3file=$1 4project=$(echo "$2" | cut -d = -f 2) 5 6if [[ "$file" = "" ]] ; then 7 echo "Usage: $0 <file with smatch messages> -p=<project>" 8 exit 1 9fi 10 11if [[ "$project" != "kernel" ]] ; then 12 exit 0 13fi 14 15outfile="kernel.gfp_flags" 16bin_dir=$(dirname $0) 17remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove) 18tmp=$(mktemp /tmp/smatch.XXXX) 19tmp2=$(mktemp /tmp/smatch.XXXX) 20 21echo "// list of GFP flag parameters." > $outfile 22echo '// generated by `gen_gfp_flags.sh`' >> $outfile 23${bin_dir}/trace_params.pl $file kmalloc 1 >> $tmp 24${bin_dir}/trace_params.pl $file kzalloc 1 >> $tmp 25${bin_dir}/trace_params.pl $file kcalloc 2 >> $tmp 26cat $tmp | sort -u > $tmp2 27mv $tmp2 $tmp 28cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile 29rm $tmp 30echo "Done. List saved as '$outfile'" 31