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