mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Linux 5.6 compat: struct proc_ops
The proc_ops structure was introduced to replace the use of of the file_operations structure when registering proc handlers. This change creates a new kstat_proc_op_t typedef for compatibility which can be used to pass around the correct structure. This change additionally adds the 'const' keyword to all of the existing proc operations structures. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #9961
This commit is contained in:
committed by
Tony Hutter
parent
06b473a8ae
commit
6e8c4dc460
@@ -0,0 +1,41 @@
|
||||
dnl #
|
||||
dnl # 5.6 API Change
|
||||
dnl # The proc_ops structure was introduced to replace the use of
|
||||
dnl # of the file_operations structure when registering proc handlers.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_PROC_OPERATIONS], [
|
||||
ZFS_LINUX_TEST_SRC([proc_ops_struct], [
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
int test_open(struct inode *ip, struct file *fp) { return 0; }
|
||||
ssize_t test_read(struct file *fp, char __user *ptr,
|
||||
size_t size, loff_t *offp) { return 0; }
|
||||
ssize_t test_write(struct file *fp, const char __user *ptr,
|
||||
size_t size, loff_t *offp) { return 0; }
|
||||
loff_t test_lseek(struct file *fp, loff_t off, int flag)
|
||||
{ return 0; }
|
||||
int test_release(struct inode *ip, struct file *fp)
|
||||
{ return 0; }
|
||||
|
||||
const struct proc_ops test_ops __attribute__ ((unused)) = {
|
||||
.proc_open = test_open,
|
||||
.proc_read = test_read,
|
||||
.proc_write = test_write,
|
||||
.proc_lseek = test_lseek,
|
||||
.proc_release = test_release,
|
||||
};
|
||||
], [
|
||||
struct proc_dir_entry *entry __attribute__ ((unused)) =
|
||||
proc_create_data("test", 0444, NULL, &test_ops, NULL);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_PROC_OPERATIONS], [
|
||||
AC_MSG_CHECKING([whether proc_ops structure exists])
|
||||
ZFS_LINUX_TEST_RESULT([proc_ops_struct], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PROC_OPS_STRUCT, 1, [proc_ops structure exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -53,6 +53,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_TIMER_SETUP
|
||||
ZFS_AC_KERNEL_SRC_CURRENT_BIO_TAIL
|
||||
ZFS_AC_KERNEL_SRC_SUPER_USER_NS
|
||||
ZFS_AC_KERNEL_SRC_PROC_OPERATIONS
|
||||
ZFS_AC_KERNEL_SRC_SUBMIT_BIO
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
|
||||
@@ -170,6 +171,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_TIMER_SETUP
|
||||
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
|
||||
ZFS_AC_KERNEL_SUPER_USER_NS
|
||||
ZFS_AC_KERNEL_PROC_OPERATIONS
|
||||
ZFS_AC_KERNEL_SUBMIT_BIO
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS
|
||||
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
|
||||
|
||||
Reference in New Issue
Block a user