If CONFIG_SYSCTL is n, build warn: kernel/reboot.c:443:20: error: ‘kernel_reboot_sysctls_init’ defined but not used [-Werror=unused-function] static void __init kernel_reboot_sysctls_init(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~ Move kernel_reboot_sysctls_init() to #ifdef block to fix this.
Unified · Split
| @@ -421,33 +421,6 @@ void ctrl_alt_del(void) · 420 unmodified lines | ||
| 421 | 421 | static char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; |
| 422 | 422 | static const char reboot_cmd[] = "/sbin/reboot"; |
| 423 | 423 | |
| 424 | −#ifdef CONFIG_SYSCTL | |
| 425 | −static struct ctl_table kern_reboot_table[] = { | |
| 426 | − { | |
| 427 | − .procname = "poweroff_cmd", | |
| 428 | − .data = &poweroff_cmd, | |
| 429 | − .maxlen = POWEROFF_CMD_PATH_LEN, | |
| 430 | − .mode = 0644, | |
| 431 | − .proc_handler = proc_dostring, | |
| 432 | − }, | |
| 433 | − { | |
| 434 | − .procname = "ctrl-alt-del", | |
| 435 | − .data = &C_A_D, | |
| 436 | − .maxlen = sizeof(int), | |
| 437 | − .mode = 0644, | |
| 438 | − .proc_handler = proc_dointvec, | |
| 439 | − }, | |
| 440 | − { } | |
| 441 | −}; | |
| 442 | − | |
| 443 | −static void __init kernel_reboot_sysctls_init(void) | |
| 444 | −{ | |
| 445 | − register_sysctl_init("kernel", kern_reboot_table); | |
| 446 | −} | |
| 447 | −#else | |
| 448 | −#define kernel_reboot_sysctls_init() do { } while (0) | |
| 449 | −#endif /* CONFIG_SYSCTL */ | |
| 450 | − | |
| 451 | 424 | static int run_cmd(const char *cmd) |
| 452 | 425 | { |
| 453 | 426 | char **argv; |
| @@ -895,6 +868,33 @@ static struct attribute *reboot_attrs[] = { · 441 unmodified lines | ||
| 895 | 868 | NULL, |
| 896 | 869 | }; |
| 897 | 870 | |
| 871 | +#ifdef CONFIG_SYSCTL | |
| 872 | +static struct ctl_table kern_reboot_table[] = { | |
| 873 | + { | |
| 874 | + .procname = "poweroff_cmd", | |
| 875 | + .data = &poweroff_cmd, | |
| 876 | + .maxlen = POWEROFF_CMD_PATH_LEN, | |
| 877 | + .mode = 0644, | |
| 878 | + .proc_handler = proc_dostring, | |
| 879 | + }, | |
| 880 | + { | |
| 881 | + .procname = "ctrl-alt-del", | |
| 882 | + .data = &C_A_D, | |
| 883 | + .maxlen = sizeof(int), | |
| 884 | + .mode = 0644, | |
| 885 | + .proc_handler = proc_dointvec, | |
| 886 | + }, | |
| 887 | + { } | |
| 888 | +}; | |
| 889 | + | |
| 890 | +static void __init kernel_reboot_sysctls_init(void) | |
| 891 | +{ | |
| 892 | + register_sysctl_init("kernel", kern_reboot_table); | |
| 893 | +} | |
| 894 | +#else | |
| 895 | +#define kernel_reboot_sysctls_init() do { } while (0) | |
| 896 | +#endif /* CONFIG_SYSCTL */ | |
| 897 | + | |
| 898 | 898 | static const struct attribute_group reboot_attr_group = { |
| 899 | 899 | .attrs = reboot_attrs, |
| 900 | 900 | }; |