Re: [PATCH 4/6] sysctl: remove all extern declaration from sysctl.c

From: Eric W. Biederman
Date: Wed Apr 22 2020 - 08:36:23 EST


Christoph Hellwig <hch@xxxxxx> writes:

> Extern declarations in .c files are a bad style and can lead to
> mismatches. Use existing definitions in headers where they exist,
> and otherwise move the external declarations to suitable header
> files.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
> include/linux/coredump.h | 6 ++++++
> include/linux/file.h | 2 ++
> include/linux/mm.h | 2 ++
> include/linux/mmzone.h | 2 ++
> include/linux/sysctl.h | 8 +++++++
> kernel/sysctl.c | 45 +++-------------------------------------
> 6 files changed, 23 insertions(+), 42 deletions(-)
>
> diff --git a/include/linux/coredump.h b/include/linux/coredump.h
> index abf4b4e65dbb..0fe8f3131e97 100644
> --- a/include/linux/coredump.h
> +++ b/include/linux/coredump.h
> @@ -22,4 +22,10 @@ extern void do_coredump(const kernel_siginfo_t *siginfo);
> static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
> #endif
>
> +extern int core_uses_pid;
> +extern char core_pattern[];
> +extern unsigned int core_pipe_limit;
> +extern int pid_max;
> +extern int pid_max_min, pid_max_max;

These last two pid_max, pid_max_mind and pid_max_max would make more
sense in pid.h as they have nothing to do with coredumps.

> +
> #endif /* _LINUX_COREDUMP_H */