summaryrefslogtreecommitdiffstats
path: root/tools/ifnet
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-06-25 15:22:14 +0000
committermarcel <marcel@FreeBSD.org>2014-06-25 15:22:14 +0000
commit6ad20b92fb390f7f40e61e03f3c9c814885c87f5 (patch)
tree812b623efd3075d25e379bf94e4d56615734ea66 /tools/ifnet
parent2676c27ae85af89bb53747758894d09b21a20630 (diff)
downloadFreeBSD-src-6ad20b92fb390f7f40e61e03f3c9c814885c87f5.zip
FreeBSD-src-6ad20b92fb390f7f40e61e03f3c9c814885c87f5.tar.gz
* Handle ++x as well as x++ while converting.
* Add special case handling where normal conversion would not work (some APIs have special names) * Fix conversion for function calls involving ifnet Submitted by: Sreekanth Rupavatharam <rupavath@juniper.net> Obtained from: Juniper Networks, Inc.
Diffstat (limited to 'tools/ifnet')
-rwxr-xr-xtools/ifnet/convert_drvapi.sh61
1 files changed, 54 insertions, 7 deletions
diff --git a/tools/ifnet/convert_drvapi.sh b/tools/ifnet/convert_drvapi.sh
index bdd58ec..dd30c7a 100755
--- a/tools/ifnet/convert_drvapi.sh
+++ b/tools/ifnet/convert_drvapi.sh
@@ -94,7 +94,7 @@ handle_set() {
handle_inc() {
line=$1
- inc=`echo $line | grep "$__ifp__->.*++"`
+ inc=`echo $line | grep "$__ifp__->.*++\|++$__ifp__->.*"`
if [ ! -z "$inc" ]
then
word=`echo $line | awk -F"if_" '{ print $2 }'|awk -F"\+" '{ print $1}'`
@@ -161,6 +161,17 @@ handle_and() {
}
+handle_toggle() {
+ line=$1
+ if [ ! -z `echo $line | grep "\^="` ]
+ then
+ line=`echo $line | sed -e 's/'"$__ifp__"'->if_\(.*\) ^=\(.*\);/if_toggle\1('"$__ifp__"',\2);/g'`
+ return 0;
+ fi
+ return 1
+
+}
+
# XXX - this needs updating
handle_misc() {
line=$1
@@ -179,6 +190,35 @@ handle_misc() {
}
+replace_str ()
+{
+ line=$1
+ orig=$2
+ new=$3
+ line=`echo $line | sed -e 's/'"$orig"'\(.*\)/'"$new"'\1/g'`
+ return 0;
+}
+
+# Handle special cases which do not fall under regular patterns
+handle_special ()
+{
+ line=$1
+ replace_str $line "(\*$__ifp__->if_input)" "if_input"
+ replace_str $line "if_setinit" "if_setinitfn"
+ replace_str $line "if_setioctl" "if_setioctlfn"
+ replace_str $line "if_getdrv_flags" "if_getdrvflags"
+ replace_str $line "if_setdrv_flagsbit" "if_setdrvflagbits"
+ replace_str $line "if_setstart" "if_setstartfn"
+ replace_str $line "if_sethwassistbit" "if_sethwassistbits"
+ replace_str $line "ifmedia_init" "ifmedia_init_drv"
+ replace_str $line "IFQ_DRV_IS_EMPTY(&$__ifp__->if_snd)" "if_sendq_empty($__ifp__)"
+ replace_str $line "IFQ_DRV_PREPEND(&$__ifp__->if_snd" "if_sendq_prepend($__ifp__"
+ replace_str $line "IFQ_SET_READY(&ifp->if_snd)" "if_setsendqready($__ifp__)"
+ line=`echo $line | sed -e 's/IFQ_SET_MAXLEN(&'$__ifp__'->if_snd, \(.*\))/if_setsendqlen('$__ifp__', \1)/g'`
+ line=`echo $line | sed -e 's/IFQ_DRV_DEQUEUE(&'$__ifp__'->if_snd, \(.*\))/\1 = if_dequeue('$__ifp__')/g'`
+ return 0
+}
+
if [ -e $file.tmp ]
then
rm $file.tmp
@@ -201,9 +241,9 @@ do
fi
handle_set $line
-
+
if [ $? != 0 ]
- then
+ then
handle_inc $line
fi
@@ -223,19 +263,26 @@ do
fi
if [ $? != 0 ]
+ then
+ handle_toggle $line
+ fi
+ if [ $? != 0 ]
then
handle_misc $line
fi
if [ $? != 0 ]
then
- if [ ! -z `echo $line | grep "$__ifp__->"` ]
- then
- line=`echo $line | sed -e 's:$: \/* '${FAIL_PAT}' *\/:g'`
- fi
+ handle_special $line
+ fi
+
+ if [ ! -z `echo $line | grep "$__ifp__->"` ]
+ then
+ line=`echo $line | sed -e 's:$: \/* '${FAIL_PAT}' *\/:g'`
fi
done
+ line=`echo "$line" | sed -e 's:VLAN_CAPABILITIES('$__ifp__'):if_vlancap('$__ifp__'):g'`
# Replace the ifnet * with if_t
if [ ! -z `echo $line | grep "struct ifnet"` ]
then
OpenPOWER on IntegriCloud