Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2401466imm; Sat, 13 Oct 2018 18:08:05 -0700 (PDT) X-Google-Smtp-Source: ACcGV61dAh6ZatzjNAvcXTWm/tVODnwK/NNU3ALtTxR0jZBcjgkbWIZGNW9pzWiR2CZ11PFpD0Ep X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr11249256pll.32.1539479285198; Sat, 13 Oct 2018 18:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539479285; cv=none; d=google.com; s=arc-20160816; b=L3o45pvxffNxrBACXFJhoIdzrXyPckq34Z/VCRWpP8DxrIVknypLeb2J+V154XcTK4 OCWdO5FQfLFNk9ZGsPdZtEA7z2asydSXfjVmxhX0lYdJ4/1X+VAH7iBTMrhxea3iaWzj wSW2BPfId0fiYx1OljK551g7YK9ty63grsDEOe5TesTzvzoXO1zW562W6zGRBv410Hey /XOjTgHDz6i6cGMcUjQwg44V/EFpxM6KB6WsRh43XZGw/nU1RKMdUKNtU3Cb/XLFDOYJ SLlNiOAJZgW/gnKGuVTb9+YBsKUD8H6HhuuPk83ZhWrGrMnhwX2h6rMCQo06v7LkGHN5 N1LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zFcRw4PeA2kYX/N45d5BSDSMQkaSw/CA/tEOZg6YB/U=; b=VP373+mcpm1FxvKVS1vsLVmHfSzUc7oSOk3uMn6WadiVdtbXgh9z9coSeQyA0P4cIw dclsuQyAyls2CzDG7R1wNROy+NUT0HWaENIO/z9cH3c136WSwMKXb0bk0Jnmf4u9IsyS Xekrf2tqMI5P5fR5mdP/xgESnfLIVpVmzM5YBl+N+ULCu1ICAMoLL2OvGxJI6h7gjeYI v1Ng6hQ503GZNc09T+I3vXj0w49eKmzpq2wCp3Au5EBlSP/TlGlJxdNg1lz6lXXuObhE BU/XCW23Bjt9QoA+qpYt5lG/Rd8ZWSsV1F+pXpbROIv00U8JKMxU4YPAlvqIdFShKiDI tAsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si6618184pfd.50.2018.10.13.18.07.26; Sat, 13 Oct 2018 18:08:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbeJNIpu (ORCPT + 99 others); Sun, 14 Oct 2018 04:45:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34630 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725733AbeJNIpu (ORCPT ); Sun, 14 Oct 2018 04:45:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B05C93082133; Sun, 14 Oct 2018 01:06:41 +0000 (UTC) Received: from asgard.redhat.com (ovpn-200-28.brq.redhat.com [10.40.200.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A239280795; Sun, 14 Oct 2018 01:06:36 +0000 (UTC) Date: Sun, 14 Oct 2018 03:06:58 +0200 From: Eugene Syromiatnikov 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@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, arnd@arndb.de, deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org Subject: Re: [PATCH v4 3/6] parisc: add system call table generation support Message-ID: <20181014010658.GB717@asgard.redhat.com> 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 Content-Disposition: inline In-Reply-To: <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sun, 14 Oct 2018 01:06:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 12, 2018 at 03:13:59PM +0530, Firoz Khan wrote: > diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl > new file mode 100644 > index 0000000..7c9f268 > +86 common uselib sys_ni_syscall Again, why is this definition left, while others have been removed? > +348 common pwritev2 sys_pwritev2 compat_sys_pwritev2 > +349 common statx sys_statx > +350 common io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents Tab instead of spaces. > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh > new file mode 100644 > index 0000000..607d4ca > --- /dev/null > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh > @@ -0,0 +1,35 @@ > +#!/bin/sh /bin/sh -efu > +# SPDX-License-Identifier: GPL-2.0 "export LANG=C", due to usage of sed/grep/sort. > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +prefix="$4" > +offset="$5" > + > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \ > + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ > + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( grep -E '^[[:xdigit:]Xx]+[[:space:]]+'"${my_abis}" "$in" sort -n -k1,1 > + echo "#ifndef ${fileguard}" > + echo "#define ${fileguard}" > + echo "" cat <<-EOF #ifndef ${fileguard} #define ${fileguard} EOF > + > + nxt=0 > + while read nr abi name entry compat ; do > + if [ -z "$offset" ]; then > + echo -e "#define __NR_${prefix}${name}\t$nr" > + else > + echo -e "#define __NR_${prefix}${name}\t($offset + $nr)" > + fi echo options are not portable; something like printf "#define __NR_%s%s\t(%s + %s)" "${prefix}" "${name}" "${offset}" "${nr}" > + nxt=$nr > + let nxt=nxt+1 "let" is a bash extension, posix-conformant expression would be nxt=$((nr + 1)) (I would also check that nr >= nxt, however) > + done > + > + echo "" > + echo "#ifdef __KERNEL__" > + echo -e "#define __NR_syscalls\t$nxt" > + echo "#endif" > + echo "" > + echo "#endif /* ${fileguard} */" cat <<-EOF #ifdef __KERNEL__ # define __NR_syscalls\t${nxt} #endif #endif /* ${fileguard} */ EOF > +) > "$out" > diff --git a/arch/parisc/kernel/syscalls/syscalltbl.sh b/arch/parisc/kernel/syscalls/syscalltbl.sh > new file mode 100644 > index 0000000..04abde7 > --- /dev/null > +++ b/arch/parisc/kernel/syscalls/syscalltbl.sh > @@ -0,0 +1,46 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +offset="$4" > + > +emit() { > + nxt="$1" > + if [ -z "$offset" ]; then > + nr="$2" > + else > + nr="$2" > + nr=$((nr+offset)) > + fi > + entry="$3" > + > + while [ $nxt -lt $nr ]; do It would break nicely if nxt="-n x -o 1" or something like that. > + echo "__SYSCALL($nxt, sys_ni_syscall, )" > + let nxt=nxt+1 > + done > + echo "__SYSCALL($nxt, $entry, )" > +} > + > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + if [ -z "$offset" ]; then > + nxt=0 > + else > + nxt=$offset > + fi > + > + my_abi="$(cut -d'|' -f2 <<< $my_abis)" my_abi="${my_abis#*|}" But it looks like that $my_abis includes parentheses and this code is broken. > + 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 > + let nxt=nxt+1 > + done > +) > "$out" > -- > 1.9.1 >