xref: /freebsd/sys/contrib/openzfs/config/kernel-tmpfile.m4 (revision 19261079b74319502c6ffa1249920079f0f69a72)
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 # 5.11 API change
8	dnl # add support for userns parameter to tmpfile
9	dnl #
10	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_userns], [
11		#include <linux/fs.h>
12		int tmpfile(struct user_namespace *userns,
13		    struct inode *inode, struct dentry *dentry,
14		    umode_t mode) { return 0; }
15		static struct inode_operations
16		    iops __attribute__ ((unused)) = {
17			.tmpfile = tmpfile,
18		};
19	],[])
20	ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
21			#include <linux/fs.h>
22			int tmpfile(struct inode *inode, struct dentry *dentry,
23			    umode_t mode) { return 0; }
24			static struct inode_operations
25			    iops __attribute__ ((unused)) = {
26				.tmpfile = tmpfile,
27			};
28	],[])
29])
30
31AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
32	AC_MSG_CHECKING([whether i_op->tmpfile() exists])
33	ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_userns], [
34		AC_MSG_RESULT(yes)
35		AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
36		AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
37	],[
38		ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
39			AC_MSG_RESULT(yes)
40			AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
41		],[
42			AC_MSG_RESULT(no)
43		])
44	])
45])
46