Skip to content
This repository was archived by the owner on Oct 1, 2022. It is now read-only.

Commit b74beab

Browse files
committed
Changing fops type to struct proc_ops
struct file_operations* type is obsolete for proc_create function call and was breaking the compilation. Changing fops variable type to proc_ops fixes this. Signed-off-by: ysiyer <[email protected]>
1 parent 6148022 commit b74beab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

kaslr_offset/kernel_module/direct_physical_map.c

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <asm/io.h>
2+
#include <linux/version.h>
23
#include <linux/kernel.h>
34
#include <linux/module.h>
45
#include <linux/proc_fs.h>
@@ -12,13 +13,23 @@ static int show_offset(struct seq_file *m, void *v) {
1213
static int proc_open(struct inode *inode, struct file *file) {
1314
return single_open(file, show_offset, NULL);
1415
}
16+
17+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
18+
static struct proc_ops fops = {
19+
.proc_open = proc_open,
20+
.proc_read = seq_read,
21+
.proc_lseek = seq_lseek,
22+
.proc_release = single_release,
23+
};
24+
#else
1525
static struct file_operations fops = {
1626
.owner = THIS_MODULE,
1727
.open = proc_open,
1828
.release = single_release,
1929
.read = seq_read,
2030
.llseek = seq_lseek,
2131
};
32+
#endif
2233

2334
static int __init kaslr_init(void) {
2435
struct proc_dir_entry *entry;

0 commit comments

Comments
 (0)