xref: /freebsd/sys/contrib/openzfs/config/kernel-inode-times.m4 (revision 87b759f0fa1f7554d50ce640c40138512bbded44)
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 # 6.6 API change
19	dnl # i_ctime no longer directly accessible, must use
20	dnl # inode_get_ctime(ip), inode_set_ctime*(ip) to
21	dnl # read/write.
22	dnl #
23	ZFS_LINUX_TEST_SRC([inode_get_ctime], [
24		#include <linux/fs.h>
25	],[
26		struct inode ip;
27
28		memset(&ip, 0, sizeof(ip));
29		inode_get_ctime(&ip);
30	])
31
32	ZFS_LINUX_TEST_SRC([inode_set_ctime_to_ts], [
33		#include <linux/fs.h>
34	],[
35		struct inode ip;
36		struct timespec64 ts = {0};
37
38		memset(&ip, 0, sizeof(ip));
39		inode_set_ctime_to_ts(&ip, ts);
40	])
41
42	dnl #
43	dnl # 6.7 API change
44	dnl # i_atime/i_mtime no longer directly accessible, must use
45	dnl # inode_get_mtime(ip), inode_set_mtime*(ip) to
46	dnl # read/write.
47	dnl #
48	ZFS_LINUX_TEST_SRC([inode_get_atime], [
49		#include <linux/fs.h>
50	],[
51		struct inode ip;
52
53		memset(&ip, 0, sizeof(ip));
54		inode_get_atime(&ip);
55	])
56	ZFS_LINUX_TEST_SRC([inode_get_mtime], [
57		#include <linux/fs.h>
58	],[
59		struct inode ip;
60
61		memset(&ip, 0, sizeof(ip));
62		inode_get_mtime(&ip);
63	])
64
65	ZFS_LINUX_TEST_SRC([inode_set_atime_to_ts], [
66		#include <linux/fs.h>
67	],[
68		struct inode ip;
69		struct timespec64 ts = {0};
70
71		memset(&ip, 0, sizeof(ip));
72		inode_set_atime_to_ts(&ip, ts);
73	])
74	ZFS_LINUX_TEST_SRC([inode_set_mtime_to_ts], [
75		#include <linux/fs.h>
76	],[
77		struct inode ip;
78		struct timespec64 ts = {0};
79
80		memset(&ip, 0, sizeof(ip));
81		inode_set_mtime_to_ts(&ip, ts);
82	])
83])
84
85AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
86	AC_MSG_CHECKING([whether timestamp_truncate() exists])
87	ZFS_LINUX_TEST_RESULT([timestamp_truncate], [
88		AC_MSG_RESULT(yes)
89		AC_DEFINE(HAVE_INODE_TIMESTAMP_TRUNCATE, 1,
90		    [timestamp_truncate() exists])
91	],[
92		AC_MSG_RESULT(no)
93	])
94
95	AC_MSG_CHECKING([whether inode_get_ctime() exists])
96	ZFS_LINUX_TEST_RESULT([inode_get_ctime], [
97		AC_MSG_RESULT(yes)
98		AC_DEFINE(HAVE_INODE_GET_CTIME, 1,
99		    [inode_get_ctime() exists in linux/fs.h])
100	],[
101		AC_MSG_RESULT(no)
102	])
103
104	AC_MSG_CHECKING([whether inode_set_ctime_to_ts() exists])
105	ZFS_LINUX_TEST_RESULT([inode_set_ctime_to_ts], [
106		AC_MSG_RESULT(yes)
107		AC_DEFINE(HAVE_INODE_SET_CTIME_TO_TS, 1,
108		    [inode_set_ctime_to_ts() exists in linux/fs.h])
109	],[
110		AC_MSG_RESULT(no)
111	])
112
113	AC_MSG_CHECKING([whether inode_get_atime() exists])
114	ZFS_LINUX_TEST_RESULT([inode_get_atime], [
115		AC_MSG_RESULT(yes)
116		AC_DEFINE(HAVE_INODE_GET_ATIME, 1,
117		    [inode_get_atime() exists in linux/fs.h])
118	],[
119		AC_MSG_RESULT(no)
120	])
121
122	AC_MSG_CHECKING([whether inode_set_atime_to_ts() exists])
123	ZFS_LINUX_TEST_RESULT([inode_set_atime_to_ts], [
124		AC_MSG_RESULT(yes)
125		AC_DEFINE(HAVE_INODE_SET_ATIME_TO_TS, 1,
126		    [inode_set_atime_to_ts() exists in linux/fs.h])
127	],[
128		AC_MSG_RESULT(no)
129	])
130
131	AC_MSG_CHECKING([whether inode_get_mtime() exists])
132	ZFS_LINUX_TEST_RESULT([inode_get_mtime], [
133		AC_MSG_RESULT(yes)
134		AC_DEFINE(HAVE_INODE_GET_MTIME, 1,
135		    [inode_get_mtime() exists in linux/fs.h])
136	],[
137		AC_MSG_RESULT(no)
138	])
139
140	AC_MSG_CHECKING([whether inode_set_mtime_to_ts() exists])
141	ZFS_LINUX_TEST_RESULT([inode_set_mtime_to_ts], [
142		AC_MSG_RESULT(yes)
143		AC_DEFINE(HAVE_INODE_SET_MTIME_TO_TS, 1,
144		    [inode_set_mtime_to_ts() exists in linux/fs.h])
145	],[
146		AC_MSG_RESULT(no)
147	])
148])
149