b7c90709d0803ec662fb863112a38216f7fda90c
[openafs.git] / src / cf / linux-test4.m4
1 AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
2   AC_CHECK_LINUX_BUILD([for exported tasklist_lock],
3                        [ac_cv_linux_exports_tasklist_lock],
4 [#include <linux/sched.h>],
5 [
6 extern rwlock_t tasklist_lock __attribute__((weak)); 
7 read_lock(&tasklist_lock);
8 ],
9                        [EXPORTED_TASKLIST_LOCK],
10                        [define if tasklist_lock exported],
11                        [])
12 ])
13
14 AC_DEFUN([LINUX_COMPLETION_H_EXISTS], [
15   AC_CHECK_LINUX_BUILD([for linux/completion.h],
16                        [ac_cv_linux_completion_h_exists],
17 [#include <linux/version.h>
18 #include <linux/completion.h>],
19 [struct completion _c;
20 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
21 lose
22 #endif],
23                        [HAVE_LINUX_COMPLETION_H]
24                        [Define if your kernel has a usable linux/completion.h],
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 [struct dentry _dentry;
282 struct nameidata _nameidata;
283 (void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata);],
284                        [DOP_REVALIDATE_TAKES_NAMEIDATA],
285                        [define if your dops.d_revalidate takes a nameidata argument],
286                        [])
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                         (void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
343                         [KEY_ALLOC_NEEDS_STRUCT_TASK],
344                         [define if key_alloc takes a struct task *],
345                         [-Werror -Wno-pointer-arith])
346 ])
347
348
349 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
350   AC_CHECK_LINUX_BUILD([if key_alloc() takes credentials],
351                         [ac_cv_key_alloc_needs_cred],
352                         [#include <linux/rwsem.h>
353                         #include <linux/key.h>],
354                         [struct cred *c = NULL;
355                         (void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
356                         [KEY_ALLOC_NEEDS_CRED],
357                         [define if key_alloc takes credentials],
358                         [-Werror -Wno-pointer-arith])
359 ])
360
361
362 AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [
363   AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument],
364                        [ac_cv_linux_init_work_has_data],
365 [#include <linux/kernel.h>
366 #include <linux/workqueue.h>],
367
368 void f(struct work_struct *w) {}
369 struct work_struct *w;
370 int *i;
371 INIT_WORK(w,f,i);],
372                        [INIT_WORK_HAS_DATA],
373                        [define if INIT_WORK takes a data (3rd) argument],
374                        [])
375 ])
376
377
378 AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
379   AC_CHECK_LINUX_BUILD([whether register_sysctl_table has an insert_at_head argument],
380                        [ac_cv_linux_register_sysctl_table_noflag],
381                        [#include <linux/sysctl.h>],
382                        [ctl_table *t; register_sysctl_table (t);],
383                        [REGISTER_SYSCTL_TABLE_NOFLAG],
384                        [define if register_sysctl_table has no insert_at head flag],
385                        [])
386 ])
387
388
389 AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [
390   AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t],
391                        [ac_cv_linux_func_f_flush_takes_fl_owner_t],
392                        [#include <linux/fs.h>],
393 [struct inode _inode;
394 struct file _file;
395 fl_owner_t id;
396 (void)_inode.i_fop->flush(&_file, &id);],
397                        [FOP_FLUSH_TAKES_FL_OWNER_T],
398                        [define if your fops.flush takes an fl_owner_t argument],
399                        [])
400 ])
401
402
403 AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
404   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a dentry argument],
405                        [ac_cv_linux_func_f_fsync_takes_dentry],
406                        [#include <linux/fs.h>],
407 [struct inode _inode;
408 struct file _file;
409 struct dentry _d;
410 (void)_inode.i_fop->fsync(&_file, &_d, 0);],
411                        [FOP_FSYNC_TAKES_DENTRY],
412                        [define if your fops.fsync takes an dentry argument],
413                        [])
414 ])
415
416
417 int (*fsync) (struct file *, loff_t start, loff_t end, int datasync);
418
419 AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_RANGE], [
420   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a range],
421                        [ac_cv_linux_func_f_fsync_takes_range],
422                        [#include <linux/fs.h>],
423 [struct inode _inode;
424 struct file _file;
425 loff_t start, end;
426 (void)_inode.i_fop->fsync(&_file, start, end, 0);],
427                        [FOP_FSYNC_TAKES_RANGE],
428                        [define if your fops.fsync takes range arguments],
429                        [])
430 ])
431
432
433 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
434   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
435                        [ac_cv_linux_have_kmem_cache_t],
436                        [#include <linux/slab.h>],
437                        [kmem_cache_t *k;],
438                        [HAVE_KMEM_CACHE_T],
439                        [define if kmem_cache_t exists],
440                        [])
441 ])
442
443
444 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
445   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
446                        [ac_cv_linux_kmem_cache_create_takes_dtor],
447                        [#include <linux/slab.h>],
448                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
449                        [KMEM_CACHE_TAKES_DTOR],
450                        [define if kmem_cache_create takes a destructor argument],
451                        [])
452 ])
453
454
455 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
456   AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer],
457                         [ac_cv_linux_kmem_cache_create_ctor_takes_void],
458                         [#include <linux/slab.h>],
459                         [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
460                         [KMEM_CACHE_CTOR_TAKES_VOID],
461                         [define if kmem_cache_create constructor takes a single void ptr],
462                         [-Werror])
463 ])
464
465
466 dnl This function checks not just the existence of the splice functions,
467 dnl but also that the signature matches (they gained an extra argument
468 dnl around 2.6.17)
469 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
470   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
471                        [ac_cv_linux_fs_struct_fop_has_splice],
472                        [#include <linux/fs.h>],
473                        [struct file_operations _fop;
474                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
475                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
476                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
477                        [define if struct file_operations has splice functions],
478                        [])
479 ])
480
481
482 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
483   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
484                        [ac_cv_linux_kmem_cache_init],
485                        [#include <linux/slab.h>],
486                        [extern struct kmem_cache *
487                         kmem_cache_create(const char *, size_t, size_t,
488                                           unsigned long,
489                                           void (*)(struct kmem_cache *, void *));
490                         return;],
491                        [KMEM_CACHE_INIT],
492                        [define for new kmem_cache init function parameters],
493                        [])
494 ])
495
496
497 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
498   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
499                        [ac_cv_linux_exports_proc_root_fs],
500                        [#include <linux/proc_fs.h>],
501                        [struct proc_dir_entry *p = proc_root_fs;],
502                        [EXPORTED_PROC_ROOT_FS],
503                        [define if proc_root_fs is exported],
504                        [])
505 ])
506
507
508 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
509   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
510                        [ac_cv_linux_d_path_takes_struct_path],
511                        [#include <linux/fs.h>],
512                        [struct path *p; d_path(p, NULL, 0);],
513                        [D_PATH_TAKES_STRUCT_PATH],
514                        [define if d_path() takes a struct path argument],
515                        [])
516 ])
517
518
519 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
520   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
521                        [ac_cv_linux_new_export_ops],
522                        [#include <linux/exportfs.h>],
523                        [struct export_operations _eops;
524                         _eops.fh_to_parent(NULL, NULL, 0, 0);],
525                        [NEW_EXPORT_OPS],
526                        [define if kernel uses new export ops],
527                        [])
528 ])
529
530
531 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
532   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
533                        [ac_cv_linux_posix_test_lock_returns_conflict],
534                        [#include <linux/fs.h>],
535                        [struct file_lock *lock;
536                         struct file * file;
537                         lock = posix_test_lock(file, lock);],
538                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
539                        [define if posix_test_lock returns the conflicting lock],
540                        [])
541 ])
542
543
544 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
545   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
546                        [ac_cv_linux_posix_test_lock_conflict_arg],
547                        [#include <linux/fs.h>],
548                        [struct file_lock *lock;
549                         struct file *file;
550                         posix_test_lock(file, lock, lock);],
551                        [POSIX_TEST_LOCK_CONFLICT_ARG],
552                        [define if posix_test_lock takes a conflict argument],
553                        [])
554 ])
555
556
557 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
558   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
559                        [ac_cv_linux_exports_key_type_keyring],
560 [
561 #ifdef HAVE_LINUX_KEY_TYPE_H
562 #include <linux/key-type.h>
563 #endif
564 #include <linux/key.h>
565 ],
566                        [printk("%s", key_type_keyring.name);],
567                        [EXPORTED_KEY_TYPE_KEYRING],
568                        [define if key_type_keyring is exported],
569                        [])
570 ])
571
572
573 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
574   AC_CHECK_LINUX_BUILD([for try_to_freeze],
575                        [ac_cv_linux_have_try_to_freeze],
576 [#include <linux/sched.h>
577 #ifdef HAVE_LINUX_FREEZER_H
578 #include <linux/freezer.h>
579 #endif],
580 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
581    try_to_freeze(PF_FREEZE);
582 #else
583    try_to_freeze();
584 #endif],
585                        [HAVE_TRY_TO_FREEZE],
586                        [define if your kernel has the try_to_freeze function],
587                        [])
588 ])
589
590
591 AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
592   AC_CHECK_LINUX_BUILD([for dcache_lock],
593                         [ac_cv_linux_have_dcache_lock],
594                         [#include <linux/fs.h> ],
595                         [printk("%p", &dcache_lock);],
596                         [HAVE_DCACHE_LOCK],
597                         [define if dcache_lock exists],
598                         [])
599 ])
600
601
602 AC_DEFUN([LINUX_D_COUNT_IS_INT], [
603   AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
604                         [ac_cv_linux_d_count_int],
605                         [#include <linux/fs.h> ],
606                         [struct dentry _d;
607                         dget(&_d);
608                         _d.d_count = 1;],
609                         [D_COUNT_INT],
610                         [define if dentry->d_count is an int],
611                         [-Werror])
612 ])
613
614
615 AC_DEFUN([LINUX_DOP_D_DELETE_TAKES_CONST], [
616   AC_CHECK_LINUX_BUILD([whether dentry.d_op->d_delete takes a const argument],
617                         [ac_cv_linux_dop_d_delete_takes_const],
618                         [#include <linux/fs.h>
619                         #include <linux/dcache.h>],
620                         [struct dentry_operations _d_ops;
621                         int _d_del(const struct dentry *de) {return 0;};
622                         _d_ops.d_delete = _d_del;],
623                         [DOP_D_DELETE_TAKES_CONST],
624                         [define if dentry.d_op->d_delete takes a const argument],
625                         [-Werror])
626 ])