Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sysctl: remove all extern declaration from sysctl.c

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@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
2374c09b 26363af5

+24 -42
+4
include/linux/coredump.h
··· 22 22 static inline void do_coredump(const kernel_siginfo_t *siginfo) {} 23 23 #endif 24 24 25 + extern int core_uses_pid; 26 + extern char core_pattern[]; 27 + extern unsigned int core_pipe_limit; 28 + 25 29 #endif /* _LINUX_COREDUMP_H */
+2
include/linux/file.h
··· 94 94 extern void flush_delayed_fput(void); 95 95 extern void __fput_sync(struct file *); 96 96 97 + extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max; 98 + 97 99 #endif /* __LINUX_FILE_H */
+2
include/linux/mm.h
··· 3140 3140 pgoff_t first_index, pgoff_t nr); 3141 3141 #endif 3142 3142 3143 + extern int sysctl_nr_trim_pages; 3144 + 3143 3145 #endif /* __KERNEL__ */ 3144 3146 #endif /* _LINUX_MM_H */
+2
include/linux/mmzone.h
··· 909 909 910 910 /* These two functions are used to setup the per zone pages min values */ 911 911 struct ctl_table; 912 + 912 913 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, 913 914 void __user *, size_t *, loff_t *); 914 915 int watermark_scale_factor_sysctl_handler(struct ctl_table *, int, ··· 926 925 927 926 extern int numa_zonelist_order_handler(struct ctl_table *, int, 928 927 void __user *, size_t *, loff_t *); 928 + extern int percpu_pagelist_fraction; 929 929 extern char numa_zonelist_order[]; 930 930 #define NUMA_ZONELIST_ORDER_LEN 16 931 931
+3
include/linux/pid.h
··· 108 108 struct pid_namespace; 109 109 extern struct pid_namespace init_pid_ns; 110 110 111 + extern int pid_max; 112 + extern int pid_max_min, pid_max_max; 113 + 111 114 /* 112 115 * look up a PID in the hash table. Must be called with the tasklist_lock 113 116 * or rcu_read_lock() held.
+8
include/linux/sysctl.h
··· 207 207 208 208 extern int sysctl_init(void); 209 209 210 + extern int pwrsw_enabled; 211 + extern int unaligned_enabled; 212 + extern int unaligned_dump_stack; 213 + extern int no_unaligned_warning; 214 + 210 215 extern struct ctl_table sysctl_mount_point[]; 216 + extern struct ctl_table random_table[]; 217 + extern struct ctl_table firmware_config_table[]; 218 + extern struct ctl_table epoll_table[]; 211 219 212 220 #else /* CONFIG_SYSCTL */ 213 221 static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
+3 -42
kernel/sysctl.c
··· 68 68 #include <linux/bpf.h> 69 69 #include <linux/mount.h> 70 70 #include <linux/userfaultfd_k.h> 71 + #include <linux/coredump.h> 72 + #include <linux/latencytop.h> 73 + #include <linux/pid.h> 71 74 72 75 #include "../lib/kstrtox.h" 73 76 ··· 105 102 #endif 106 103 107 104 #if defined(CONFIG_SYSCTL) 108 - 109 - /* External variables not in a header file. */ 110 - extern int suid_dumpable; 111 - #ifdef CONFIG_COREDUMP 112 - extern int core_uses_pid; 113 - extern char core_pattern[]; 114 - extern unsigned int core_pipe_limit; 115 - #endif 116 - extern int pid_max; 117 - extern int pid_max_min, pid_max_max; 118 - extern int percpu_pagelist_fraction; 119 - extern int latencytop_enabled; 120 - extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max; 121 - #ifndef CONFIG_MMU 122 - extern int sysctl_nr_trim_pages; 123 - #endif 124 105 125 106 /* Constants used for minimum and maximum */ 126 107 #ifdef CONFIG_LOCKUP_DETECTOR ··· 146 159 147 160 #ifdef CONFIG_INOTIFY_USER 148 161 #include <linux/inotify.h> 149 - #endif 150 - #ifdef CONFIG_SPARC 151 - #endif 152 - 153 - #ifdef CONFIG_PARISC 154 - extern int pwrsw_enabled; 155 - #endif 156 - 157 - #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW 158 - extern int unaligned_enabled; 159 - #endif 160 - 161 - #ifdef CONFIG_IA64 162 - extern int unaligned_dump_stack; 163 - #endif 164 - 165 - #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN 166 - extern int no_unaligned_warning; 167 162 #endif 168 163 169 164 #ifdef CONFIG_PROC_SYSCTL ··· 212 243 static struct ctl_table fs_table[]; 213 244 static struct ctl_table debug_table[]; 214 245 static struct ctl_table dev_table[]; 215 - extern struct ctl_table random_table[]; 216 - #ifdef CONFIG_EPOLL 217 - extern struct ctl_table epoll_table[]; 218 - #endif 219 - 220 - #ifdef CONFIG_FW_LOADER_USER_HELPER 221 - extern struct ctl_table firmware_config_table[]; 222 - #endif 223 246 224 247 #if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ 225 248 defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)