xref: /freebsd/sys/contrib/openzfs/config/kernel-mkdir.m4 (revision b1c1ee4429fcca8f69873a8be66184e68e1b19d7)
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		dnl #
88		dnl # 6.3 API change
89		dnl # mkdir() takes struct mnt_idmap * as the first arg
90		dnl #
91		AC_MSG_CHECKING([whether iops->mkdir() takes struct mnt_idmap*])
92		ZFS_LINUX_TEST_RESULT([mkdir_mnt_idmap], [
93			AC_MSG_RESULT(yes)
94			AC_DEFINE(HAVE_IOPS_MKDIR_IDMAP, 1,
95			    [iops->mkdir() takes struct mnt_idmap*])
96		],[
97			AC_MSG_RESULT(no)
98
99			dnl #
100			dnl # 5.12 API change
101			dnl # The struct user_namespace arg was added as the first argument to
102			dnl # mkdir() of the iops structure.
103			dnl #
104			AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
105			ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
106				AC_MSG_RESULT(yes)
107				AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
108				    [iops->mkdir() takes struct user_namespace*])
109			],[
110				AC_MSG_RESULT(no)
111			])
112		])
113	])
114])
115