mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-24 18:51:36 +01:00
fix kernel modules build after updating linux to v5.9.2
- `dep.c` and `dep2.c`: `debugfs_create_u32` does not return anymore, not sure why: https://unix.stackexchange.com/questions/593983/creating-a-debugfs-file-that-is-used-to-read-write-u32-value/621282#621282 So just doing `debugfs_lookup` for now - vermagic.c:51161bfc66prevents its usage in v5.8. Just migrating to `init_utsname` for now - procfs.c: `struct file_operations` moved to a new `struct proc_ops` at:b567e07513- myprintk.c: `pr_warning` dropped for `pr_warn`:61ff72f401- `poll.c`: `kthread_func` is not defined in kernel, prefix with lkmc to avoid conflict Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/136 Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/137
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#mmap */
|
||||
|
||||
#include <asm-generic/io.h> /* virt_to_phys */
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h> /* min */
|
||||
@@ -120,17 +121,17 @@ static int release(struct inode *inode, struct file *filp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations fops = {
|
||||
.mmap = mmap,
|
||||
.open = open,
|
||||
.release = release,
|
||||
.read = read,
|
||||
.write = write,
|
||||
static const struct proc_ops pops = {
|
||||
.proc_mmap = mmap,
|
||||
.proc_open = open,
|
||||
.proc_release = release,
|
||||
.proc_read = read,
|
||||
.proc_write = write,
|
||||
};
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
proc_create(filename, 0, NULL, &fops);
|
||||
proc_create(filename, 0, NULL, &pops);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user