All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v8 2/4] Add script to generate arch(s) dependant syscalls
Date: Fri, 1 Nov 2024 10:18:02 +0100	[thread overview]
Message-ID: <20241101091802.GA1180540@pevik> (raw)
In-Reply-To: <20241031-generate_syscalls-v8-2-8e35a9d6783b@suse.com>

Hi Andrea,

the script works for me, great!

Few more comments, I promis the last one, feel free to just ignore them.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> --- /dev/null
> +++ b/include/lapi/syscalls/generate_arch.sh
> @@ -0,0 +1,206 @@
> +#!/bin/sh -eu
> +# SPDX-License-Identifier: GPL-2.0-or-later
I would put here your/SUSE/LTP copyright (2024) and the original author
copyright:
# Copyright (c) Marcin Juszkiewicz, 2023-2024

The author does not have it in the script, but it has in LICENSE:
Copyright (c) Marcin Juszkiewicz

But I'm not a lawyer, maybe I'm wrong.

> +#
> +# This is an adaptation of the update-tables.sh script, included in the
> +# syscalls-table project (https://github.com/hrw/syscalls-table) and released
> +# under the MIT license.
> +#
> +# Author: Andrea Cervesato <andrea.cervesato@suse.com>
> +
> +if [ "$#" -eq "0" ]; then
> +	echo "Please provide kernel sources:"
> +	echo ""
> +	echo "$0 path/to/Linux/kernel/sources"
> +	echo ""
> +	exit 1
> +fi

nit: use common syntax ($# is always defined, thus not need to be quoted, 0 as
well, "" is empty string, thus can be omitted):
if [ $# -eq 0 ]; then
	echo "Please provide kernel sources:"
	echo
	echo "$0 path/to/Linux/kernel/sources"
	echo
	exit 1
fi

...
> +generate_list_syscalls_c() {
> +	(
very nit: this first echo is probably not needed.
> +		echo
> +		echo "
> +		#include <stdio.h>
> +		#include <asm/unistd.h>
> +
> +		int main(void)
> +		{
> +		"
> +		for syscall in $(cat ${TEMP}/syscall-names.txt); do
> +			echo "
> +		#ifdef __NR_$syscall
> +			printf(\"$syscall %d\\\n\", __NR_$syscall);
> +		#endif
> +		"
> +		done
> +		echo " return 0;
> +		}"
> +	) >${TEMP}/list-syscalls.c
> +}
...
> +
> +do_all_tables() {
> +	for archdir in ${KERNELSRC}/arch/*; do
> +		arch=$(basename $archdir)
...
> +			arch=x86_64 extraflags=-D__LP64__ generate_table
> +			bits=32
> +			arch=i386 generate_table
> +			arch=x32 extraflags=-D__ILP32__ generate_table
> +			;;
> +		arc | csky | hexagon | m68k | microblaze | nios2 | openrisc | sh | xtensa)
I've never seen spaces between '|' separator in shell case command. It should
not cause anything, but it's just unusual (original code in
https://github.com/hrw/syscalls-table/blob/master/scripts/update-tables.sh
from which we diverged quite a lot now also does not have it).

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-11-01  9:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 16:01 [LTP] [PATCH v8 0/4] Automatically generate syscalls.h Andrea Cervesato
2024-10-31 16:01 ` [LTP] [PATCH v8 1/4] Refactor regen.sh script to generate syscalls Andrea Cervesato
2024-10-31 16:21   ` Cyril Hrubis
2024-11-01  7:39     ` Petr Vorel
2024-11-01  8:07       ` Andrea Cervesato via ltp
2024-10-31 16:01 ` [LTP] [PATCH v8 2/4] Add script to generate arch(s) dependant syscalls Andrea Cervesato
2024-11-01  9:18   ` Petr Vorel [this message]
2024-10-31 16:01 ` [LTP] [PATCH v8 3/4] Delete obsolete strip_syscall.awk file Andrea Cervesato
2024-10-31 16:01 ` [LTP] [PATCH v8 4/4] Add documentation about syscalls.h generator Andrea Cervesato
2024-10-31 16:31   ` Cyril Hrubis
2024-11-01  7:56     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241101091802.GA1180540@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.