xref: /freebsd/sys/contrib/openzfs/config/kernel-symlink.m4 (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
2	dnl #
3	dnl # 6.3 API change that changed the first arg
4	dnl # to struct mnt_idmap*
5	dnl #
6	ZFS_LINUX_TEST_SRC([symlink_mnt_idmap], [
7		#include <linux/fs.h>
8		#include <linux/sched.h>
9		int tmp_symlink(struct mnt_idmap *idmap,
10		    struct inode *inode ,struct dentry *dentry,
11		    const char *path) { return 0; }
12
13		static const struct inode_operations
14			iops __attribute__ ((unused)) = {
15			.symlink                = tmp_symlink,
16		};
17	],[])
18	dnl #
19	dnl # 5.12 API change that added the struct user_namespace* arg
20	dnl # to the front of this function type's arg list.
21	dnl #
22	ZFS_LINUX_TEST_SRC([symlink_userns], [
23		#include <linux/fs.h>
24		#include <linux/sched.h>
25
26		int tmp_symlink(struct user_namespace *userns,
27		    struct inode *inode ,struct dentry *dentry,
28		    const char *path) { return 0; }
29
30		static const struct inode_operations
31			iops __attribute__ ((unused)) = {
32			.symlink		= tmp_symlink,
33		};
34	],[])
35])
36
37AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [
38	AC_MSG_CHECKING([whether iops->symlink() takes struct mnt_idmap*])
39	ZFS_LINUX_TEST_RESULT([symlink_mnt_idmap], [
40		AC_MSG_RESULT(yes)
41		AC_DEFINE(HAVE_IOPS_SYMLINK_IDMAP, 1,
42		    [iops->symlink() takes struct mnt_idmap*])
43	],[
44		AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*])
45		ZFS_LINUX_TEST_RESULT([symlink_userns], [
46			AC_MSG_RESULT(yes)
47			AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1,
48			    [iops->symlink() takes struct user_namespace*])
49		],[
50			AC_MSG_RESULT(no)
51		])
52	])
53])
54