]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-mkdir.m4
ztest: use ASSERT3P to compare pointers
[FreeBSD/FreeBSD.git] / config / kernel-mkdir.m4
1 dnl #
2 dnl # Supported mkdir() interfaces checked newest to oldest.
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
5         dnl #
6         dnl # 6.3 API change
7         dnl # mkdir() takes struct mnt_idmap * as the first arg
8         dnl #
9         ZFS_LINUX_TEST_SRC([mkdir_mnt_idmap], [
10                 #include <linux/fs.h>
11
12                 static int mkdir(struct mnt_idmap *idmap,
13                         struct inode *inode, struct dentry *dentry,
14                         umode_t umode) { return 0; }
15                 static const struct inode_operations
16                     iops __attribute__ ((unused)) = {
17                         .mkdir = mkdir,
18                 };
19         ],[])
20
21         dnl #
22         dnl # 5.12 API change
23         dnl # The struct user_namespace arg was added as the first argument to
24         dnl # mkdir()
25         dnl #
26         ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [
27                 #include <linux/fs.h>
28
29                 static int mkdir(struct user_namespace *userns,
30                         struct inode *inode, struct dentry *dentry,
31                     umode_t umode) { return 0; }
32
33                 static const struct inode_operations
34                     iops __attribute__ ((unused)) = {
35                         .mkdir = mkdir,
36                 };
37         ],[])
38
39         dnl #
40         dnl # 3.3 API change
41         dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
42         dnl # umode_t type rather than an int.  The expectation is that any backport
43         dnl # would also change all three prototypes.  However, if it turns out that
44         dnl # some distribution doesn't backport the whole thing this could be
45         dnl # broken apart into three separate checks.
46         dnl #
47         ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
48                 #include <linux/fs.h>
49
50                 static int mkdir(struct inode *inode, struct dentry *dentry,
51                     umode_t umode) { return 0; }
52
53                 static const struct inode_operations
54                     iops __attribute__ ((unused)) = {
55                         .mkdir = mkdir,
56                 };
57         ],[])
58 ])
59
60 AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [
61         dnl #
62         dnl # 6.3 API change
63         dnl # mkdir() takes struct mnt_idmap * as the first arg
64         dnl #
65         AC_MSG_CHECKING([whether iops->mkdir() takes struct mnt_idmap*])
66         ZFS_LINUX_TEST_RESULT([mkdir_mnt_idmap], [
67                 AC_MSG_RESULT(yes)
68                 AC_DEFINE(HAVE_IOPS_MKDIR_IDMAP, 1,
69                     [iops->mkdir() takes struct mnt_idmap*])
70         ],[
71                 dnl #
72                 dnl # 5.12 API change
73                 dnl # The struct user_namespace arg was added as the first argument to
74                 dnl # mkdir() of the iops structure.
75                 dnl #
76                 AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
77                 ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
78                         AC_MSG_RESULT(yes)
79                         AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
80                             [iops->mkdir() takes struct user_namespace*])
81                 ],[
82                         AC_MSG_RESULT(no)
83
84                         AC_MSG_CHECKING([whether iops->mkdir() takes umode_t])
85                         ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
86                                 AC_MSG_RESULT(yes)
87                                 AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
88                                     [iops->mkdir() takes umode_t])
89                         ],[
90                                 ZFS_LINUX_TEST_ERROR([mkdir()])
91                         ])
92                 ])
93         ])
94 ])