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
2929 extern phys_addr_t phys_initrd_start;
3030 extern unsigned long phys_initrd_size;
3131
32−extern unsigned int real_root_dev;
33−
3432 extern char __initramfs_start[];
3533 extern unsigned long __initramfs_size;
3634
init/do_mounts_initrd.c+21−1
@@ -14,12 +14,32 @@ · 13 unmodified lines
1414
1515 unsigned long initrd_start, initrd_end;
1616 int initrd_below_start_ok;
17−unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
17+static unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
1818 static int __initdata mount_initrd = 1;
1919
2020 phys_addr_t phys_initrd_start __initdata;
2121 unsigned long phys_initrd_size __initdata;
2222
23+#ifdef CONFIG_SYSCTL
24+static 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+
35+static __init int kernel_do_mounts_initrd_sysctls_init(void)
36+{
37+ register_sysctl_init("kernel", kern_do_mounts_initrd_table);
38+ return 0;
39+}
40+late_initcall(kernel_do_mounts_initrd_sysctls_init);
41+#endif /* CONFIG_SYSCTL */
42+
2343 static int __init no_initrd(char *str)
2444 {
2545 mount_initrd = 0;
kernel/sysctl.c+0−9
@@ -1693,15 +1693,6 @@ static struct ctl_table kern_table[] = { · 1692 unmodified lines
16931693 .mode = 0644,
16941694 .proc_handler = sysctl_latencytop,
16951695 },
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− },
17051696 #endif
17061697 {
17071698 .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