Re: [PATCH v2 1/5] m68k: Rename system call table file name

2018-09-20 Thread Philippe De Muyter
On Thu, Sep 20, 2018 at 08:36:09PM +0530, Firoz Khan wrote:
> The system call table entries are present in syscalltable.S. One of
> the patch in this patch series will auto-generate the system call
> table entries using the system call table generation script and
> which'll replace the existig table file.
> 
> In order to come up with a common naming convention across all
> architecture, we need to change the file name to syscall_table.S.

That file was probably called that way to be able to distinguish it
from syscalltable.s and syscalltable.o in a file system with a 14
characters limit in file names (in sysV unix systems).

> This change will unify the implementation across all architecture.
> 
> Signed-off-by: Firoz Khan 
> ---
>  arch/m68k/kernel/Makefile|   2 +-
>  arch/m68k/kernel/syscall_table.S | 403 
> +++
>  arch/m68k/kernel/syscalltable.S  | 403 
> ---

You should generate your patch with the '-M' or '--find-renames' option.

Philippe

-- 
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles


[PATCH 1/1] drivers/dio : Changes Makefile to avoid acciental compilation.

2018-09-20 Thread Leonardo Brás
Changes Makefile so 'make drivers/dio/' won't compile this driver
unless CONFIG_DIO is enabled.
Previously, it would compile independently of .config file.

Signed-off-by: Leonardo Brás 
---
 drivers/dio/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dio/Makefile b/drivers/dio/Makefile
index ae92d17083f2..8fc80e805b90 100644
--- a/drivers/dio/Makefile
+++ b/drivers/dio/Makefile
@@ -2,4 +2,4 @@
 # Makefile for the linux kernel.
 #
 
-obj-y := dio.o dio-driver.o dio-sysfs.o
+obj-$(CONFIG_DIO) := dio.o dio-driver.o dio-sysfs.o
-- 
2.19.0



[PATCH v2 4/5] m68k: uapi header and system call table file generation

2018-09-20 Thread Firoz Khan
System call table generation script must be run to generate
unistd_32.h and syscall_table.h files. This patch will have
changes which will invokes the script.

This patch will generate unistd_32.h and syscall_table.h
files by the syscall table generation script invoked by
arch/m68k/Makefile and the generated files against the
removed files will be identical.

The generated uapi header file will be included in
uapi/asm/unistd.h and generated system call table support
file will be included by arch/m68k/kernel/syscall_table.S
file.

Signed-off-by: Firoz Khan 
---
 arch/m68k/Makefile  |   3 +
 arch/m68k/include/asm/Kbuild|   1 +
 arch/m68k/include/uapi/asm/Kbuild   |   1 +
 arch/m68k/include/uapi/asm/unistd.h | 389 +--
 arch/m68k/kernel/syscall_table.S| 399 +---
 5 files changed, 11 insertions(+), 782 deletions(-)

diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 997c9f2..f00ca53 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -154,5 +154,8 @@ endif
 archclean:
rm -f vmlinux.gz vmlinux.bz2
 
+archheaders:
+   $(Q)$(MAKE) $(build)=arch/m68k/kernel/syscalls all
+
 install:
sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz 
System.map "$(INSTALL_PATH)"
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index a4b8d33..68501411 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -24,3 +24,4 @@ generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
+generic-y += syscall_table.h
\ No newline at end of file
diff --git a/arch/m68k/include/uapi/asm/Kbuild 
b/arch/m68k/include/uapi/asm/Kbuild
index c2e26a4..6d600e9 100644
--- a/arch/m68k/include/uapi/asm/Kbuild
+++ b/arch/m68k/include/uapi/asm/Kbuild
@@ -21,3 +21,4 @@ generic-y += statfs.h
 generic-y += termbits.h
 generic-y += termios.h
 generic-y += types.h
+generic-y += unistd_32.h
\ No newline at end of file
diff --git a/arch/m68k/include/uapi/asm/unistd.h 
b/arch/m68k/include/uapi/asm/unistd.h
index ba4176aa..cdbd090 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -2,393 +2,6 @@
 #ifndef _UAPI_ASM_M68K_UNISTD_H_
 #define _UAPI_ASM_M68K_UNISTD_H_
 
-/*
- * This file contains the system call numbers.
- */
-
-#define __NR_restart_syscall 0
-#define __NR_exit1
-#define __NR_fork2
-#define __NR_read3
-#define __NR_write   4
-#define __NR_open5
-#define __NR_close   6
-#define __NR_waitpid 7
-#define __NR_creat   8
-#define __NR_link9
-#define __NR_unlink 10
-#define __NR_execve 11
-#define __NR_chdir  12
-#define __NR_time   13
-#define __NR_mknod  14
-#define __NR_chmod  15
-#define __NR_chown  16
-/*#define __NR_break17*/
-#define __NR_oldstat18
-#define __NR_lseek  19
-#define __NR_getpid 20
-#define __NR_mount  21
-#define __NR_umount 22
-#define __NR_setuid 23
-#define __NR_getuid 24
-#define __NR_stime  25
-#define __NR_ptrace 26
-#define __NR_alarm  27
-#define __NR_oldfstat   28
-#define __NR_pause  29
-#define __NR_utime  30
-/*#define __NR_stty 31*/
-/*#define __NR_gtty 32*/
-#define __NR_access 33
-#define __NR_nice   34
-/*#define __NR_ftime35*/
-#define __NR_sync   36
-#define __NR_kill   37
-#define __NR_rename 38
-#define __NR_mkdir  39
-#define __NR_rmdir  40
-#define __NR_dup41
-#define __NR_pipe   42
-#define __NR_times  43
-/*#define __NR_prof 44*/
-#define __NR_brk45
-#define __NR_setgid 46
-#define __NR_getgid 47
-#define __NR_signal 48
-#define __NR_geteuid49
-#define __NR_getegid50
-#define __NR_acct   51
-#define __NR_umount252
-/*#define __NR_lock 53*/
-#define __NR_ioctl  54
-#define __NR_fcntl  55
-/*#define __NR_mpx  56*/
-#define __NR_setpgid57
-/*#define __NR_ulimit   58*/
-/*#define __NR_oldolduname  59*/
-#define __NR_umask  60
-#define __NR_chroot 61
-#define __NR_ustat  62
-#define __NR_dup2   63
-#define __NR_getppid64
-#define __NR_getpgrp65
-#define __NR_setsid 66
-#define __NR_sigaction  67
-#define __NR_sgetmask   68
-#define __NR_ssetmask   69
-#define __NR_setreuid   70
-#define __NR_setregid   71
-#define 

[PATCH v2 3/5] m68k: Added system call table generation support

2018-09-20 Thread Firoz Khan
The system call tables are in different format in all
architecture and it will be difficult to manually add or
modify the system calls in the respective files. To make
it easy by keeping a script and which'll generate the
header file and syscall table file so this change will
unify them across all architectures.

The system call table generation script is added in
syscalls directory which contain the script to generate
both uapi header file system call table generation file
and syscall.tbl file which'll be the input for the scripts.

syscall.tbl contains the list of available system calls
along with system call number and corresponding entry point.
Add a new system call in this architecture will be possible
by adding new entry in the syscall.tbl file.

Adding a new table entry consisting of:
- System call number.
- ABI.
- System call name.
- Entry point name.

syscallhdr.sh and syscalltbl.sh will generate uapi header-
unistd.h and syscall_table.h files respectively. File
syscall_table.h is included by syscall_table.S - the real
system call table. Both .sh files will parse the content
syscall.tbl to generate the header and table files.

ARM, s390 and x86 architecuture does have the similar support.
I leverage their implementation to come up with a generic
solution. And this is the ground work for y2038 issue. We need
to change two dozons of system call implementation and this
work will reduce the effort by simply modify two dozon entries
in syscall.tbl.

Signed-off-by: Firoz Khan 
---
 arch/m68k/kernel/syscalls/Makefile  |  37 
 arch/m68k/kernel/syscalls/syscall.tbl   | 369 
 arch/m68k/kernel/syscalls/syscallhdr.sh |  39 
 arch/m68k/kernel/syscalls/syscalltbl.sh |  28 +++
 4 files changed, 473 insertions(+)
 create mode 100644 arch/m68k/kernel/syscalls/Makefile
 create mode 100644 arch/m68k/kernel/syscalls/syscall.tbl
 create mode 100644 arch/m68k/kernel/syscalls/syscallhdr.sh
 create mode 100644 arch/m68k/kernel/syscalls/syscalltbl.sh

diff --git a/arch/m68k/kernel/syscalls/Makefile 
b/arch/m68k/kernel/syscalls/Makefile
new file mode 100644
index 000..7624044
--- /dev/null
+++ b/arch/m68k/kernel/syscalls/Makefile
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+out := arch/$(SRCARCH)/include/generated/asm
+uapi := arch/$(SRCARCH)/include/generated/uapi/asm
+
+_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
+ $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
+
+syscall := $(srctree)/$(src)/syscall.tbl
+
+syshdr := $(srctree)/$(src)/syscallhdr.sh
+systbl := $(srctree)/$(src)/syscalltbl.sh
+
+quiet_cmd_syshdr = SYSHDR  $@
+  cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \
+  '$(syshdr_abi_$(basetarget))'  \
+  '$(syshdr_pfx_$(basetarget))'  \
+  '$(syshdr_offset_$(basetarget))'
+
+quiet_cmd_systbl = SYSTBL  $@
+  cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \
+  '$(systbl_abi_$(basetarget))'
+
+$(uapi)/unistd_32.h: $(syscall) $(syshdr)
+   $(call if_changed,syshdr)
+
+$(out)/syscall_table.h: $(syscall) $(systbl)
+   $(call if_changed,systbl)
+
+uapisyshdr-y   += unistd_32.h
+syshdr-y   += syscall_table.h
+
+targets+= $(uapisyshdr-y) $(syshdr-y)
+
+PHONY += all
+all: $(addprefix $(uapi)/,$(uapisyshdr-y))
+all: $(addprefix $(out)/,$(syshdr-y))
+   @:
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl 
b/arch/m68k/kernel/syscalls/syscall.tbl
new file mode 100644
index 000..ab151cd
--- /dev/null
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -0,0 +1,369 @@
+#
+# Linux system call numbers and entry vectors
+#
+# The format is:
+#
+#
+# The abi is always common for this file.
+#
+0   common   restart_syscall  sys_restart_syscall
+1   common   exit sys_exit
+2   common   fork __sys_fork
+3   common   read sys_read
+4   common   writesys_write
+5   common   open sys_open
+6   common   closesys_close
+7   common   waitpid  sys_waitpid
+8   common   creatsys_creat
+9   common   link sys_link
+10  common   unlink   sys_unlink
+11  common   execve   sys_execve
+12  common   chdirsys_chdir
+13  common   time sys_time
+14  common   mknodsys_mknod
+15  common   chmodsys_chmod
+16  common   chownsys_chown16
+18  common   oldstat  sys_stat
+19  common   lseeksys_lseek
+20  common   getpid   sys_getpid
+21  common   mountsys_mount
+22  common   umount   sys_oldumount
+23  common 

[PATCH v2 1/5] m68k: Rename system call table file name

2018-09-20 Thread Firoz Khan
The system call table entries are present in syscalltable.S. One of
the patch in this patch series will auto-generate the system call
table entries using the system call table generation script and
which'll replace the existig table file.

In order to come up with a common naming convention across all
architecture, we need to change the file name to syscall_table.S.
This change will unify the implementation across all architecture.

Signed-off-by: Firoz Khan 
---
 arch/m68k/kernel/Makefile|   2 +-
 arch/m68k/kernel/syscall_table.S | 403 +++
 arch/m68k/kernel/syscalltable.S  | 403 ---
 3 files changed, 404 insertions(+), 404 deletions(-)
 create mode 100644 arch/m68k/kernel/syscall_table.S
 delete mode 100644 arch/m68k/kernel/syscalltable.S

diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index dbac7f8..5f40ce6 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -15,7 +15,7 @@ extra-$(CONFIG_SUN3)  := sun3-head.o
 extra-y+= vmlinux.lds
 
 obj-y  := entry.o irq.o module.o process.o ptrace.o
-obj-y  += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o
+obj-y  += setup.o signal.o sys_m68k.o syscall_table.o time.o traps.o
 
 obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
 obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o
diff --git a/arch/m68k/kernel/syscall_table.S b/arch/m68k/kernel/syscall_table.S
new file mode 100644
index 000..2c8402e
--- /dev/null
+++ b/arch/m68k/kernel/syscall_table.S
@@ -0,0 +1,403 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (C) 2002, Greg Ungerer (g...@snapgear.com)
+ *
+ *  Based on older entry.S files, the following copyrights apply:
+ *
+ *  Copyright (C) 1998  D. Jeff Dionne ,
+ *  Kenneth Albanowski ,
+ *  Copyright (C) 2000  Lineo Inc. (www.lineo.com) 
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ *  Linux/m68k support by Hamish Macdonald
+ */
+
+#include 
+
+#ifndef CONFIG_MMU
+#define sys_mmap2  sys_mmap_pgoff
+#endif
+
+.section .rodata
+ALIGN
+ENTRY(sys_call_table)
+   .long sys_restart_syscall   /* 0 - old "setup()" system call, used 
for restarting */
+   .long sys_exit
+   .long __sys_fork
+   .long sys_read
+   .long sys_write
+   .long sys_open  /* 5 */
+   .long sys_close
+   .long sys_waitpid
+   .long sys_creat
+   .long sys_link
+   .long sys_unlink/* 10 */
+   .long sys_execve
+   .long sys_chdir
+   .long sys_time
+   .long sys_mknod
+   .long sys_chmod /* 15 */
+   .long sys_chown16
+   .long sys_ni_syscall/* old break syscall holder */
+   .long sys_stat
+   .long sys_lseek
+   .long sys_getpid/* 20 */
+   .long sys_mount
+   .long sys_oldumount
+   .long sys_setuid16
+   .long sys_getuid16
+   .long sys_stime /* 25 */
+   .long sys_ptrace
+   .long sys_alarm
+   .long sys_fstat
+   .long sys_pause
+   .long sys_utime /* 30 */
+   .long sys_ni_syscall/* old stty syscall holder */
+   .long sys_ni_syscall/* old gtty syscall holder */
+   .long sys_access
+   .long sys_nice
+   .long sys_ni_syscall/* 35 - old ftime syscall holder */
+   .long sys_sync
+   .long sys_kill
+   .long sys_rename
+   .long sys_mkdir
+   .long sys_rmdir /* 40 */
+   .long sys_dup
+   .long sys_pipe
+   .long sys_times
+   .long sys_ni_syscall/* old prof syscall holder */
+   .long sys_brk   /* 45 */
+   .long sys_setgid16
+   .long sys_getgid16
+   .long sys_signal
+   .long sys_geteuid16
+   .long sys_getegid16 /* 50 */
+   .long sys_acct
+   .long sys_umount/* recycled never used phys() */
+   .long sys_ni_syscall/* old lock syscall holder */
+   .long sys_ioctl
+   .long sys_fcntl /* 55 */
+   .long sys_ni_syscall/* old mpx syscall holder */
+   .long sys_setpgid
+   .long sys_ni_syscall/* old ulimit syscall holder */
+   .long sys_ni_syscall
+   .long sys_umask /* 60 */
+   .long sys_chroot
+   .long sys_ustat
+   .long sys_dup2
+   .long sys_getppid
+   .long sys_getpgrp   /* 65 */
+   .long sys_setsid
+   .long sys_sigaction
+   .long sys_sgetmask
+   .long sys_ssetmask
+   .long sys_setreuid16/* 70 */
+   .long sys_setregid16
+   .long sys_sigsuspend
+   .long sys_sigpending
+   .long sys_sethostname
+   .long sys_setrlimit /* 75 */
+   .long sys_old_getrlimit
+   .long sys_getrusage
+   .long sys_gettimeofday
+   .long sys_settimeofday
+   

[PATCH v2 5/5] m68k: added __IGNORE* entries in asm/unistd.h

2018-09-20 Thread Firoz Khan
Added few __IGNORE* entries for seccomp, pkey_mprotect,
pkey_alloc, pkey_free, io_pgetevents and rseq in the file
asm/unistd.h as it is correct to keep __IGNORE* entry in
non uapi header asm/unistd.h while uapi/asm/unistd.h must
hold information only useful for user space applications.

Signed-off-by: Firoz Khan 
---
 arch/m68k/include/asm/unistd.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 5072e94..cc5f640 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -31,4 +31,11 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 
+#define __IGNORE_seccomp
+#define __IGNORE_pkey_mprotect
+#define __IGNORE_pkey_alloc
+#define __IGNORE_pkey_free
+#define __IGNORE_io_pgetevents
+#define __IGNORE_rseq
+
 #endif /* _ASM_M68K_UNISTD_H_ */
-- 
1.9.1



Re: [PATCH 2/4] m68k: Replace NR_syscalls macro from asm/unistd.h

2018-09-20 Thread Geert Uytterhoeven
Hi Firoz,

On Thu, Sep 20, 2018 at 10:12 AM Firoz Khan  wrote:
> On 18 September 2018 at 15:34, Geert Uytterhoeven  
> wrote:
> > On Tue, Sep 18, 2018 at 9:16 AM Firoz Khan  wrote:
> >> On 9 August 2018 at 13:00, Geert Uytterhoeven  wrote:
> >> > One first comment below...
> >> >
> >> > On Thu, Aug 9, 2018 at 7:16 AM Firoz Khan  wrote:
> >> >> NR_syscalls macro holds the number of system call exist in m68k
> >> >> architecture. This macro is currently the part of asm/unistd.h file.
> >> >> We have to change the value of NR_syscalls, if we add or delete a
> >> >> system call.
> >> >>
> >> >> One of patch in this patch series has a script which will generate
> >> >> a uapi header based on syscall.tbl file. The syscall.tbl file
> >> >> contains the number of system call information. So we have two
> >> >> option to update NR_syscalls value.
> >> >>
> >> >> 1. Update NR_syscalls in asm/unistd.h manually by counting the
> >> >>no.of system calls. No need to update NR_syscalls untill
> >> >>we either add a new system call or delete an existing system
> >> >>call.
> >> >>
> >> >> 2. We can keep this feature it above mentioned script, that'll
> >> >>count the number of syscalls and keep it in a generated file.
> >> >>In this case we don't need to explicitly update NR_syscalls
> >> >>in asm/unistd.h file.
> >> >>
> >> >> The 2nd option will be the recommended one. For that, I moved the
> >> >> NR_syscalls macro from asm/unistd.h to uapi/asm/unistd.h. The macro
> >> >> name also changed form NR_syscalls to __NR_syscalls for making the
> >> >> name convention same across all architecture. While __NR_syscalls
> >> >> isn't strictly part of the uapi, having it as part of the generated
> >> >> header to simplifies the implementation.
> >> >
> >> > It can indeed not be part of the UAPI, as UAPI definitions can never 
> >> > change,
> >> > while new syscalls will be added in the future, increasing the number ;-)
> >>
> >> Thanks for your reply :)
> >> Sorry for the delayed response :(
> >>
> >> I would like to keep __NR_syscalls macro to uapi header in order to 
> >> simplify
> >> the system call table generation script. Otherwise the __NR_syscalls
> >> macro need to update manually. That become a problem.
> >>
> >> Please check the below implementation in uapi file make sense?
> >> It is an easy workaround to leave __NR_syscalls macro in uapi/asm/unistd.h
> >> and enclose it in #ifdef __KERNEL__
> >>
> >> ...
> >> ...
> >> #define __NR_pwritev2  378
> >> #define __NR_statx  379
> >>
> >> #ifdef __KERNEL__
> >> #define __NR_syscalls   380
> >> #endif
> >> ...
> >> ...
> >
> > #ifdef __KERNEL__ sounds fine to me.
>
> I posted similar script for 10 different architectures. I got few good review
> from the maintainers and it will be applicable for all the
> architectures including
> m68k. There are few area which I identified need to improve. This will take
> couple of days.
>
> But it will be very helpful if you can perform the boot test on the
> actual platform
> and share the result.

Builds and boots fine on ARAnyM (virtual Atari).

So for the full series:
Tested-by: Geert Uytterhoeven 

However, I noticed the following effective difference between the old
arch/m68k/include/uapi/asm/unistd.h and the new generated
arch/m68k/include/generated/uapi/asm/unistd_32.h:

-/*#define __NR_break17*/
-/*#define __NR_stty 31*/
-/*#define __NR_gtty 32*/
-/*#define __NR_ftime35*/
-/*#define __NR_prof 44*/
-/*#define __NR_lock 53*/
-/*#define __NR_mpx  56*/
-/*#define __NR_ulimit   58*/
-/*#define __NR_oldolduname  59*/
-/*#define __NR_profil   98*/
-/*#define __NR_ioperm  101*/
-/*#define __NR_olduname109*/
-/*#define __NR_iopl110*/ /* not supported */
-/*#define __NR_idle112*/ /* Obsolete */
-/*#define __NR_vm86113*/ /* not supported */
-/*#define __NR_afs_syscall 137*/ /* Syscall for Andrew File System */
-/*#define __NR_vserver 278*/
+#define __NR_break 17
+#define __NR_stty  31
+#define __NR_gtty  32
+#define __NR_ftime 35
+#define __NR_prof  44
+#define __NR_lock  53
+#define __NR_mpx   56
+#define __NR_ulimit58
+#define __NR_oldolduname   59
+#define __NR_profil98
+#define __NR_ioperm101
+#define __NR_olduname  109
+#define __NR_iopl  110
+#define __NR_idle  112
+#define __NR_vm86  113
+#define __NR_afs_syscall   137
+#define __NR_vserver   278

Given userspace code may contain checks for the presence of these
defines, I think they should not be present.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.

Re: [PATCH 2/4] m68k: Replace NR_syscalls macro from asm/unistd.h

2018-09-20 Thread Firoz Khan
Hi Geert,

On 18 September 2018 at 15:34, Geert Uytterhoeven  wrote:
> Hi Firoz,
>
> On Tue, Sep 18, 2018 at 9:16 AM Firoz Khan  wrote:
>> On 9 August 2018 at 13:00, Geert Uytterhoeven  wrote:
>> > One first comment below...
>> >
>> > On Thu, Aug 9, 2018 at 7:16 AM Firoz Khan  wrote:
>> >> NR_syscalls macro holds the number of system call exist in m68k
>> >> architecture. This macro is currently the part of asm/unistd.h file.
>> >> We have to change the value of NR_syscalls, if we add or delete a
>> >> system call.
>> >>
>> >> One of patch in this patch series has a script which will generate
>> >> a uapi header based on syscall.tbl file. The syscall.tbl file
>> >> contains the number of system call information. So we have two
>> >> option to update NR_syscalls value.
>> >>
>> >> 1. Update NR_syscalls in asm/unistd.h manually by counting the
>> >>no.of system calls. No need to update NR_syscalls untill
>> >>we either add a new system call or delete an existing system
>> >>call.
>> >>
>> >> 2. We can keep this feature it above mentioned script, that'll
>> >>count the number of syscalls and keep it in a generated file.
>> >>In this case we don't need to explicitly update NR_syscalls
>> >>in asm/unistd.h file.
>> >>
>> >> The 2nd option will be the recommended one. For that, I moved the
>> >> NR_syscalls macro from asm/unistd.h to uapi/asm/unistd.h. The macro
>> >> name also changed form NR_syscalls to __NR_syscalls for making the
>> >> name convention same across all architecture. While __NR_syscalls
>> >> isn't strictly part of the uapi, having it as part of the generated
>> >> header to simplifies the implementation.
>> >
>> > It can indeed not be part of the UAPI, as UAPI definitions can never 
>> > change,
>> > while new syscalls will be added in the future, increasing the number ;-)
>>
>> Thanks for your reply :)
>> Sorry for the delayed response :(
>>
>> I would like to keep __NR_syscalls macro to uapi header in order to simplify
>> the system call table generation script. Otherwise the __NR_syscalls
>> macro need to update manually. That become a problem.
>>
>> Please check the below implementation in uapi file make sense?
>> It is an easy workaround to leave __NR_syscalls macro in uapi/asm/unistd.h
>> and enclose it in #ifdef __KERNEL__
>>
>> ...
>> ...
>> #define __NR_pwritev2  378
>> #define __NR_statx  379
>>
>> #ifdef __KERNEL__
>> #define __NR_syscalls   380
>> #endif
>> ...
>> ...
>
> #ifdef __KERNEL__ sounds fine to me.

I posted similar script for 10 different architectures. I got few good review
from the maintainers and it will be applicable for all the
architectures including
m68k. There are few area which I identified need to improve. This will take
couple of days.

But it will be very helpful if you can perform the boot test on the
actual platform
and share the result.

FYI, Keeping a single script is always our plan for long run. But I
have to keep a
separate versions for the start so each architecture can be handled  in one
series. Which would make easier to merge in the initial version. we
could probably
add it to scripts/*.sh first, but that requires more coordination between the
architectures.

- Firoz

>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds