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