Remove unused seq_list functions.
[cascardo/kernel/samples/03.proc/.git] / hello_procfs.c
1 /*
2  *  Copyright (C) 2009  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along
15  *  with this program; if not, write to the Free Software Foundation, Inc.,
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19
20 #include <linux/module.h>
21 #include <linux/proc_fs.h>
22 #include <linux/seq_file.h>
23
24 MODULE_AUTHOR("Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>");
25 MODULE_LICENSE("GPL");
26
27 static int hello_show(struct seq_file *file, void *data)
28 {
29         seq_puts(file, "Hello, world!\n");
30         return 0;
31 }
32
33 static int hello_procfs_open(struct inode *inode, struct file *file)
34 {
35         return single_open(file, hello_show, NULL);
36 }
37
38 static const struct file_operations hello_procfs_fops =
39 {
40         .open = hello_procfs_open,
41         .read = seq_read,
42         .llseek = seq_lseek,
43         .release = seq_release,
44 };
45
46 static int hello_procfs_init(void)
47 {
48         struct proc_dir_entry *entry;
49         entry = create_proc_entry("gnu", 0666, NULL);
50         entry->proc_fops = &hello_procfs_fops;
51         return 0;
52 }
53
54 static void hello_procfs_exit(void)
55 {
56         remove_proc_entry("gnu", NULL);
57 }
58
59 module_init(hello_procfs_init);
60 module_exit(hello_procfs_exit);