zdb: Fix false leak report for BRT objects
[zfs.git] / config / kernel-inode-setattr.m4
blob69289e897be6b6cb925997ed9989fabe7e037a28
1 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [
2         dnl #
3         dnl # Linux 6.3 API
4         dnl # The first arg of setattr I/O operations handler type
5         dnl # is changed to struct mnt_idmap*
6         dnl #
7         ZFS_LINUX_TEST_SRC([inode_operations_setattr_mnt_idmap], [
8                 #include <linux/fs.h>
10                 static int test_setattr(
11                     struct mnt_idmap *idmap,
12                     struct dentry *de, struct iattr *ia)
13                     { return 0; }
15                 static const struct inode_operations
16                     iops __attribute__ ((unused)) = {
17                         .setattr = test_setattr,
18                 };
19         ],[])
21         dnl #
22         dnl # Linux 5.12 API
23         dnl # The setattr I/O operations handler type was extended to require
24         dnl # a struct user_namespace* as its first arg, to support idmapped
25         dnl # mounts.
26         dnl #
27         ZFS_LINUX_TEST_SRC([inode_operations_setattr_userns], [
28                 #include <linux/fs.h>
30                 static int test_setattr(
31                     struct user_namespace *userns,
32                     struct dentry *de, struct iattr *ia)
33                     { return 0; }
35                 static const struct inode_operations
36                     iops __attribute__ ((unused)) = {
37                         .setattr = test_setattr,
38                 };
39         ],[])
41         ZFS_LINUX_TEST_SRC([inode_operations_setattr], [
42                 #include <linux/fs.h>
44                 static int test_setattr(
45                     struct dentry *de, struct iattr *ia)
46                     { return 0; }
48                 static const struct inode_operations
49                     iops __attribute__ ((unused)) = {
50                         .setattr = test_setattr,
51                 };
52         ],[])
55 AC_DEFUN([ZFS_AC_KERNEL_INODE_SETATTR], [
56         dnl #
57         dnl # Kernel 6.3 test
58         dnl #
59         AC_MSG_CHECKING([whether iops->setattr() takes mnt_idmap])
60         ZFS_LINUX_TEST_RESULT([inode_operations_setattr_mnt_idmap], [
61                 AC_MSG_RESULT(yes)
62                 AC_DEFINE(HAVE_IDMAP_IOPS_SETATTR, 1,
63                     [iops->setattr() takes struct mnt_idmap*])
64         ],[
65                 AC_MSG_RESULT(no)
66                 dnl #
67                 dnl # Kernel 5.12 test
68                 dnl #
69                 AC_MSG_CHECKING([whether iops->setattr() takes user_namespace])
70                 ZFS_LINUX_TEST_RESULT([inode_operations_setattr_userns], [
71                         AC_MSG_RESULT(yes)
72                         AC_DEFINE(HAVE_USERNS_IOPS_SETATTR, 1,
73                             [iops->setattr() takes struct user_namespace*])
74                 ],[
75                         AC_MSG_RESULT(no)
77                         AC_MSG_CHECKING([whether iops->setattr() exists])
78                         ZFS_LINUX_TEST_RESULT([inode_operations_setattr], [
79                                 AC_MSG_RESULT(yes)
80                                 AC_DEFINE(HAVE_IOPS_SETATTR, 1,
81                                         [iops->setattr() exists])
82                         ],[
83                                 AC_MSG_RESULT(no)
84                         ])
85                 ])
86         ])