aboutsummaryrefslogtreecommitdiff
path: root/config/kernel-inode-getattr.m4
blob: f62e82f5230a307b0fac3c7e8564b1255756be41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
	dnl #
	dnl # Linux 5.12 API
	dnl # The getattr I/O operations handler type was extended to require
	dnl # a struct user_namespace* as its first arg, to support idmapped
	dnl # mounts.
	dnl #
	ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
		#include <linux/fs.h>

		int test_getattr(
			struct user_namespace *userns,
		    const struct path *p, struct kstat *k,
		    u32 request_mask, unsigned int query_flags)
		    { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.getattr = test_getattr,
		};
	],[])

	dnl #
	dnl # Linux 4.11 API
	dnl # See torvalds/linux@a528d35
	dnl #
	ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
		#include <linux/fs.h>

		int test_getattr(
		    const struct path *p, struct kstat *k,
		    u32 request_mask, unsigned int query_flags)
		    { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.getattr = test_getattr,
		};
	],[])

	ZFS_LINUX_TEST_SRC([inode_operations_getattr_vfsmount], [
		#include <linux/fs.h>

		int test_getattr(
		    struct vfsmount *mnt, struct dentry *d,
		    struct kstat *k)
		    { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.getattr = test_getattr,
		};
	],[])
])

AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
	dnl #
	dnl # Kernel 5.12 test
	dnl #
	AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
	ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
		    [iops->getattr() takes struct user_namespace*])
	],[
		AC_MSG_RESULT(no)

		dnl #
		dnl # Kernel 4.11 test
		dnl #
		AC_MSG_CHECKING([whether iops->getattr() takes a path])
		ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
				[iops->getattr() takes a path])
		],[
			AC_MSG_RESULT(no)

			dnl #
			dnl # Kernel < 4.11 test
			dnl #
			AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
			ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
				AC_MSG_RESULT(yes)
				AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
					[iops->getattr() takes a vfsmount])
			],[
				AC_MSG_RESULT(no)
			])
		])
	])
])