xref: /freebsd/sys/contrib/openzfs/config/kernel-mkdir.m4 (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1dnl #
2dnl # Supported mkdir() interfaces checked newest to oldest.
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
5	dnl #
6	dnl # 5.12 API change
7	dnl # The struct user_namespace arg was added as the first argument to
8	dnl # mkdir()
9	dnl #
10	ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [
11		#include <linux/fs.h>
12
13		int mkdir(struct user_namespace *userns,
14			struct inode *inode, struct dentry *dentry,
15		    umode_t umode) { return 0; }
16
17		static const struct inode_operations
18		    iops __attribute__ ((unused)) = {
19			.mkdir = mkdir,
20		};
21	],[])
22
23	dnl #
24	dnl # 3.3 API change
25	dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
26	dnl # umode_t type rather than an int.  The expectation is that any backport
27	dnl # would also change all three prototypes.  However, if it turns out that
28	dnl # some distribution doesn't backport the whole thing this could be
29	dnl # broken apart into three separate checks.
30	dnl #
31	ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
32		#include <linux/fs.h>
33
34		int mkdir(struct inode *inode, struct dentry *dentry,
35		    umode_t umode) { return 0; }
36
37		static const struct inode_operations
38		    iops __attribute__ ((unused)) = {
39			.mkdir = mkdir,
40		};
41	],[])
42])
43
44AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [
45	dnl #
46	dnl # 5.12 API change
47	dnl # The struct user_namespace arg was added as the first argument to
48	dnl # mkdir() of the iops structure.
49	dnl #
50	AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
51	ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
52		AC_MSG_RESULT(yes)
53		AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
54		    [iops->mkdir() takes struct user_namespace*])
55	],[
56		AC_MSG_RESULT(no)
57
58		AC_MSG_CHECKING([whether iops->mkdir() takes umode_t])
59		ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
60			AC_MSG_RESULT(yes)
61			AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
62			    [iops->mkdir() takes umode_t])
63		],[
64			ZFS_LINUX_TEST_ERROR([mkdir()])
65		])
66	])
67])
68