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:
  51161bfc66
  prevents 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:
Ciro Santilli 六四事件 法轮功
2020-11-24 00:00:01 +00:00
parent fa8c2ee521
commit 50570326d4
9 changed files with 65 additions and 34 deletions

View File

@@ -54,7 +54,7 @@ unsigned int poll(struct file *filp, struct poll_table_struct *wait)
}
}
static int kthread_func(void *data)
static int lkmc_kthread_func(void *data)
{
while (!kthread_should_stop()) {
readbuflen = snprintf(
@@ -81,7 +81,7 @@ static int myinit(void)
debugfs_file = debugfs_create_file(
"lkmc_poll", S_IRUSR | S_IWUSR, NULL, NULL, &fops);
init_waitqueue_head(&waitqueue);
kthread = kthread_create(kthread_func, NULL, "mykthread");
kthread = kthread_create(lkmc_kthread_func, NULL, "mykthread");
wake_up_process(kthread);
return 0;
}