diff mbox series

[1/4] Rename syscalls order file to supported-arch.txt

Message ID 20240924-generate_syscalls-v1-1-941507a9cdac@suse.com
State Superseded
Headers show
Series Automatically generate syscalls.h | expand

Commit Message

Andrea Cervesato Sept. 24, 2024, 8:06 a.m. UTC
From: Andrea Cervesato <andrea.cervesato@suse.com>

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 include/lapi/syscalls/regen.sh                     | 88 +++++++++++-----------
 .../lapi/syscalls/{order => supported-arch.txt}    |  1 -
 2 files changed, 44 insertions(+), 45 deletions(-)
diff mbox series

Patch

diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
index 663ce4458..e06746483 100755
--- a/include/lapi/syscalls/regen.sh
+++ b/include/lapi/syscalls/regen.sh
@@ -14,7 +14,7 @@  err() {
 	exit 1
 }
 
-cat << EOF > "${output_pid}"
+cat <<EOF >"${output_pid}"
 /************************************************
  * GENERATED FILE: DO NOT EDIT/PATCH THIS FILE  *
  *  change your arch specific .in file instead  *
@@ -65,40 +65,40 @@  inline static void dummy_cleanup(void) {}
 EOF
 
 jobs=0
-for arch in $(cat "${srcdir}/order") ; do
+for arch in $(cat "${srcdir}/supported-arch.txt"); do
 	(
-	echo "Generating data for arch $arch ... "
-
-	(
-	echo
-	case ${arch} in
-		sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
-		sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
-		s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
-		mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
-		mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
-		mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
-		*) echo "#ifdef __${arch}__" ;;
-	esac
-	while read line ; do
-		set -- ${line}
-		nr="__NR_$1"
-		shift
-		if [ $# -eq 0 ] ; then
-			err "invalid line found: $line"
-		fi
-		echo "# ifndef ${nr}"
-		echo "#  define ${nr} $*"
-		echo "# endif"
-	done < "${srcdir}/${arch}.in"
-	echo "#endif"
-	echo
-	) >> "${output_pid}.${arch}"
+		echo "Generating data for arch $arch ... "
+
+		(
+			echo
+			case ${arch} in
+			sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
+			sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
+			s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
+			mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
+			mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
+			mips_o32) echo "#if defined(__mips__) && defined(_ABIO32) && _MIPS_SZLONG == 32" ;;
+			*) echo "#ifdef __${arch}__" ;;
+			esac
+			while read line; do
+				set -- ${line}
+				nr="__NR_$1"
+				shift
+				if [ $# -eq 0 ]; then
+					err "invalid line found: $line"
+				fi
+				echo "# ifndef ${nr}"
+				echo "#  define ${nr} $*"
+				echo "# endif"
+			done <"${srcdir}/${arch}.in"
+			echo "#endif"
+			echo
+		) >>"${output_pid}.${arch}"
 
 	) &
 
-	jobs=$(( jobs + 1 ))
-	if [ ${jobs} -ge ${max_jobs} ] ; then
+	jobs=$((jobs + 1))
+	if [ ${jobs} -ge ${max_jobs} ]; then
 		wait || exit 1
 		jobs=0
 	fi
@@ -106,24 +106,24 @@  done
 
 echo "Generating stub list ... "
 (
-echo
-echo "/* Common stubs */"
-echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}"
-for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do
-	nr="__NR_${nr}"
-	echo "# ifndef ${nr}"
-	echo "#  define ${nr} __LTP__NR_INVALID_SYSCALL"
-	echo "# endif"
-done
-echo "#endif"
-) >> "${output_pid}._footer"
+	echo
+	echo "/* Common stubs */"
+	echo "#define __LTP__NR_INVALID_SYSCALL -1" >>"${output_pid}"
+	for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u); do
+		nr="__NR_${nr}"
+		echo "# ifndef ${nr}"
+		echo "#  define ${nr} __LTP__NR_INVALID_SYSCALL"
+		echo "# endif"
+	done
+	echo "#endif"
+) >>"${output_pid}._footer"
 
 wait || exit 1
 
 printf "Combining them all ... "
-for arch in $(cat "${srcdir}/order") _footer ; do
+for arch in $(cat "${srcdir}/supported-arch.txt") _footer; do
 	cat "${output_pid}.${arch}"
-done >> "${output_pid}"
+done >>"${output_pid}"
 mv "${output_pid}" "../${output}"
 rm -f "${output_pid}"*
 echo "OK!"
diff --git a/include/lapi/syscalls/order b/include/lapi/syscalls/supported-arch.txt
similarity index 91%
rename from include/lapi/syscalls/order
rename to include/lapi/syscalls/supported-arch.txt
index c18aa38cf..de88957ed 100644
--- a/include/lapi/syscalls/order
+++ b/include/lapi/syscalls/supported-arch.txt
@@ -8,7 +8,6 @@  loongarch
 mips_n32
 mips_n64
 mips_o32
-powerpc64
 powerpc
 s390x
 s390