aboutsummaryrefslogtreecommitdiff
path: root/config/kernel-setattr-prepare.m4
blob: 24245aa534484329de25407072bfae3e3ab1e9ce (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
AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [
	dnl #
	dnl # 4.9 API change
	dnl # The inode_change_ok() function has been renamed setattr_prepare()
	dnl # and updated to take a dentry rather than an inode.
	dnl #
	ZFS_LINUX_TEST_SRC([setattr_prepare], [
		#include <linux/fs.h>
	], [
		struct dentry *dentry = NULL;
		struct iattr *attr = NULL;
		int error __attribute__ ((unused)) =
			setattr_prepare(dentry, attr);
	])

	dnl #
	dnl # 5.12 API change
	dnl # The setattr_prepare() function has been changed to accept a new argument
	dnl # for struct user_namespace*
	dnl #
	ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [
		#include <linux/fs.h>
	], [
		struct dentry *dentry = NULL;
		struct iattr *attr = NULL;
		struct user_namespace *userns = NULL;
		int error __attribute__ ((unused)) =
			setattr_prepare(userns, dentry, attr);
	])
])

AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
	AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*])
	ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns],
	    [setattr_prepare], [fs/attr.c], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1,
		    [setattr_prepare() accepts user_namespace])
	], [
		AC_MSG_RESULT(no)

		AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace])
		ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
			[setattr_prepare], [fs/attr.c], [
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1,
				[setattr_prepare() is available, doesn't accept user_namespace])
		], [
			AC_MSG_RESULT(no)
		])
	])
])