/* SPDX-License-Identifier: GPL-2.0+ */ #ifndef _AVM_ENH_PROC_COMPAT_H #define _AVM_ENH_PROC_COMPAT_H #include #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) #define DECLARE_PROC_COMPAT_FOPS(_name) struct proc_ops _name #define PROC_COMPAT_FOPS(_name, _open, _read, _write, _lseek, _release) \ struct proc_ops _name = { \ .proc_open = _open, \ .proc_write = _write, \ .proc_read = _read, \ .proc_lseek = _lseek, \ .proc_release = _release, \ } #define PROC_SET_COMPAT_FOPS(_name, _open, _read, _write, _lseek, _release) \ do { \ _name.proc_open = _open; \ _name.proc_write = _write; \ _name.proc_read = _read; \ _name.proc_lseek = _lseek; \ _name.proc_release = _release; \ } while (0) #else #define DECLARE_PROC_COMPAT_FOPS(_name) struct file_operations _name #define PROC_COMPAT_FOPS(_name, _open, _read, _write, _lseek, _release) \ struct file_operations _name = { \ .open = _open, \ .write = _write, \ .read = _read, \ .llseek = _lseek, \ .release = _release, \ } #define PROC_SET_COMPAT_FOPS(_name, _open, _read, _write, _lseek, _release) \ do { \ _name.open = _open; \ _name.write = _write; \ _name.read = _read; \ _name.llseek = _lseek; \ _name.release = _release; \ } while (0) #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */ #endif /* _AVM_ENH_PROC_COMPAT_H */