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