#!/bin/bash # export BASE=~/Documents/build/linux export HV=$BASE/drivers/staging/hv for line in $(cat typedefs) ; do from=$(echo $line | cut -f1 -d:) to=$(echo $line | cut -f2 -d:) echo "Converting typedef $from to struct $to" spatch.opt -inplace -include_headers -sp_file gen/$from.cocci -dir $HV -patch $BASE > gen/$from.patch find $HV -name "*.cocci_orig" -delete if [ "$1" == "compile" ] ; then make -C $BASE echo -n "Press return to commit: " read fi cd $BASE git commit -s -a -m "Staging: hv: Convert typedef $from to struct $to" cd - done