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

Commit

Permalink
Changing fops type to struct proc_ops
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ysiyer committed May 13, 2022
1 parent 6148022 commit b74beab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kaslr_offset/kernel_module/direct_physical_map.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <asm/io.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
Expand All @@ -12,13 +13,23 @@ static int show_offset(struct seq_file *m, void *v) {
static int proc_open(struct inode *inode, struct file *file) {
return single_open(file, show_offset, NULL);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
static struct proc_ops fops = {
.proc_open = proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static struct file_operations fops = {
.owner = THIS_MODULE,
.open = proc_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
#endif

static int __init kaslr_init(void) {
struct proc_dir_entry *entry;
Expand Down

0 comments on commit b74beab

Please sign in to comment.