xref: /freebsd/sys/contrib/openzfs/config/kernel-inode-create.m4 (revision 96190b4fef3b4a0cc3ca0606b0c4e3e69a5e6717)
1AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
2	dnl #
3	dnl # 6.3 API change
4	dnl # The first arg is changed to struct mnt_idmap *
5	dnl #
6	ZFS_LINUX_TEST_SRC([create_mnt_idmap], [
7		#include <linux/fs.h>
8		#include <linux/sched.h>
9
10		static int inode_create(struct mnt_idmap *idmap,
11		    struct inode *inode ,struct dentry *dentry,
12		    umode_t umode, bool flag) { return 0; }
13
14		static const struct inode_operations
15			iops __attribute__ ((unused)) = {
16			.create         = inode_create,
17		};
18	],[])
19
20	dnl #
21	dnl # 5.12 API change that added the struct user_namespace* arg
22	dnl # to the front of this function type's arg list.
23	dnl #
24	ZFS_LINUX_TEST_SRC([create_userns], [
25		#include <linux/fs.h>
26		#include <linux/sched.h>
27
28		static int inode_create(struct user_namespace *userns,
29		    struct inode *inode ,struct dentry *dentry,
30		    umode_t umode, bool flag) { return 0; }
31
32		static const struct inode_operations
33			iops __attribute__ ((unused)) = {
34			.create		= inode_create,
35		};
36	],[])
37
38	dnl #
39	dnl # 3.6 API change
40	dnl #
41	ZFS_LINUX_TEST_SRC([create_flags], [
42		#include <linux/fs.h>
43		#include <linux/sched.h>
44
45		static int inode_create(struct inode *inode ,struct dentry *dentry,
46		    umode_t umode, bool flag) { return 0; }
47
48		static const struct inode_operations
49		    iops __attribute__ ((unused)) = {
50			.create		= inode_create,
51		};
52	],[])
53])
54
55AC_DEFUN([ZFS_AC_KERNEL_CREATE], [
56	AC_MSG_CHECKING([whether iops->create() takes struct mnt_idmap*])
57	ZFS_LINUX_TEST_RESULT([create_mnt_idmap], [
58		AC_MSG_RESULT(yes)
59		AC_DEFINE(HAVE_IOPS_CREATE_IDMAP, 1,
60		   [iops->create() takes struct mnt_idmap*])
61	],[
62		AC_MSG_RESULT(no)
63
64		AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*])
65		ZFS_LINUX_TEST_RESULT([create_userns], [
66			AC_MSG_RESULT(yes)
67			AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1,
68			   [iops->create() takes struct user_namespace*])
69		],[
70			AC_MSG_RESULT(no)
71
72			AC_MSG_CHECKING([whether iops->create() passes flags])
73			ZFS_LINUX_TEST_RESULT([create_flags], [
74				AC_MSG_RESULT(yes)
75			],[
76				ZFS_LINUX_TEST_ERROR([iops->create()])
77			])
78		])
79	])
80])
81