]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-proc-operations.m4
Unify Assembler files between Linux and Windows
[FreeBSD/FreeBSD.git] / config / kernel-proc-operations.m4
1 dnl #
2 dnl # 5.6 API Change
3 dnl # The proc_ops structure was introduced to replace the use of
4 dnl # of the file_operations structure when registering proc handlers.
5 dnl #
6 AC_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
33 AC_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 ])