xref: /freebsd/sys/contrib/openzfs/config/kernel-tmpfile.m4 (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1dnl #
2dnl # 3.11 API change
3dnl # Add support for i_op->tmpfile
4dnl #
5AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
6	dnl #
7	dnl # 6.3 API change
8	dnl # The first arg is now struct mnt_idmap *
9	dnl #
10	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_mnt_idmap], [
11		#include <linux/fs.h>
12		int tmpfile(struct mnt_idmap *idmap,
13		    struct inode *inode, struct file *file,
14		    umode_t mode) { return 0; }
15		static struct inode_operations
16		    iops __attribute__ ((unused)) = {
17			.tmpfile = tmpfile,
18		};
19	],[])
20	dnl # 6.1 API change
21	dnl # use struct file instead of struct dentry
22	dnl #
23	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
24		#include <linux/fs.h>
25		int tmpfile(struct user_namespace *userns,
26		    struct inode *inode, struct file *file,
27		    umode_t mode) { return 0; }
28		static struct inode_operations
29		    iops __attribute__ ((unused)) = {
30			.tmpfile = tmpfile,
31		};
32	],[])
33	dnl #
34	dnl # 5.11 API change
35	dnl # add support for userns parameter to tmpfile
36	dnl #
37	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry_userns], [
38		#include <linux/fs.h>
39		int tmpfile(struct user_namespace *userns,
40		    struct inode *inode, struct dentry *dentry,
41		    umode_t mode) { return 0; }
42		static struct inode_operations
43		    iops __attribute__ ((unused)) = {
44			.tmpfile = tmpfile,
45		};
46	],[])
47	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry], [
48			#include <linux/fs.h>
49			int tmpfile(struct inode *inode, struct dentry *dentry,
50			    umode_t mode) { return 0; }
51			static struct inode_operations
52			    iops __attribute__ ((unused)) = {
53				.tmpfile = tmpfile,
54			};
55	],[])
56])
57
58AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
59	AC_MSG_CHECKING([whether i_op->tmpfile() exists])
60	ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_mnt_idmap], [
61		AC_MSG_RESULT(yes)
62		AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
63		AC_DEFINE(HAVE_TMPFILE_IDMAP, 1, [i_op->tmpfile() has mnt_idmap])
64	], [
65		ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
66			AC_MSG_RESULT(yes)
67			AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
68			AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
69		],[
70			ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry_userns], [
71				AC_MSG_RESULT(yes)
72				AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
73				AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
74				AC_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
75			],[
76				ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry], [
77					AC_MSG_RESULT(yes)
78					AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
79					AC_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
80				],[
81					ZFS_LINUX_REQUIRE_API([i_op->tmpfile()], [3.11])
82				])
83			])
84		])
85	])
86])
87