[LTP] [PATCH v5 1/3] Refactor regen.sh script to generate syscalls

Petr Vorel pvorel@suse.cz
Wed Oct 30 15:49:08 CET 2024


Hi Andrea,

> +++ b/include/lapi/syscalls/generate_syscalls.sh
> @@ -0,0 +1,115 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Generate the syscalls.h file, merging all architectures syscalls input file
> +# which are in the current folder and defined inside supported-arch.txt file.
> +
> +SYSCALLS_FILE="$1"
> +
> +if [ -z "${SYSCALLS_FILE}" ]; then
nit: I would still replace ${...} with $... (e.g. ${SYSCALLS_FILE} =>
$SYSCALLS_FILE) as I noted in v4 - readability. IMHO there is no need to use
${...} in whole script.

The same applies to include/lapi/syscalls/generate_arch.sh in the second commit.

> +	echo "Please provide the syscalls.h directory:"
> +	echo ""
> +	echo "$0 path/of/syscalls.h"
> +	echo ""
> +	exit 1
> +fi
> +
> +SCRIPT_DIR="$(realpath $(dirname "$0"))"
> +SUPPORTED_ARCH="${SCRIPT_DIR}/supported-arch.txt"
> +
> +echo '
> +/************************************************
> +* GENERATED FILE: DO NOT EDIT/PATCH THIS FILE  *
> +*  change your arch specific .in file instead  *
> +************************************************/
> +
> +/*
> +* Here we stick all the ugly *fallback* logic for linux
> +* system call numbers (those __NR_ thingies).
> +*
> +* Licensed under the GPLv2 or later, see the COPYING file.
> +*/


nit: fixing space in /* */ comments (correct in the original regen.sh)
+ replacing old note about COPYING with SPDX in generated header:

+++ include/lapi/syscalls/generate_syscalls.sh
@@ -17,18 +17,16 @@ fi
 SCRIPT_DIR="$(realpath $(dirname "$0"))"
 SUPPORTED_ARCH="${SCRIPT_DIR}/supported-arch.txt"
 
-echo '
+echo '// SPDX-License-Identifier: GPL-2.0-or-later
 /************************************************
-* GENERATED FILE: DO NOT EDIT/PATCH THIS FILE  *
-*  change your arch specific .in file instead  *
-************************************************/
+ * GENERATED FILE: DO NOT EDIT/PATCH THIS FILE  *
+ *  change your arch specific .in file instead  *
+ ************************************************/
 
 /*
-* Here we stick all the ugly *fallback* logic for linux
-* system call numbers (those __NR_ thingies).
-*
-* Licensed under the GPLv2 or later, see the COPYING file.
-*/
+ * Here we stick all the ugly *fallback* logic for linux
+ * system call numbers (those __NR_ thingies).
+ */
 
 #ifndef LAPI_SYSCALLS_H__
 #define LAPI_SYSCALLS_H__
---

Kind regards,
Petr


More information about the ltp mailing list