From ff4c6a2861600e9737aa2b14000af7ec9b7618e1 Mon Sep 17 00:00:00 2001 From: Andrew Walsh Date: Wed, 26 Feb 2020 20:44:57 -0500 Subject: [PATCH] Update procfs args for kernel 5.6 and above. With commit d56c0d45f0e27f814e87a1676b6bdccccbc252e9 in the kernel, proc calls need to use 'struct proc_ops' instead of 'struct file_operations'. This commit applies that requirement for kernels 5.6 and newer. --- vdo/kernel/statusProcfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vdo/kernel/statusProcfs.c b/vdo/kernel/statusProcfs.c index 70e8c9b..26b67f9 100644 --- a/vdo/kernel/statusProcfs.c +++ b/vdo/kernel/statusProcfs.c @@ -82,12 +82,21 @@ static int statusDedupeOpen(struct inode *inode, struct file *file) #endif } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) +static const struct proc_ops vdoProcfsDedupeOps = { + .proc_open = statusDedupeOpen, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, +}; +#else static const struct file_operations vdoProcfsDedupeOps = { .open = statusDedupeOpen, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; +#endif /**********************************************************************/ static void copyBioStat(BioStats *b, const AtomicBioStats *a) @@ -175,12 +184,21 @@ static int statusKernelOpen(struct inode *inode, struct file *file) #endif } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) +static const struct proc_ops vdoProcfsKernelOps = { + .proc_open = statusKernelOpen, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, +}; +#else static const struct file_operations vdoProcfsKernelOps = { .open = statusKernelOpen, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; +#endif /**********************************************************************/ int vdoInitProcfs()