xref: /freebsd/sys/contrib/openzfs/config/kernel-tmpfile.m4 (revision ec965063070e5753c166cf592c9336444b74720a)
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.1 API change
8	dnl # use struct file instead of struct dentry
9	dnl #
10	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
11		#include <linux/fs.h>
12		int tmpfile(struct user_namespace *userns,
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 #
21	dnl # 5.11 API change
22	dnl # add support for userns parameter to tmpfile
23	dnl #
24	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry_userns], [
25		#include <linux/fs.h>
26		int tmpfile(struct user_namespace *userns,
27		    struct inode *inode, struct dentry *dentry,
28		    umode_t mode) { return 0; }
29		static struct inode_operations
30		    iops __attribute__ ((unused)) = {
31			.tmpfile = tmpfile,
32		};
33	],[])
34	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry], [
35			#include <linux/fs.h>
36			int tmpfile(struct inode *inode, struct dentry *dentry,
37			    umode_t mode) { return 0; }
38			static struct inode_operations
39			    iops __attribute__ ((unused)) = {
40				.tmpfile = tmpfile,
41			};
42	],[])
43])
44
45AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
46	AC_MSG_CHECKING([whether i_op->tmpfile() exists])
47	ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
48		AC_MSG_RESULT(yes)
49		AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
50		AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
51	],[
52		ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry_userns], [
53			AC_MSG_RESULT(yes)
54			AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
55			AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
56			AC_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
57		],[
58			ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry], [
59				AC_MSG_RESULT(yes)
60				AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
61				AC_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
62			],[
63				ZFS_LINUX_REQUIRE_API([i_op->tmpfile()], [3.11])
64			])
65		])
66	])
67])
68