Skip to content

Commit 4fb5a85

Browse files
committed
labs: kernel_modules: use proc_ops when calling proc_create
* use proc_ops instead of file_operations Signed-off-by: Claudiu Ghioc <claudiu.ghioc@gmail.com>
1 parent 6063576 commit 4fb5a85

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

tools/labs/templates/kernel_modules/8-kdb/hello_kdb.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,32 +101,30 @@ static int bug_write(struct file *file, const char *buffer,
101101
return count;
102102
}
103103

104-
static const struct file_operations edit_proc_fops = {
105-
.owner = THIS_MODULE,
106-
.open = hello_proc_open,
107-
.read = seq_read,
108-
.write = edit_write,
109-
.llseek = seq_lseek,
110-
.release = single_release,
104+
static const struct proc_ops edit_proc_ops = {
105+
.proc_open = hello_proc_open,
106+
.proc_read = seq_read,
107+
.proc_write = edit_write,
108+
.proc_lseek = seq_lseek,
109+
.proc_release = single_release,
111110
};
112111

113-
static const struct file_operations bug_proc_fops = {
114-
.owner = THIS_MODULE,
115-
.open = hello_proc_open,
116-
.read = seq_read,
117-
.write = bug_write,
118-
.llseek = seq_lseek,
119-
.release = single_release,
112+
static const struct proc_ops bug_proc_ops = {
113+
.proc_open = hello_proc_open,
114+
.proc_read = seq_read,
115+
.proc_write = bug_write,
116+
.proc_lseek = seq_lseek,
117+
.proc_release = single_release,
120118
};
121119

122120
static int __init hello_proc_init(void) {
123121
struct proc_dir_entry *file;
124-
file = proc_create("hello_kdb_bug", 0, NULL, &bug_proc_fops);
122+
file = proc_create("hello_kdb_bug", 0, NULL, &bug_proc_ops);
125123
if (file == NULL) {
126124
return -ENOMEM;
127125
}
128126

129-
file = proc_create("hello_kdb_break", 0, NULL, &edit_proc_fops);
127+
file = proc_create("hello_kdb_break", 0, NULL, &edit_proc_ops);
130128
if (file == NULL) {
131129
remove_proc_entry("hello_kdb_bug", NULL);
132130
return -ENOMEM;

0 commit comments

Comments
 (0)