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.

64 lines
1.8 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. diff --git a/kernelmod/mrm_ctlfile.c b/kernelmod/mrm_ctlfile.c
  10. index 85a8bf9..ca8e7d8 100644
  11. --- a/kernelmod/mrm_ctlfile.c
  12. +++ b/kernelmod/mrm_ctlfile.c
  13. @@ -13,6 +13,7 @@
  14. #include "./macremapper_ioctl.h"
  15. #include "./bufprintf.h"
  16. +#include <linux/version.h>
  17. #include <linux/proc_fs.h>
  18. #include <linux/uaccess.h>
  19. #include <linux/mutex.h>
  20. @@ -80,13 +81,14 @@ mrm_handle_read(struct file *f, char __user *buf, size_t size, loff_t *off) {
  21. }
  22. static long
  23. -mrm_handle_ioctl(struct file *f, unsigned int type, void __user *param) {
  24. +mrm_handle_ioctl(struct file *f, unsigned int type, unsigned long arg) {
  25. union {
  26. struct mrm_filter_config filt_conf;
  27. struct mrm_remap_entry remap_entry;
  28. unsigned count;
  29. } u;
  30. int rv;
  31. + void __user *param = (void __user *)arg;
  32. mutex_lock(&_ctrl_mutex);
  33. @@ -159,6 +161,14 @@ fail_fault:
  34. }
  35. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  36. +static const struct proc_ops _fops = {
  37. + .proc_open = mrm_handle_open,
  38. + .proc_release = mrm_handle_release,
  39. + .proc_read = mrm_handle_read,
  40. + .proc_ioctl = mrm_handle_ioctl,
  41. +};
  42. +#else
  43. static const struct file_operations _fops = {
  44. owner: THIS_MODULE,
  45. open: &mrm_handle_open,
  46. @@ -166,6 +176,7 @@ static const struct file_operations _fops = {
  47. read: &mrm_handle_read,
  48. unlocked_ioctl: (void*)&mrm_handle_ioctl,
  49. };
  50. +#endif
  51. int mrm_init_ctlfile( void ) {
  52. struct proc_dir_entry *pde;
  53. --
  54. 2.30.0