1dnl #
2dnl # 5.6 API Change
3dnl # The proc_ops structure was introduced to replace the use of
4dnl # of the file_operations structure when registering proc handlers.
5dnl #
6AC_DEFUN([ZFS_AC_KERNEL_SRC_PROC_OPERATIONS], [
7	ZFS_LINUX_TEST_SRC([proc_ops_struct], [
8		#include <linux/proc_fs.h>
9
10		static int test_open(struct inode *ip, struct file *fp) { return 0; }
11		static ssize_t test_read(struct file *fp, char __user *ptr,
12		    size_t size, loff_t *offp) { return 0; }
13		static ssize_t test_write(struct file *fp, const char __user *ptr,
14		    size_t size, loff_t *offp) { return 0; }
15		static loff_t test_lseek(struct file *fp, loff_t off, int flag)
16		    { return 0; }
17		static int test_release(struct inode *ip, struct file *fp)
18		    { return 0; }
19
20		const struct proc_ops test_ops __attribute__ ((unused)) = {
21			.proc_open      = test_open,
22			.proc_read      = test_read,
23			.proc_write	= test_write,
24			.proc_lseek     = test_lseek,
25			.proc_release   = test_release,
26		};
27	], [
28		struct proc_dir_entry *entry __attribute__ ((unused)) =
29		    proc_create_data("test", 0444, NULL, &test_ops, NULL);
30	])
31])
32
33AC_DEFUN([ZFS_AC_KERNEL_PROC_OPERATIONS], [
34	AC_MSG_CHECKING([whether proc_ops structure exists])
35	ZFS_LINUX_TEST_RESULT([proc_ops_struct], [
36		AC_MSG_RESULT(yes)
37		AC_DEFINE(HAVE_PROC_OPS_STRUCT, 1, [proc_ops structure exists])
38	], [
39		AC_MSG_RESULT(no)
40	])
41])
42