aboutsummaryrefslogtreecommitdiffstats
path: root/config/kernel-inode-times.m4
blob: 412e13b47df588e79f9f0afcd7d3d57fe4ce1c08 (plain)
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
93
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [

	dnl #
	dnl # 5.6 API change
	dnl # timespec64_trunc() replaced by timestamp_truncate() interface.
	dnl #
	ZFS_LINUX_TEST_SRC([timestamp_truncate], [
		#include <linux/fs.h>
	],[
		struct timespec64 ts;
		struct inode ip;

		memset(&ts, 0, sizeof(ts));
		ts = timestamp_truncate(ts, &ip);
	])

	dnl #
	dnl # 4.18 API change
	dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
	dnl #
	ZFS_LINUX_TEST_SRC([inode_times], [
		#include <linux/fs.h>
	],[
		struct inode ip;
		struct timespec ts;

		memset(&ip, 0, sizeof(ip));
		ts = ip.i_mtime;
	])

	dnl #
	dnl # 6.6 API change
	dnl # i_ctime no longer directly accessible, must use
	dnl # inode_get_ctime(ip), inode_set_ctime*(ip) to
	dnl # read/write.
	dnl #
	ZFS_LINUX_TEST_SRC([inode_get_ctime], [
		#include <linux/fs.h>
	],[
		struct inode ip;

		memset(&ip, 0, sizeof(ip));
		inode_get_ctime(&ip);
	])

	ZFS_LINUX_TEST_SRC([inode_set_ctime_to_ts], [
		#include <linux/fs.h>
	],[
		struct inode ip;
		struct timespec64 ts;

		memset(&ip, 0, sizeof(ip));
		inode_set_ctime_to_ts(&ip, ts);
	])
])

AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
	AC_MSG_CHECKING([whether timestamp_truncate() exists])
	ZFS_LINUX_TEST_RESULT([timestamp_truncate], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_INODE_TIMESTAMP_TRUNCATE, 1,
		    [timestamp_truncate() exists])
	],[
		AC_MSG_RESULT(no)
	])

	AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
	ZFS_LINUX_TEST_RESULT([inode_times], [
		AC_MSG_RESULT(no)
	],[
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
		    [inode->i_*time's are timespec64])
	])

	AC_MSG_CHECKING([whether inode_get_ctime() exists])
	ZFS_LINUX_TEST_RESULT([inode_get_ctime], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_INODE_GET_CTIME, 1,
		    [inode_get_ctime() exists in linux/fs.h])
	],[
		AC_MSG_RESULT(no)
	])

	AC_MSG_CHECKING([whether inode_set_ctime_to_ts() exists])
	ZFS_LINUX_TEST_RESULT([inode_set_ctime_to_ts], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_INODE_SET_CTIME_TO_TS, 1,
		    [inode_set_ctime_to_ts() exists in linux/fs.h])
	],[
		AC_MSG_RESULT(no)
	])
])