From owner-svn-src-all@FreeBSD.ORG Wed Jun 25 15:22:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 214F0A9E; Wed, 25 Jun 2014 15:22:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03C6F23D6; Wed, 25 Jun 2014 15:22:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5PFMEPg077658; Wed, 25 Jun 2014 15:22:14 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5PFMEKx077657; Wed, 25 Jun 2014 15:22:14 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201406251522.s5PFMEKx077657@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 25 Jun 2014 15:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267870 - head/tools/ifnet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2014 15:22:15 -0000 Author: marcel Date: Wed Jun 25 15:22:14 2014 New Revision: 267870 URL: http://svnweb.freebsd.org/changeset/base/267870 Log: * 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 Obtained from: Juniper Networks, Inc. Modified: head/tools/ifnet/convert_drvapi.sh Modified: head/tools/ifnet/convert_drvapi.sh ============================================================================== --- head/tools/ifnet/convert_drvapi.sh Wed Jun 25 14:23:30 2014 (r267869) +++ head/tools/ifnet/convert_drvapi.sh Wed Jun 25 15:22:14 2014 (r267870) @@ -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