xref: /freebsd/sys/contrib/openzfs/config/kernel-inode-times.m4 (revision 608da65de9552d5678c1000776ed69da04a45983)
1AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
2
3	dnl #
4	dnl # 5.6 API change
5	dnl # timespec64_trunc() replaced by timestamp_truncate() interface.
6	dnl #
7	ZFS_LINUX_TEST_SRC([timestamp_truncate], [
8		#include <linux/fs.h>
9	],[
10		struct timespec64 ts;
11		struct inode ip;
12
13		memset(&ts, 0, sizeof(ts));
14		ts = timestamp_truncate(ts, &ip);
15	])
16
17	dnl #
18	dnl # 4.18 API change
19	dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
20	dnl #
21	ZFS_LINUX_TEST_SRC([inode_times], [
22		#include <linux/fs.h>
23	],[
24		struct inode ip;
25		struct timespec ts;
26
27		memset(&ip, 0, sizeof(ip));
28		ts = ip.i_mtime;
29	])
30
31	dnl #
32	dnl # 6.6 API change
33	dnl # i_ctime no longer directly accessible, must use
34	dnl # inode_get_ctime(ip), inode_set_ctime*(ip) to
35	dnl # read/write.
36	dnl #
37	ZFS_LINUX_TEST_SRC([inode_get_ctime], [
38		#include <linux/fs.h>
39	],[
40		struct inode ip;
41
42		memset(&ip, 0, sizeof(ip));
43		inode_get_ctime(&ip);
44	])
45
46	ZFS_LINUX_TEST_SRC([inode_set_ctime_to_ts], [
47		#include <linux/fs.h>
48	],[
49		struct inode ip;
50		struct timespec64 ts;
51
52		memset(&ip, 0, sizeof(ip));
53		inode_set_ctime_to_ts(&ip, ts);
54	])
55])
56
57AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
58	AC_MSG_CHECKING([whether timestamp_truncate() exists])
59	ZFS_LINUX_TEST_RESULT([timestamp_truncate], [
60		AC_MSG_RESULT(yes)
61		AC_DEFINE(HAVE_INODE_TIMESTAMP_TRUNCATE, 1,
62		    [timestamp_truncate() exists])
63	],[
64		AC_MSG_RESULT(no)
65	])
66
67	AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
68	ZFS_LINUX_TEST_RESULT([inode_times], [
69		AC_MSG_RESULT(no)
70	],[
71		AC_MSG_RESULT(yes)
72		AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
73		    [inode->i_*time's are timespec64])
74	])
75
76	AC_MSG_CHECKING([whether inode_get_ctime() exists])
77	ZFS_LINUX_TEST_RESULT([inode_get_ctime], [
78		AC_MSG_RESULT(yes)
79		AC_DEFINE(HAVE_INODE_GET_CTIME, 1,
80		    [inode_get_ctime() exists in linux/fs.h])
81	],[
82		AC_MSG_RESULT(no)
83	])
84
85	AC_MSG_CHECKING([whether inode_set_ctime_to_ts() exists])
86	ZFS_LINUX_TEST_RESULT([inode_set_ctime_to_ts], [
87		AC_MSG_RESULT(yes)
88		AC_DEFINE(HAVE_INODE_SET_CTIME_TO_TS, 1,
89		    [inode_set_ctime_to_ts() exists in linux/fs.h])
90	],[
91		AC_MSG_RESULT(no)
92	])
93])
94