Commit f40cbaa5 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

proc: move sysrq-trigger out of fs/proc/

Move it into sysrq.c, along with the rest of the sysrq implementation.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ac0d86f5
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/kbd_kern.h> #include <linux/kbd_kern.h>
#include <linux/proc_fs.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -534,3 +535,32 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) ...@@ -534,3 +535,32 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op_p)
return __sysrq_swap_key_ops(key, NULL, op_p); return __sysrq_swap_key_ops(key, NULL, op_p);
} }
EXPORT_SYMBOL(unregister_sysrq_key); EXPORT_SYMBOL(unregister_sysrq_key);
#ifdef CONFIG_PROC_FS
/*
* writing 'C' to /proc/sysrq-trigger is like sysrq-C
*/
static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
if (count) {
char c;
if (get_user(c, buf))
return -EFAULT;
__handle_sysrq(c, NULL, 0);
}
return count;
}
static const struct file_operations proc_sysrq_trigger_operations = {
.write = write_sysrq_trigger,
};
static int __init sysrq_init(void)
{
proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
return 0;
}
module_init(sysrq_init);
#endif
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/hugetlb.h> #include <linux/hugetlb.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/sysrq.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/pid_namespace.h> #include <linux/pid_namespace.h>
...@@ -704,28 +703,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off, ...@@ -704,28 +703,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off,
return proc_calc_metrics(page, start, off, count, eof, len); return proc_calc_metrics(page, start, off, count, eof, len);
} }
#ifdef CONFIG_MAGIC_SYSRQ
/*
* writing 'C' to /proc/sysrq-trigger is like sysrq-C
*/
static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
if (count) {
char c;
if (get_user(c, buf))
return -EFAULT;
__handle_sysrq(c, NULL, 0);
}
return count;
}
static const struct file_operations proc_sysrq_trigger_operations = {
.write = write_sysrq_trigger,
};
#endif
#ifdef CONFIG_PROC_PAGE_MONITOR #ifdef CONFIG_PROC_PAGE_MONITOR
#define KPMSIZE sizeof(u64) #define KPMSIZE sizeof(u64)
#define KPMMASK (KPMSIZE - 1) #define KPMMASK (KPMSIZE - 1)
...@@ -934,7 +911,4 @@ void __init proc_misc_init(void) ...@@ -934,7 +911,4 @@ void __init proc_misc_init(void)
#ifdef CONFIG_PROC_VMCORE #ifdef CONFIG_PROC_VMCORE
proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
#endif #endif
#ifdef CONFIG_MAGIC_SYSRQ
proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
#endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment