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