597730f5f465d88ed5263335ae87d6202288cf67
[openafs.git] / src / cf / linux-kernel-func.m4
1 AC_DEFUN([OPENAFS_LINUX_KERNEL_FUNC_CHECKS],[
2 dnl Function existence checks
3 AC_CHECK_LINUX_FUNC([__vfs_write],
4                     [#include <linux/fs.h>],
5                     [__vfs_write(NULL, NULL, 0, NULL);])
6 AC_CHECK_LINUX_FUNC([kernel_write],
7                     [#include <linux/fs.h>],
8                     [kernel_write(NULL, NULL, 0, NULL);])
9 AC_CHECK_LINUX_FUNC([bdi_init],
10                     [#include <linux/backing-dev.h>],
11                     [bdi_init(NULL);])
12 AC_CHECK_LINUX_FUNC([super_setup_bdi],
13                     [#include <linux/backing-dev.h>],
14                     [struct super_block *sb;
15                      super_setup_bdi(sb);])
16 AC_CHECK_LINUX_FUNC([PageChecked],
17                     [#include <linux/mm.h>
18                      #include <linux/page-flags.h>],
19                     [struct page *_page;
20                      int bchecked = PageChecked(_page);])
21 AC_CHECK_LINUX_FUNC([PageFsMisc],
22                     [#include <linux/mm.h>
23                      #include <linux/page-flags.h>],
24                     [struct page *_page;
25                      int bchecked = PageFsMisc(_page);])
26 AC_CHECK_LINUX_FUNC([clear_inode],
27                     [#include <linux/fs.h>],
28                     [clear_inode(NULL);])
29 AC_CHECK_LINUX_FUNC([current_kernel_time],
30                     [#include <linux/time.h>],
31                     [struct timespec s;
32                      s = current_kernel_time();])
33 AC_CHECK_LINUX_FUNC([d_alloc_anon],
34                     [#include <linux/fs.h>],
35                     [d_alloc_anon(NULL);])
36 AC_CHECK_LINUX_FUNC([d_count],
37                     [#include <linux/dcache.h>],
38                     [d_count(NULL);])
39 AC_CHECK_LINUX_FUNC([d_make_root],
40                     [#include <linux/fs.h>],
41                     [d_make_root(NULL);])
42 AC_CHECK_LINUX_FUNC([do_sync_read],
43                     [#include <linux/fs.h>],
44                     [do_sync_read(NULL, NULL, 0, NULL);])
45 AC_CHECK_LINUX_FUNC([fatal_signal_pending],
46                     [#include <linux/sched.h>],
47                     [fatal_signal_pending(NULL);])
48 AC_CHECK_LINUX_FUNC([file_dentry],
49                     [#include <linux/fs.h>],
50                     [struct file *f; file_dentry(f);])
51 AC_CHECK_LINUX_FUNC([find_task_by_pid],
52                     [#include <linux/sched.h>],
53                     [pid_t p; find_task_by_pid(p);])
54 AC_CHECK_LINUX_FUNC([generic_file_aio_read],
55                     [#include <linux/fs.h>],
56                     [generic_file_aio_read(NULL,NULL,0,0);])
57 AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin],
58                     [#include <linux/pagemap.h>],
59                     [grab_cache_page_write_begin(NULL, 0, 0);])
60 AC_CHECK_LINUX_FUNC([hlist_unhashed],
61                     [#include <linux/list.h>],
62                     [hlist_unhashed(0);])
63 AC_CHECK_LINUX_FUNC([ihold],
64                     [#include <linux/fs.h>],
65                     [ihold(NULL);])
66 AC_CHECK_LINUX_FUNC([i_size_read],
67                     [#include <linux/fs.h>],
68                     [i_size_read(NULL);])
69 AC_CHECK_LINUX_FUNC([inode_setattr],
70                     [#include <linux/fs.h>],
71                     [inode_setattr(NULL, NULL);])
72 AC_CHECK_LINUX_FUNC([iter_file_splice_write],
73                     [#include <linux/fs.h>],
74                     [iter_file_splice_write(NULL,NULL,NULL,0,0);])
75 AC_CHECK_LINUX_FUNC([kernel_setsockopt],
76                     [#include <linux/net.h>],
77                     [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
78 AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64],
79                     [#include <linux/ktime.h>],
80                     [struct timespec64 *s;
81                     ktime_get_coarse_real_ts64(s);])
82 AC_CHECK_LINUX_FUNC([ktime_get_real_ts64],
83                     [#include <linux/ktime.h>],
84                     [struct timespec64 *s;
85                     ktime_get_real_ts64(s);])
86 AC_CHECK_LINUX_FUNC([locks_lock_file_wait],
87                     [#include <linux/fs.h>],
88                     [locks_lock_file_wait(NULL, NULL);])
89 AC_CHECK_LINUX_FUNC([page_follow_link],
90                     [#include <linux/fs.h>],
91                     [page_follow_link(0,0);])
92 AC_CHECK_LINUX_FUNC([page_get_link],
93                     [#include <linux/fs.h>],
94                     [page_get_link(0,0,0);])
95 AC_CHECK_LINUX_FUNC([page_offset],
96                     [#include <linux/pagemap.h>],
97                     [page_offset(NULL);])
98 AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
99                     [#include <linux/pagevec.h>],
100                     [__pagevec_lru_add_file(NULL);])
101 AC_CHECK_LINUX_FUNC([path_lookup],
102                     [#include <linux/fs.h>
103                      #include <linux/namei.h>],
104                     [path_lookup(NULL, 0, NULL);])
105 AC_CHECK_LINUX_FUNC([proc_create],
106                     [#include <linux/proc_fs.h>],
107                     [proc_create(NULL, 0, NULL, NULL);])
108 AC_CHECK_LINUX_FUNC([rcu_read_lock],
109                     [#include <linux/rcupdate.h>],
110                     [rcu_read_lock();])
111 AC_CHECK_LINUX_FUNC([set_nlink],
112                     [#include <linux/fs.h>],
113                     [set_nlink(NULL, 1);])
114 AC_CHECK_LINUX_FUNC([setattr_prepare],
115                     [#include <linux/fs.h>],
116                     [setattr_prepare(NULL, NULL);])
117 AC_CHECK_LINUX_FUNC([sock_create_kern],
118                     [#include <linux/net.h>],
119                     [sock_create_kern(0, 0, 0, NULL);])
120 AC_CHECK_LINUX_FUNC([sock_create_kern_ns],
121                     [#include <linux/net.h>],
122                     [sock_create_kern(NULL, 0, 0, 0, NULL);])
123 AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
124                     [#include <linux/splice.h>],
125                     [splice_direct_to_actor(NULL,NULL,NULL);])
126 AC_CHECK_LINUX_FUNC([default_file_splice_read],
127                     [#include <linux/fs.h>],
128                     [default_file_splice_read(NULL,NULL,NULL, 0, 0);])
129 AC_CHECK_LINUX_FUNC([svc_addr_in],
130                     [#include <linux/sunrpc/svc.h>],
131                     [svc_addr_in(NULL);])
132 AC_CHECK_LINUX_FUNC([zero_user_segments],
133                     [#include <linux/highmem.h>],
134                     [zero_user_segments(NULL, 0, 0, 0, 0);])
135 AC_CHECK_LINUX_FUNC([noop_fsync],
136                     [#include <linux/fs.h>],
137                     [void *address = &noop_fsync; printk("%p\n", address)];)
138 AC_CHECK_LINUX_FUNC([kthread_run],
139                     [#include <linux/kernel.h>
140                      #include <linux/kthread.h>],
141                     [kthread_run(NULL, NULL, "test");])
142 AC_CHECK_LINUX_FUNC([inode_nohighmem],
143                     [#include <linux/fs.h>],
144                     [inode_nohighmem(NULL);])
145 AC_CHECK_LINUX_FUNC([inode_lock],
146                     [#include <linux/fs.h>],
147                     [inode_lock(NULL);])
148
149 dnl Consequences - things which get set as a result of the
150 dnl                above tests
151 AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
152     [AC_DEFINE([AFS_NONFSTRANS], 1,
153         [define to disable the nfs translator])])
154 ])