History

kernel/do_mount_initrd: move real_root_dev sysctls to its own file

kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the real_root_dev sysctl to its own file, kernel/do_mount_initrd.c.

tangmeng committed 4 years ago

Commit d772cc21 parent 11866183 files · +21 −12Browse files

Unified · Split

3 files
  1. include/linux/initrd.h +0 −2
  2. init/do_mounts_initrd.c +21 −1
  3. kernel/sysctl.c +0 −9
include/linux/initrd.h+0−2
@@ -29,8 +29,6 @@ static inline void wait_for_initramfs(void) {} · 28 unmodified lines
29extern phys_addr_t phys_initrd_start;29extern phys_addr_t phys_initrd_start;
30extern unsigned long phys_initrd_size;30extern unsigned long phys_initrd_size;
31 31
32extern unsigned int real_root_dev;
33
34extern char __initramfs_start[];32extern char __initramfs_start[];
35extern unsigned long __initramfs_size;33extern unsigned long __initramfs_size;
36 34
init/do_mounts_initrd.c+21−1
@@ -14,12 +14,32 @@ · 13 unmodified lines
14 14
15unsigned long initrd_start, initrd_end;15unsigned long initrd_start, initrd_end;
16int initrd_below_start_ok;16int initrd_below_start_ok;
17unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */17static unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
18static int __initdata mount_initrd = 1;18static int __initdata mount_initrd = 1;
19 19
20phys_addr_t phys_initrd_start __initdata;20phys_addr_t phys_initrd_start __initdata;
21unsigned long phys_initrd_size __initdata;21unsigned long phys_initrd_size __initdata;
22 22
23#ifdef CONFIG_SYSCTL
24static struct ctl_table kern_do_mounts_initrd_table[] = {
25 {
26 .procname = "real-root-dev",
27 .data = &real_root_dev,
28 .maxlen = sizeof(int),
29 .mode = 0644,
30 .proc_handler = proc_dointvec,
31 },
32 { }
33};
34
35static __init int kernel_do_mounts_initrd_sysctls_init(void)
36{
37 register_sysctl_init("kernel", kern_do_mounts_initrd_table);
38 return 0;
39}
40late_initcall(kernel_do_mounts_initrd_sysctls_init);
41#endif /* CONFIG_SYSCTL */
42
23static int __init no_initrd(char *str)43static int __init no_initrd(char *str)
24{44{
25 mount_initrd = 0;45 mount_initrd = 0;
kernel/sysctl.c+0−9
@@ -1693,15 +1693,6 @@ static struct ctl_table kern_table[] = { · 1692 unmodified lines
1693 .mode = 0644,1693 .mode = 0644,
1694 .proc_handler = sysctl_latencytop,1694 .proc_handler = sysctl_latencytop,
1695 },1695 },
1696#endif
1697#ifdef CONFIG_BLK_DEV_INITRD
1698 {
1699 .procname = "real-root-dev",
1700 .data = &real_root_dev,
1701 .maxlen = sizeof(int),
1702 .mode = 0644,
1703 .proc_handler = proc_dointvec,
1704 },
1705#endif1696#endif
1706 {1697 {
1707 .procname = "print-fatal-signals",1698 .procname = "print-fatal-signals",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t