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