1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/fs.h> 3 #include <linux/init.h> 4 #include <linux/proc_fs.h> 5 #include <linux/seq_file.h> 6 7 extern const struct seq_operations cpuinfo_op; 8 static int cpuinfo_open(struct inode *inode, struct file *file) 9 { 10 return seq_open(file, &cpuinfo_op); 11 } 12 13 static const struct file_operations proc_cpuinfo_operations = { 14 .open = cpuinfo_open, 15 .read = seq_read, 16 .llseek = seq_lseek, 17 .release = seq_release, 18 }; 19 20 static int __init proc_cpuinfo_init(void) 21 { 22 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); 23 return 0; 24 } 25 fs_initcall(proc_cpuinfo_init); 26