xref: /freebsd/sys/contrib/openzfs/config/kernel-proc-operations.m4 (revision 9e5787d2284e187abb5b654d924394a65772e004)
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		int test_open(struct inode *ip, struct file *fp) { return 0; }
11		ssize_t test_read(struct file *fp, char __user *ptr,
12		    size_t size, loff_t *offp) { return 0; }
13		ssize_t test_write(struct file *fp, const char __user *ptr,
14		    size_t size, loff_t *offp) { return 0; }
15		loff_t test_lseek(struct file *fp, loff_t off, int flag)
16		    { return 0; }
17		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