Fix O_APPEND for Linux 3.15 and older kernels
[zfs.git] / config / kernel-inode-getattr.m4
blobf62e82f5230a307b0fac3c7e8564b1255756be41
1 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
2         dnl #
3         dnl # Linux 5.12 API
4         dnl # The getattr I/O operations handler type was extended to require
5         dnl # a struct user_namespace* as its first arg, to support idmapped
6         dnl # mounts.
7         dnl #
8         ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
9                 #include <linux/fs.h>
11                 int test_getattr(
12                         struct user_namespace *userns,
13                     const struct path *p, struct kstat *k,
14                     u32 request_mask, unsigned int query_flags)
15                     { return 0; }
17                 static const struct inode_operations
18                     iops __attribute__ ((unused)) = {
19                         .getattr = test_getattr,
20                 };
21         ],[])
23         dnl #
24         dnl # Linux 4.11 API
25         dnl # See torvalds/linux@a528d35
26         dnl #
27         ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
28                 #include <linux/fs.h>
30                 int test_getattr(
31                     const struct path *p, struct kstat *k,
32                     u32 request_mask, unsigned int query_flags)
33                     { return 0; }
35                 static const struct inode_operations
36                     iops __attribute__ ((unused)) = {
37                         .getattr = test_getattr,
38                 };
39         ],[])
41         ZFS_LINUX_TEST_SRC([inode_operations_getattr_vfsmount], [
42                 #include <linux/fs.h>
44                 int test_getattr(
45                     struct vfsmount *mnt, struct dentry *d,
46                     struct kstat *k)
47                     { return 0; }
49                 static const struct inode_operations
50                     iops __attribute__ ((unused)) = {
51                         .getattr = test_getattr,
52                 };
53         ],[])
56 AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
57         dnl #
58         dnl # Kernel 5.12 test
59         dnl #
60         AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
61         ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
62                 AC_MSG_RESULT(yes)
63                 AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
64                     [iops->getattr() takes struct user_namespace*])
65         ],[
66                 AC_MSG_RESULT(no)
68                 dnl #
69                 dnl # Kernel 4.11 test
70                 dnl #
71                 AC_MSG_CHECKING([whether iops->getattr() takes a path])
72                 ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
73                         AC_MSG_RESULT(yes)
74                         AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
75                                 [iops->getattr() takes a path])
76                 ],[
77                         AC_MSG_RESULT(no)
79                         dnl #
80                         dnl # Kernel < 4.11 test
81                         dnl #
82                         AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
83                         ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
84                                 AC_MSG_RESULT(yes)
85                                 AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
86                                         [iops->getattr() takes a vfsmount])
87                         ],[
88                                 AC_MSG_RESULT(no)
89                         ])
90                 ])
91         ])