ed759e1ee88c23cf0a27f68f202b89251c21145c
[openafs.git] / src / cf / linux-test4.m4
1
2 AC_DEFUN([LINUX_AIO_NONVECTOR],
3  [AC_CHECK_LINUX_BUILD([for non-vectorized aio kernel functions],
4                        [ac_cv_linux_aio_nonvector],
5                        [#include <linux/fs.h>],
6                        [extern ssize_t
7                         generic_file_aio_read(struct kiocb *, char __user *,
8                                               size_t, loff_t);],
9                        [LINUX_HAS_NONVECTOR_AIO],
10                        [define if kernel functions like generic_file_aio_read use
11                         non-vectorized i/o],
12                        [])
13  ])
14
15 AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
16   AC_CHECK_LINUX_BUILD([for exported tasklist_lock],
17                        [ac_cv_linux_exports_tasklist_lock],
18 [#include <linux/sched.h>],
19 [
20 extern rwlock_t tasklist_lock __attribute__((weak)); 
21 read_lock(&tasklist_lock);
22 ],
23                        [EXPORTED_TASKLIST_LOCK],
24                        [define if tasklist_lock exported],
25                        [])
26 ])
27
28
29 AC_DEFUN([LINUX_EXPORTS_INIT_MM], [
30   AC_CHECK_LINUX_BUILD([for exported init_mm],
31                        [ac_cv_linux_exports_init_mm],
32                        [extern struct mm_struct init_mm;],
33                        [void *address = &init_mm; printk("%p\n", address);],
34                        [EXPORTED_INIT_MM],
35                        [define if your kernel exports init_mm],
36                        [])
37   ])
38
39
40 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_ADDRESS], [
41   AC_CHECK_LINUX_BUILD([for exported kallsyms_address_to_symbol],
42                        [ac_cv_linux_exports_kallsyms_address],
43                        [#include <linux/modversions.h>],
44 [#ifndef __ver_kallsyms_address_to_symbol
45 #error kallsyms_address_to_symbol not exported
46 #endif],
47                        [EXPORTED_KALLSYMS_ADDRESS],
48                        [define if your linux kernel exports kallsyms address],
49                        [])
50 ])
51
52
53 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_SYMBOL], [
54   AC_CHECK_LINUX_BUILD([for exported kallsyms_symbol_to_address],
55                        [ac_cv_linux_exports_kallsyms_symbol],
56                        [#include <linux/modversions.h>],
57 [#ifndef __ver_kallsyms_symbol_to_address
58 #error kallsyms_symbol_to_address not exported
59 #endif],
60                        [EXPORTED_KALLSYMS_SYMBOL],
61                        [define if your linux kernel exports kallsyms],
62                        [])
63 ])
64
65
66 AC_DEFUN([LINUX_EXPORTS_SYS_CALL_TABLE], [
67   AC_CHECK_LINUX_BUILD([for exported sys_call_table],
68                        [ac_cv_linux_exports_sys_call_table],
69                        [#include <linux/modversions.h>],
70 [#ifndef __ver_sys_call_table
71 #error sys_call_table not exported
72 #endif],
73                        [EXPORTED_SYS_CALL_TABLE],
74                        [define if your linux kernel exports sys_call_table],
75                        [])
76 ])
77
78
79 AC_DEFUN([LINUX_EXPORTS_IA32_SYS_CALL_TABLE], [
80   AC_CHECK_LINUX_BUILD([for exported ia32_sys_call_table],
81                        [ac_cv_linux_exports_ia32_sys_call_table],
82                        [#include <linux/modversions.h>],
83 [#ifndef __ver_ia32_sys_call_table
84 #error ia32_sys_call_table not exported
85 #endif],
86                        [EXPORTED_IA32_SYS_CALL_TABLE],
87                        [define if your linux kernel exports ia32_sys_call_table],
88                        [])
89 ])
90
91
92 AC_DEFUN([LINUX_EXPORTS_SYS_CHDIR], [
93   AC_CHECK_LINUX_BUILD([for exported sys_chdir],
94                        [ac_cv_linux_exports_sys_chdir],
95                        [extern asmlinkage long sys_chdir(void) __attribute__((weak));],
96                        [void *address = &sys_chdir; printk("%p\n", address);],
97                        [EXPORTED_SYS_CHDIR],
98                        [define if your linux kernel exports sys_chdir],
99                        [])
100 ])
101
102
103 AC_DEFUN([LINUX_EXPORTS_SYS_OPEN], [
104   AC_CHECK_LINUX_BUILD([for exported sys_open],
105                        [ac_cv_linux_exports_sys_open],
106                        [extern asmlinkage long sys_open(void) __attribute__((weak));],
107                        [void *address = &sys_open; printk("%p\n", address);],
108                        [EXPORTED_SYS_OPEN],
109                        [define if your linux kernel exports sys_open],
110                        [])
111 ])
112
113
114 AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE], [
115   AC_CHECK_LINUX_BUILD([for recalc_sigpending arg type],
116                        [ac_cv_linux_func_recalc_sigpending_takes_void],
117 [#include <linux/sched.h>
118 #ifdef HAVE_LINUX_SCHED_SIGNAL_H
119 #include <linux/sched/signal.h>
120 #endif],
121                        [recalc_sigpending();],
122                        [RECALC_SIGPENDING_TAKES_VOID],
123                        [define if your recalc_sigpending takes void],
124                        [])
125 ])
126
127
128 AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
129   AC_CHECK_LINUX_BUILD([for signal->rlim in struct task_struct],
130                        [ac_cv_linux_sched_struct_task_struct_has_signal_rlim],
131 [#include <linux/sched.h>
132 #ifdef HAVE_LINUX_SCHED_SIGNAL_H
133 #include <linux/sched/signal.h>
134 #endif],
135                        [struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);],
136                        [STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM],
137                        [define if your struct task_struct has signal->rlim],
138                        [])
139 ])
140
141
142 AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
143   AC_CHECK_LINUX_BUILD([for 3rd argument in posix_lock_file found in new kernels],
144                        [ac_cv_linux_kernel_posix_lock_file_wait_arg],
145                        [#include <linux/fs.h>],
146                        [posix_lock_file(0,0,0);],
147                        [POSIX_LOCK_FILE_WAIT_ARG],
148                        [define if your kernel uses 3 arguments for posix_lock_file],
149                        [])
150 ])
151
152 AC_DEFUN([LINUX_KERNEL_SOCK_CREATE], [
153   AC_CHECK_LINUX_BUILD([for 5th argument in sock_create found in some SELinux kernels],
154                        [ac_cv_linux_kernel_sock_create_v],
155                        [#include <linux/net.h>],
156                        [sock_create(0,0,0,0,0);],
157                        [LINUX_KERNEL_SOCK_CREATE_V],
158                        [define if your linux kernel uses 5 arguments for sock_create],
159                        [])
160 ])
161
162
163 AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE], [
164   AC_CHECK_LINUX_BUILD([for inode_setattr return type],
165                        [ac_cv_linux_func_inode_setattr_returns_int],
166                        [#include <linux/fs.h>],
167                        [struct inode _inode;
168                         struct iattr _iattr;
169                         int i;
170                         i = inode_setattr(&_inode, &_iattr);],
171                        [INODE_SETATTR_NOT_VOID],
172                        [define if your setattr return return non-void],
173                        [])
174 ])
175
176
177
178 AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [
179   AC_CHECK_LINUX_BUILD([whether aop.writepage takes a writeback_control],
180                        [ac_cv_linux_func_a_writepage_takes_writeback_control],
181 [#include <linux/fs.h>
182 #include <linux/mm.h>
183 #include <linux/writeback.h>],
184 [struct address_space_operations _aops;
185 struct page _page;
186 struct writeback_control _writeback_control;
187 (void)_aops.writepage(&_page, &_writeback_control);],
188                        [AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL],
189                        [define if aops.writepage takes a struct writeback_control],
190                        [])
191 ])
192
193
194 AC_DEFUN([LINUX_REFRIGERATOR], [
195   AC_CHECK_LINUX_BUILD([whether refrigerator takes PF_FREEZE],
196                        [ac_cv_linux_func_refrigerator_takes_pf_freeze],
197 [#include <linux/sched.h>
198 #ifdef HAVE_LINUX_FREEZER_H
199 #include <linux/freezer.h>
200 #endif],
201                        [refrigerator(PF_FREEZE);],
202                        [LINUX_REFRIGERATOR_TAKES_PF_FREEZE],
203                        [define if your refrigerator takes PF_FREEZE],
204                        [])
205 ])
206
207
208 AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_NAMEIDATA], [
209   AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a nameidata],
210                        [ac_cv_linux_func_i_create_takes_nameidata],
211 [#include <linux/fs.h>
212 #include <linux/namei.h>],
213 [struct inode _inode;
214 struct dentry _dentry;
215 struct nameidata _nameidata;
216 (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata);],
217
218                        [IOP_CREATE_TAKES_NAMEIDATA],
219                        [define if your iops.create takes a nameidata argument],
220                        [])
221 ])
222
223
224 AC_DEFUN([LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA], [
225   AC_CHECK_LINUX_BUILD([whether inode_operations.lookup takes a nameidata],
226                        [ac_cv_linux_func_i_lookup_takes_nameidata],
227 [#include <linux/fs.h>
228 #include <linux/namei.h>],
229 [struct inode _inode;
230 struct dentry _dentry;
231 struct nameidata _nameidata;
232 (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata);],
233                        [IOP_LOOKUP_TAKES_NAMEIDATA],
234                        [define if your iops.lookup takes a nameidata argument],
235                        [])
236 ])
237
238
239 AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
240   AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes a nameidata],
241                        [ac_cv_linux_func_i_permission_takes_nameidata],
242 [#include <linux/fs.h>
243 #include <linux/namei.h>],
244 [struct inode _inode;
245 struct nameidata _nameidata;
246 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
247                        [IOP_PERMISSION_TAKES_NAMEIDATA],
248                        [define if your iops.permission takes a nameidata argument],
249                        [-Werror])
250 ])
251
252
253 AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_FLAGS], [
254   AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes flags],
255                         [ac_cv_linux_func_i_permission_takes_flags],
256                         [#include <linux/fs.h>],
257                         [struct inode _inode = {0};
258                         unsigned int flags = 0;
259                         (void)_inode.i_op->permission(&_inode, 0, flags);],
260                        [IOP_PERMISSION_TAKES_FLAGS],
261                        [define if your iops.permission takes a flags argument],
262                        [-Werror])
263 ])
264
265
266 AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [
267   AC_CHECK_LINUX_BUILD([whether inode_operations.put_link takes an opaque cookie],
268                        [ac_cv_linux_func_i_put_link_takes_cookie],
269 [#include <linux/fs.h>
270 #include <linux/namei.h>],
271 [struct inode _inode;
272 struct dentry _dentry;
273 struct nameidata *_nameidata;
274 void *cookie;
275 (void)_inode.i_op->put_link(&_dentry, _nameidata, cookie);],
276                        [IOP_PUT_LINK_TAKES_COOKIE],
277                        [define if your iops.put_link takes a cookie],
278                        [])
279 ])
280
281
282 AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA], [
283   AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes a nameidata],
284                        [ac_cv_linux_func_d_revalidate_takes_nameidata],
285                         [#include <linux/fs.h>
286                         #include <linux/namei.h>
287                         static int reval(struct dentry *d, struct nameidata *nd) { return 0; }
288                         struct dentry_operations dops;],
289                         [dops.d_revalidate = reval;],
290                        [DOP_REVALIDATE_TAKES_NAMEIDATA],
291                        [define if your dops.d_revalidate takes a nameidata argument],
292                        [-Werror])
293 ])
294
295
296 AC_DEFUN([LINUX_GET_SB_HAS_STRUCT_VFSMOUNT], [
297   AC_CHECK_LINUX_BUILD([for struct vfsmount * in get_sb_nodev()],
298                        [ac_cv_linux_get_sb_has_struct_vfsmount],
299                        [#include <linux/fs.h>],
300                        [get_sb_nodev(0,0,0,0,0);],
301                        [GET_SB_HAS_STRUCT_VFSMOUNT],
302                        [define if your get_sb_nodev needs a struct vfsmount argument],
303                        [])
304 ])
305
306
307 AC_DEFUN([LINUX_STATFS_TAKES_DENTRY], [
308   AC_CHECK_LINUX_BUILD([for dentry in statfs],
309                        [ac_cv_linux_statfs_takes_dentry],
310 [#include <linux/fs.h>
311 #include <linux/statfs.h>],
312 [extern int simple_statfs(struct dentry *, struct kstatfs *);],
313                        [STATFS_TAKES_DENTRY],
314                        [define if your statfs takes a dentry argument],
315                        [])
316 ])
317
318
319 AC_DEFUN([LINUX_LINUX_KEYRING_SUPPORT], [
320   AC_CHECK_LINUX_BUILD([for linux kernel keyring support],
321                        [ac_cv_linux_keyring_support],
322 [#include <linux/rwsem.h>
323 #ifdef HAVE_LINUX_KEY_TYPE_H
324 #include <linux/key-type.h>
325 #endif
326 #include <linux/key.h>
327 #include <linux/keyctl.h>],
328 [#ifdef CONFIG_KEYS
329 request_key(NULL, NULL, NULL);
330 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH) || !defined(KEY_POS_SETATTR) 
331 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH or KEY_POS_SETATTR"
332 #endif
333 #else
334 #error rebuild your kernel with CONFIG_KEYS
335 #endif],
336                        [LINUX_KEYRING_SUPPORT],
337                        [define if your kernel has keyring support],
338                        [])
339 ])
340
341
342 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
343   AC_CHECK_LINUX_BUILD([if key_alloc() takes a struct task *],
344                         [ac_cv_key_alloc_needs_struct_task],
345                         [#include <linux/rwsem.h>
346                         #include <linux/key.h> ],
347                         [struct task_struct *t=NULL;
348                         struct key k = {};
349                         (void) key_alloc(NULL, NULL, k.uid, k.gid, t, 0, 0);],
350                         [KEY_ALLOC_NEEDS_STRUCT_TASK],
351                         [define if key_alloc takes a struct task *],
352                         [-Werror -Wno-pointer-arith])
353 ])
354
355
356 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
357   AC_CHECK_LINUX_BUILD([if key_alloc() takes credentials],
358                         [ac_cv_key_alloc_needs_cred],
359                         [#include <linux/rwsem.h>
360                         #include <linux/key.h>],
361                         [struct cred *c = NULL;
362                         struct key k = {};
363                         (void) key_alloc(NULL, NULL, k.uid, k.gid, c, 0, 0);],
364                         [KEY_ALLOC_NEEDS_CRED],
365                         [define if key_alloc takes credentials],
366                         [-Werror -Wno-pointer-arith])
367 ])
368
369
370 AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [
371   AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument],
372                        [ac_cv_linux_init_work_has_data],
373 [#include <linux/kernel.h>
374 #include <linux/workqueue.h>],
375
376 void f(struct work_struct *w) {}
377 struct work_struct *w;
378 int *i;
379 INIT_WORK(w,f,i);],
380                        [INIT_WORK_HAS_DATA],
381                        [define if INIT_WORK takes a data (3rd) argument],
382                        [])
383 ])
384
385
386 AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
387   AC_CHECK_LINUX_BUILD([whether register_sysctl_table has an insert_at_head argument],
388                        [ac_cv_linux_register_sysctl_table_noflag],
389                        [#include <linux/sysctl.h>],
390                        [struct ctl_table *t; register_sysctl_table (t);],
391                        [REGISTER_SYSCTL_TABLE_NOFLAG],
392                        [define if register_sysctl_table has no insert_at head flag],
393                        [])
394 ])
395
396
397 AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [
398   AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t],
399                        [ac_cv_linux_func_f_flush_takes_fl_owner_t],
400                        [#include <linux/fs.h>],
401 [struct inode _inode;
402 struct file _file;
403 fl_owner_t id;
404 (void)_inode.i_fop->flush(&_file, &id);],
405                        [FOP_FLUSH_TAKES_FL_OWNER_T],
406                        [define if your fops.flush takes an fl_owner_t argument],
407                        [])
408 ])
409
410
411 AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
412   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a dentry argument],
413                        [ac_cv_linux_func_f_fsync_takes_dentry],
414                        [#include <linux/fs.h>],
415 [struct inode _inode;
416 struct file _file;
417 struct dentry _d;
418 (void)_inode.i_fop->fsync(&_file, &_d, 0);],
419                        [FOP_FSYNC_TAKES_DENTRY],
420                        [define if your fops.fsync takes an dentry argument],
421                        [])
422 ])
423
424
425 int (*fsync) (struct file *, loff_t start, loff_t end, int datasync);
426
427 AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_RANGE], [
428   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a range],
429                        [ac_cv_linux_func_f_fsync_takes_range],
430                        [#include <linux/fs.h>],
431 [struct inode _inode;
432 struct file _file;
433 loff_t start, end;
434 (void)_inode.i_fop->fsync(&_file, start, end, 0);],
435                        [FOP_FSYNC_TAKES_RANGE],
436                        [define if your fops.fsync takes range arguments],
437                        [])
438 ])
439
440
441 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
442   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
443                        [ac_cv_linux_have_kmem_cache_t],
444                        [#include <linux/slab.h>],
445                        [kmem_cache_t *k;],
446                        [HAVE_KMEM_CACHE_T],
447                        [define if kmem_cache_t exists],
448                        [])
449 ])
450
451
452 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
453   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
454                        [ac_cv_linux_kmem_cache_create_takes_dtor],
455                        [#include <linux/slab.h>],
456                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
457                        [KMEM_CACHE_TAKES_DTOR],
458                        [define if kmem_cache_create takes a destructor argument],
459                        [])
460 ])
461
462
463 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
464   AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer],
465                         [ac_cv_linux_kmem_cache_create_ctor_takes_void],
466                         [#include <linux/slab.h>],
467                         [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
468                         [KMEM_CACHE_CTOR_TAKES_VOID],
469                         [define if kmem_cache_create constructor takes a single void ptr],
470                         [-Werror])
471 ])
472
473
474 dnl This function checks not just the existence of the splice functions,
475 dnl but also that the signature matches (they gained an extra argument
476 dnl around 2.6.17)
477 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
478   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
479                        [ac_cv_linux_fs_struct_fop_has_splice],
480                        [#include <linux/fs.h>],
481                        [struct file_operations _fop;
482                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
483                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
484                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
485                        [define if struct file_operations has splice functions],
486                        [])
487 ])
488
489
490 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
491   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
492                        [ac_cv_linux_kmem_cache_init],
493                        [#include <linux/slab.h>],
494                        [extern struct kmem_cache *
495                         kmem_cache_create(const char *, size_t, size_t,
496                                           unsigned long,
497                                           void (*)(struct kmem_cache *, void *));
498                         return;],
499                        [KMEM_CACHE_INIT],
500                        [define for new kmem_cache init function parameters],
501                        [])
502 ])
503
504
505 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
506   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
507                        [ac_cv_linux_exports_proc_root_fs],
508                        [#include <linux/proc_fs.h>],
509                        [struct proc_dir_entry *p = proc_root_fs;],
510                        [EXPORTED_PROC_ROOT_FS],
511                        [define if proc_root_fs is exported],
512                        [])
513 ])
514
515
516 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
517   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
518                        [ac_cv_linux_d_path_takes_struct_path],
519                        [#include <linux/fs.h>],
520                        [struct path *p; d_path(p, NULL, 0);],
521                        [D_PATH_TAKES_STRUCT_PATH],
522                        [define if d_path() takes a struct path argument],
523                        [])
524 ])
525
526
527 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
528   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
529                        [ac_cv_linux_new_export_ops],
530                        [#include <linux/exportfs.h>],
531                        [struct export_operations _eops;
532                         _eops.fh_to_parent(NULL, NULL, 0, 0);],
533                        [NEW_EXPORT_OPS],
534                        [define if kernel uses new export ops],
535                        [])
536 ])
537
538
539 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
540   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
541                        [ac_cv_linux_posix_test_lock_returns_conflict],
542                        [#include <linux/fs.h>],
543                        [struct file_lock *lock;
544                         struct file * file;
545                         lock = posix_test_lock(file, lock);],
546                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
547                        [define if posix_test_lock returns the conflicting lock],
548                        [])
549 ])
550
551
552 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
553   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
554                        [ac_cv_linux_posix_test_lock_conflict_arg],
555                        [#include <linux/fs.h>],
556                        [struct file_lock *lock;
557                         struct file *file;
558                         posix_test_lock(file, lock, lock);],
559                        [POSIX_TEST_LOCK_CONFLICT_ARG],
560                        [define if posix_test_lock takes a conflict argument],
561                        [])
562 ])
563
564
565 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
566   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
567                        [ac_cv_linux_exports_key_type_keyring],
568 [
569 #ifdef HAVE_LINUX_KEY_TYPE_H
570 #include <linux/key-type.h>
571 #endif
572 #include <linux/key.h>
573 ],
574                        [printk("%s", key_type_keyring.name);],
575                        [EXPORTED_KEY_TYPE_KEYRING],
576                        [define if key_type_keyring is exported],
577                        [])
578 ])
579
580
581 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
582   AC_CHECK_LINUX_BUILD([for try_to_freeze],
583                        [ac_cv_linux_have_try_to_freeze],
584 [#include <linux/sched.h>
585 #ifdef HAVE_LINUX_FREEZER_H
586 #include <linux/freezer.h>
587 #endif],
588 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
589    try_to_freeze(PF_FREEZE);
590 #else
591    try_to_freeze();
592 #endif],
593                        [HAVE_TRY_TO_FREEZE],
594                        [define if your kernel has the try_to_freeze function],
595                        [])
596 ])
597
598
599 AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
600   AC_CHECK_LINUX_BUILD([for dcache_lock],
601                         [ac_cv_linux_have_dcache_lock],
602                         [#include <linux/fs.h> ],
603                         [printk("%p", &dcache_lock);],
604                         [HAVE_DCACHE_LOCK],
605                         [define if dcache_lock exists],
606                         [])
607 ])
608
609
610 AC_DEFUN([LINUX_D_COUNT_IS_INT], [
611   AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
612                         [ac_cv_linux_d_count_int],
613                         [#include <linux/fs.h> ],
614                         [struct dentry _d;
615                         dget(&_d);
616                         _d.d_count = 1;],
617                         [D_COUNT_INT],
618                         [define if dentry->d_count is an int],
619                         [-Werror])
620 ])
621
622
623 AC_DEFUN([LINUX_DOP_D_DELETE_TAKES_CONST], [
624   AC_CHECK_LINUX_BUILD([whether dentry.d_op->d_delete takes a const argument],
625                         [ac_cv_linux_dop_d_delete_takes_const],
626                         [#include <linux/fs.h>
627                         #include <linux/dcache.h>
628                         static int _d_del(const struct dentry *de) { return 0; }
629                         struct dentry_operations _d_ops;],
630                         [_d_ops.d_delete = _d_del;],
631                         [DOP_D_DELETE_TAKES_CONST],
632                         [define if dentry.d_op->d_delete takes a const argument],
633                         [-Werror])
634 ])
635
636 AC_DEFUN([LINUX_IOP_GETATTR_TAKES_PATH_STRUCT], [
637   AC_CHECK_LINUX_BUILD([whether 4.11+ inode.i_op->getattr takes a struct path argument],
638                         [ac_cv_linux_iop_getattr_takes_path_struct],
639                         [#include <linux/fs.h>
640                         int _getattr(const struct path *path, struct kstat *stat, u32 request_mask,
641                           unsigned int sync_mode) {return 0;};
642                         struct inode_operations _i_ops;],
643                         [_i_ops.getattr = _getattr;],
644                         [IOP_GETATTR_TAKES_PATH_STRUCT],
645                         [define if 4.11+ inode.i_op->getattr takes a struct path argument],
646                         [-Werror])
647 ])
648
649 AC_DEFUN([LINUX_IOP_MKDIR_TAKES_UMODE_T], [
650   AC_CHECK_LINUX_BUILD([whether inode.i_op->mkdir takes a umode_t argument],
651                         [ac_cv_linux_iop_mkdir_takes_umode_t],
652                         [#include <linux/fs.h>
653                         static int _mkdir(struct inode *i, struct dentry *d, umode_t m) { return 0; }
654                         struct inode_operations _i_ops;],
655                         [_i_ops.mkdir = _mkdir;],
656                         [IOP_MKDIR_TAKES_UMODE_T],
657                         [define if inode.i_op->mkdir takes a umode_t argument],
658                         [-Werror])
659 ])
660
661
662 AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [
663   AC_CHECK_LINUX_BUILD([whether inode.i_op->create takes a umode_t argument],
664                         [ac_cv_linux_iop_create_takes_umode_t],
665                         [#include <linux/fs.h>],
666                         [struct inode_operations _i_ops;
667                         int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n)
668                                 {return 0;};
669                         _i_ops.create = _create;],
670                         [IOP_CREATE_TAKES_UMODE_T],
671                         [define if inode.i_op->create takes a umode_t argument],
672                         [-Werror])
673 ])
674
675
676 AC_DEFUN([LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES], [
677   AC_CHECK_LINUX_BUILD([whether export operation encode_fh takes inode arguments],
678                         [ac_cv_linux_export_op_encode_fh__takes_inodes],
679                         [#include <linux/exportfs.h>
680                         static int _encode_fh(struct inode *i, __u32 *fh, int *len, struct inode *p) { return 0; }
681                         struct export_operations _exp_ops;],
682                         [_exp_ops.encode_fh = _encode_fh;],
683                         [EXPORT_OP_ENCODE_FH_TAKES_INODES],
684                         [define if encode_fh export op takes inode arguments],
685                         [-Werror])
686 ])
687
688
689 AC_DEFUN([LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE], [
690   AC_CHECK_LINUX_BUILD([whether kmap_atomic takes no km_type argument],
691                         [ac_cv_linux_kma_atomic_takes_no_km_type],
692                         [#include <linux/highmem.h>],
693                         [struct page *p = NULL;
694                         kmap_atomic(p);],
695                         [KMAP_ATOMIC_TAKES_NO_KM_TYPE],
696                         [define if kmap_atomic takes no km_type argument],
697                         [-Werror])
698 ])
699
700
701 AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [
702   AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument],
703                         [ac_cv_linux_dentry_open_takes_path],
704                         [#include <linux/fs.h>],
705                         [struct path p;
706                         dentry_open(&p, 0, NULL);],
707                         [DENTRY_OPEN_TAKES_PATH],
708                         [define if dentry_open takes a path argument],
709                         [-Werror])
710 ])
711
712
713 AC_DEFUN([LINUX_D_ALIAS_IS_HLIST], [
714   AC_CHECK_LINUX_BUILD([whether dentry->d_alias is an hlist],
715                         [ac_cv_linux_d_alias_is_hlist],
716                         [#include <linux/fs.h>],
717                         [struct dentry *d = NULL;
718                         struct hlist_node *hn = NULL;
719                         #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS)
720                         d->d_u.d_alias = *hn;
721                         #else
722                         d->d_alias = *hn;
723                         #endif],
724                         [D_ALIAS_IS_HLIST],
725                         [define if dentry->d_alias is an hlist],
726                         [])
727 ])
728
729
730 AC_DEFUN([LINUX_HLIST_ITERATOR_NO_NODE], [
731   AC_CHECK_LINUX_BUILD([whether hlist iterators don't need a node parameter],
732                         [ac_cv_linux_hlist_takes_no_node],
733                         [#include <linux/list.h>
734                         #include <linux/fs.h>],
735                         [struct dentry *d = NULL, *cur;
736                         struct inode *ip;
737                         #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS)
738                         # define d_alias d_u.d_alias
739                         #endif
740                         hlist_for_each_entry(cur, &ip->i_dentry, d_alias) { }
741                         ],
742                         [HLIST_ITERATOR_NO_NODE],
743                         [define if hlist iterators don't need a node parameter],
744                         [])
745 ])
746
747
748 AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [
749   AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a bool],
750                         [ac_cv_linux_func_i_create_takes_bool],
751                         [#include <linux/fs.h>
752                         #include <linux/namei.h>],
753                         [struct inode _inode = {};
754                         struct dentry _dentry;
755                         bool b = true;
756                         (void)_inode.i_op->create(&_inode, &_dentry, 0, b);],
757                        [IOP_CREATE_TAKES_BOOL],
758                        [define if your iops.create takes a bool argument],
759                        [-Werror])
760 ])
761
762
763 AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED], [
764   AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes an unsigned int],
765                         [ac_cv_linux_func_d_revalidate_takes_unsigned],
766                         [#include <linux/fs.h>
767                         #include <linux/namei.h>
768                         static int reval(struct dentry *d, unsigned int i) { return 0; }
769                         struct dentry_operations _d_ops;],
770                         [_d_ops.d_revalidate = reval;],
771                        [DOP_REVALIDATE_TAKES_UNSIGNED],
772                        [define if your dops.d_revalidate takes an unsigned int argument],
773                        [-Werror])
774 ])
775
776
777 AC_DEFUN([LINUX_IOP_LOOKUP_TAKES_UNSIGNED], [
778   AC_CHECK_LINUX_BUILD([whether inode operation lookup takes an unsigned int],
779                         [ac_cv_linux_func_lookup_takes_unsigned],
780                         [#include <linux/fs.h>
781                         #include <linux/namei.h>
782                         static struct dentry *look(struct inode *i, struct dentry *d, unsigned int j) { return NULL; }
783                         struct inode_operations _i_ops;],
784                         [_i_ops.lookup = look;],
785                        [IOP_LOOKUP_TAKES_UNSIGNED],
786                        [define if your iops.lookup takes an unsigned int argument],
787                        [-Werror])
788 ])
789
790
791 AC_DEFUN([LINUX_D_INVALIDATE_IS_VOID], [
792   AC_CHECK_LINUX_BUILD([whether d_invalidate returns void],
793                         [ac_cv_linux_func_d_invalidate_returns_void],
794                         [#include <linux/fs.h>],
795                         [
796                         void d_invalidate(struct dentry *);
797                         ],
798                        [D_INVALIDATE_IS_VOID],
799                        [define if your d_invalidate returns void],
800                        [])
801 ])