Linux: fix permission op test for certain compilers
[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 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
418   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
419                        [ac_cv_linux_have_kmem_cache_t],
420                        [#include <linux/slab.h>],
421                        [kmem_cache_t *k;],
422                        [HAVE_KMEM_CACHE_T],
423                        [define if kmem_cache_t exists],
424                        [])
425 ])
426
427
428 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
429   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
430                        [ac_cv_linux_kmem_cache_create_takes_dtor],
431                        [#include <linux/slab.h>],
432                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
433                        [KMEM_CACHE_TAKES_DTOR],
434                        [define if kmem_cache_create takes a destructor argument],
435                        [])
436 ])
437
438
439 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
440   AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer],
441                         [ac_cv_linux_kmem_cache_create_ctor_takes_void],
442                         [#include <linux/slab.h>],
443                         [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
444                         [KMEM_CACHE_CTOR_TAKES_VOID],
445                         [define if kmem_cache_create constructor takes a single void ptr],
446                         [-Werror])
447 ])
448
449
450 dnl This function checks not just the existence of the splice functions,
451 dnl but also that the signature matches (they gained an extra argument
452 dnl around 2.6.17)
453 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
454   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
455                        [ac_cv_linux_fs_struct_fop_has_splice],
456                        [#include <linux/fs.h>],
457                        [struct file_operations _fop;
458                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
459                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
460                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
461                        [define if struct file_operations has splice functions],
462                        [])
463 ])
464
465
466 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
467   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
468                        [ac_cv_linux_kmem_cache_init],
469                        [#include <linux/slab.h>],
470                        [extern struct kmem_cache *
471                         kmem_cache_create(const char *, size_t, size_t,
472                                           unsigned long,
473                                           void (*)(struct kmem_cache *, void *));
474                         return;],
475                        [KMEM_CACHE_INIT],
476                        [define for new kmem_cache init function parameters],
477                        [])
478 ])
479
480
481 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
482   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
483                        [ac_cv_linux_exports_proc_root_fs],
484                        [#include <linux/proc_fs.h>],
485                        [struct proc_dir_entry *p = proc_root_fs;],
486                        [EXPORTED_PROC_ROOT_FS],
487                        [define if proc_root_fs is exported],
488                        [])
489 ])
490
491
492 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
493   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
494                        [ac_cv_linux_d_path_takes_struct_path],
495                        [#include <linux/fs.h>],
496                        [struct path *p; d_path(p, NULL, 0);],
497                        [D_PATH_TAKES_STRUCT_PATH],
498                        [define if d_path() takes a struct path argument],
499                        [])
500 ])
501
502
503 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
504   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
505                        [ac_cv_linux_new_export_ops],
506                        [#include <linux/exportfs.h>],
507                        [struct export_operations _eops;
508                         _eops.fh_to_parent(NULL, NULL, 0, 0);],
509                        [NEW_EXPORT_OPS],
510                        [define if kernel uses new export ops],
511                        [])
512 ])
513
514
515 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
516   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
517                        [ac_cv_linux_posix_test_lock_returns_conflict],
518                        [#include <linux/fs.h>],
519                        [struct file_lock *lock;
520                         struct file * file;
521                         lock = posix_test_lock(file, lock);],
522                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
523                        [define if posix_test_lock returns the conflicting lock],
524                        [])
525 ])
526
527
528 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
529   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
530                        [ac_cv_linux_posix_test_lock_conflict_arg],
531                        [#include <linux/fs.h>],
532                        [struct file_lock *lock;
533                         struct file *file;
534                         posix_test_lock(file, lock, lock);],
535                        [POSIX_TEST_LOCK_CONFLICT_ARG],
536                        [define if posix_test_lock takes a conflict argument],
537                        [])
538 ])
539
540
541 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
542   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
543                        [ac_cv_linux_exports_key_type_keyring],
544 [
545 #ifdef HAVE_LINUX_KEY_TYPE_H
546 #include <linux/key-type.h>
547 #endif
548 #include <linux/key.h>
549 ],
550                        [printk("%s", key_type_keyring.name);],
551                        [EXPORTED_KEY_TYPE_KEYRING],
552                        [define if key_type_keyring is exported],
553                        [])
554 ])
555
556
557 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
558   AC_CHECK_LINUX_BUILD([for try_to_freeze],
559                        [ac_cv_linux_have_try_to_freeze],
560 [#include <linux/sched.h>
561 #ifdef HAVE_LINUX_FREEZER_H
562 #include <linux/freezer.h>
563 #endif],
564 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
565    try_to_freeze(PF_FREEZE);
566 #else
567    try_to_freeze();
568 #endif],
569                        [HAVE_TRY_TO_FREEZE],
570                        [define if your kernel has the try_to_freeze function],
571                        [])
572 ])
573
574
575 AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
576   AC_CHECK_LINUX_BUILD([for dcache_lock],
577                         [ac_cv_linux_have_dcache_lock],
578                         [#include <linux/fs.h> ],
579                         [printk("%p", &dcache_lock);],
580                         [HAVE_DCACHE_LOCK],
581                         [define if dcache_lock exists],
582                         [])
583 ])
584
585
586 AC_DEFUN([LINUX_D_COUNT_IS_INT], [
587   AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
588                         [ac_cv_linux_d_count_int],
589                         [#include <linux/fs.h> ],
590                         [struct dentry _d;
591                         dget(&_d);
592                         _d.d_count = 1;],
593                         [D_COUNT_INT],
594                         [define if dentry->d_count is an int],
595                         [-Werror])
596 ])