From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rolf Eike Beer Subject: Re: [PATCH v4 3/6] parisc: add system call table generation support Date: Fri, 12 Oct 2018 16:03:35 +0200 Message-ID: <24dae8ebfd18a60e844383ae4beed486@sf-tec.de> References: <1539337442-3676-1-git-send-email-firoz.khan@linaro.org> <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Firoz Khan Cc: linux-parisc@vger.kernel.org, "James E . J . Bottomley" , Helge Deller , Thomas Gleixner , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , Linux-Arch , Arnd Bergmann , Deepa Dinamani , Marcin Juszkiewicz , linux-parisc-owner@vger.kernel.org List-Id: linux-arch.vger.kernel.org Firoz Khan wrote: >> > + >> > + my_abi="$(cut -d'|' -f2 <<< $my_abis)" > > Here is the logic of identifying the generated script is for compat > interface > or not. So systbl_abi_syscall_table_c32 := common,compat,32 in Makefile > will parse the script and check the second string whether this is > "compat" or not. > > Other ways are: > 1. add an extra flag, that will again add the complexity > 2. check if [ ${out: -5} = "c32.h" ], this looks weird > > Is there any better way to do the same? What part is that comment directed at? I guess it's the next hunk, so I'll comment on that. >> "<<<" is a bash extension and will not work with /bin/sh. >> >> > + while read nr abi name entry compat ; do >> > + if [ $my_abi = "compat" ]; then >> > + if [ -z "$compat" ]; then >> > + emit $nxt $nr $entry >> > + else >> > + emit $nxt $nr $compat >> > + fi >> > + else >> > + emit $nxt $nr $entry >> > + fi >> >> I would go for a local variable being set to $compat or $entry and >> calling emit at only one place. And there should be only one if with 2 >> expressions, no need for 3 branches. if [ $my_abi = "compat" -a -n "${compat}" ]; then somevar=${compat} else somevar=${entry} fi emit $nxt $nr $somevar Eike From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.sf-mail.de ([78.47.74.12]:34313 "EHLO mail.sf-mail.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728635AbeJLVgP (ORCPT ); Fri, 12 Oct 2018 17:36:15 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 12 Oct 2018 16:03:35 +0200 From: Rolf Eike Beer Subject: Re: [PATCH v4 3/6] parisc: add system call table generation support In-Reply-To: References: <1539337442-3676-1-git-send-email-firoz.khan@linaro.org> <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> Message-ID: <24dae8ebfd18a60e844383ae4beed486@sf-tec.de> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Firoz Khan Cc: linux-parisc@vger.kernel.org, "James E . J . Bottomley" , Helge Deller , Thomas Gleixner , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , Linux-Arch , Arnd Bergmann , Deepa Dinamani , Marcin Juszkiewicz , linux-parisc-owner@vger.kernel.org Message-ID: <20181012140335.jWV_B0o5yqFnbzEl-a4y6eiMinh5WL64-1gh-YNtru0@z> Firoz Khan wrote: >> > + >> > + my_abi="$(cut -d'|' -f2 <<< $my_abis)" > > Here is the logic of identifying the generated script is for compat > interface > or not. So systbl_abi_syscall_table_c32 := common,compat,32 in Makefile > will parse the script and check the second string whether this is > "compat" or not. > > Other ways are: > 1. add an extra flag, that will again add the complexity > 2. check if [ ${out: -5} = "c32.h" ], this looks weird > > Is there any better way to do the same? What part is that comment directed at? I guess it's the next hunk, so I'll comment on that. >> "<<<" is a bash extension and will not work with /bin/sh. >> >> > + while read nr abi name entry compat ; do >> > + if [ $my_abi = "compat" ]; then >> > + if [ -z "$compat" ]; then >> > + emit $nxt $nr $entry >> > + else >> > + emit $nxt $nr $compat >> > + fi >> > + else >> > + emit $nxt $nr $entry >> > + fi >> >> I would go for a local variable being set to $compat or $entry and >> calling emit at only one place. And there should be only one if with 2 >> expressions, no need for 3 branches. if [ $my_abi = "compat" -a -n "${compat}" ]; then somevar=${compat} else somevar=${entry} fi emit $nxt $nr $somevar Eike