You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

  1. From 6126f8efebf659708245ba99df6b85d7c1260668 Mon Sep 17 00:00:00 2001
  2. From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
  3. Date: Sun, 31 Jan 2021 20:53:32 -0800
  4. Subject: [PATCH] mrm_ctlfile.c: compatibility with linux >= 5.6
  5. Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
  6. ---
  7. kernelmod/mrm_ctlfile.c | 13 ++++++++++++-
  8. 1 file changed, 12 insertions(+), 1 deletion(-)
  9. --- a/kernelmod/mrm_ctlfile.c
  10. +++ b/kernelmod/mrm_ctlfile.c
  11. @@ -13,6 +13,7 @@
  12. #include "./macremapper_ioctl.h"
  13. #include "./bufprintf.h"
  14. +#include <linux/version.h>
  15. #include <linux/proc_fs.h>
  16. #include <linux/uaccess.h>
  17. #include <linux/mutex.h>
  18. @@ -80,13 +81,14 @@ mrm_handle_read(struct file *f, char __u
  19. }
  20. static long
  21. -mrm_handle_ioctl(struct file *f, unsigned int type, void __user *param) {
  22. +mrm_handle_ioctl(struct file *f, unsigned int type, unsigned long arg) {
  23. union {
  24. struct mrm_filter_config filt_conf;
  25. struct mrm_remap_entry remap_entry;
  26. unsigned count;
  27. } u;
  28. int rv;
  29. + void __user *param = (void __user *)arg;
  30. mutex_lock(&_ctrl_mutex);
  31. @@ -159,6 +161,14 @@ fail_fault:
  32. }
  33. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  34. +static const struct proc_ops _fops = {
  35. + .proc_open = mrm_handle_open,
  36. + .proc_release = mrm_handle_release,
  37. + .proc_read = mrm_handle_read,
  38. + .proc_ioctl = mrm_handle_ioctl,
  39. +};
  40. +#else
  41. static const struct file_operations _fops = {
  42. owner: THIS_MODULE,
  43. open: &mrm_handle_open,
  44. @@ -166,6 +176,7 @@ static const struct file_operations _fop
  45. read: &mrm_handle_read,
  46. unlocked_ioctl: (void*)&mrm_handle_ioctl,
  47. };
  48. +#endif
  49. int mrm_init_ctlfile( void ) {
  50. struct proc_dir_entry *pde;