LINUX: Fix "unused but set var" autoconf warnings
[openafs.git] / src / cf / linux-test4.m4
index 6f0fd11..798a27b 100644 (file)
@@ -1,3 +1,17 @@
+
+AC_DEFUN([LINUX_AIO_NONVECTOR],
+ [AC_CHECK_LINUX_BUILD([for non-vectorized aio kernel functions],
+                       [ac_cv_linux_aio_nonvector],
+                       [#include <linux/fs.h>],
+                       [extern ssize_t
+                        generic_file_aio_read(struct kiocb *, char __user *,
+                                              size_t, loff_t);],
+                       [LINUX_HAS_NONVECTOR_AIO],
+                       [define if kernel functions like generic_file_aio_read use
+                        non-vectorized i/o],
+                       [])
+ ])
+
 AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
   AC_CHECK_LINUX_BUILD([for exported tasklist_lock],
                       [ac_cv_linux_exports_tasklist_lock],
@@ -248,7 +262,7 @@ AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_FLAGS], [
   AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes flags],
                        [ac_cv_linux_func_i_permission_takes_flags],
                        [#include <linux/fs.h>],
-                       [struct inode _inode;
+                       [struct inode _inode = {0};
                        unsigned int flags = 0;
                        (void)_inode.i_op->permission(&_inode, 0, flags);],
                       [IOP_PERMISSION_TAKES_FLAGS],
@@ -264,9 +278,9 @@ AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [
 #include <linux/namei.h>],
 [struct inode _inode;
 struct dentry _dentry;
-struct nameidata _nameidata;
+struct nameidata *_nameidata;
 void *cookie;
-(void)_inode.i_op->put_link(&_dentry, &_nameidata, cookie);],
+(void)_inode.i_op->put_link(&_dentry, _nameidata, cookie);],
                       [IOP_PUT_LINK_TAKES_COOKIE],
                       [define if your iops.put_link takes a cookie],
                       [])
@@ -276,14 +290,14 @@ void *cookie;
 AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA], [
   AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes a nameidata],
                       [ac_cv_linux_func_d_revalidate_takes_nameidata],
-[#include <linux/fs.h>
-#include <linux/namei.h>],
-[struct dentry _dentry;
-struct nameidata _nameidata;
-(void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata);],
+                        [#include <linux/fs.h>
+                        #include <linux/namei.h>
+                        static int reval(struct dentry *d, struct nameidata *nd) { return 0; }
+                        struct dentry_operations dops;],
+                        [dops.d_revalidate = reval;],
                       [DOP_REVALIDATE_TAKES_NAMEIDATA],
                       [define if your dops.d_revalidate takes a nameidata argument],
-                      [])
+                      [-Werror])
 ])
 
 
@@ -339,7 +353,8 @@ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
                        [#include <linux/rwsem.h>
                        #include <linux/key.h> ],
                        [struct task_struct *t=NULL;
-                       (void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
+                       struct key k = {};
+                       (void) key_alloc(NULL, NULL, k.uid, k.gid, t, 0, 0);],
                        [KEY_ALLOC_NEEDS_STRUCT_TASK],
                        [define if key_alloc takes a struct task *],
                        [-Werror -Wno-pointer-arith])
@@ -352,7 +367,8 @@ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
                        [#include <linux/rwsem.h>
                        #include <linux/key.h>],
                        [struct cred *c = NULL;
-                       (void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
+                       struct key k = {};
+                       (void) key_alloc(NULL, NULL, k.uid, k.gid, c, 0, 0);],
                        [KEY_ALLOC_NEEDS_CRED],
                        [define if key_alloc takes credentials],
                        [-Werror -Wno-pointer-arith])
@@ -379,7 +395,7 @@ AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
   AC_CHECK_LINUX_BUILD([whether register_sysctl_table has an insert_at_head argument],
                       [ac_cv_linux_register_sysctl_table_noflag],
                       [#include <linux/sysctl.h>],
-                      [ctl_table *t; register_sysctl_table (t);],
+                      [struct ctl_table *t; register_sysctl_table (t);],
                       [REGISTER_SYSCTL_TABLE_NOFLAG],
                       [define if register_sysctl_table has no insert_at head flag],
                       [])
@@ -414,6 +430,22 @@ struct dentry _d;
 ])
 
 
+int (*fsync) (struct file *, loff_t start, loff_t end, int datasync);
+
+AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_RANGE], [
+  AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a range],
+                      [ac_cv_linux_func_f_fsync_takes_range],
+                      [#include <linux/fs.h>],
+[struct inode _inode;
+struct file _file;
+loff_t start, end;
+(void)_inode.i_fop->fsync(&_file, start, end, 0);],
+                      [FOP_FSYNC_TAKES_RANGE],
+                      [define if your fops.fsync takes range arguments],
+                      [])
+])
+
+
 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
                       [ac_cv_linux_have_kmem_cache_t],
@@ -492,7 +524,7 @@ AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
                       [ac_cv_linux_d_path_takes_struct_path],
-                      [#include <linux/dcache.h>],
+                      [#include <linux/fs.h>],
                       [struct path *p; d_path(p, NULL, 0);],
                       [D_PATH_TAKES_STRUCT_PATH],
                       [define if d_path() takes a struct path argument],
@@ -575,10 +607,191 @@ AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
 AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
   AC_CHECK_LINUX_BUILD([for dcache_lock],
                        [ac_cv_linux_have_dcache_lock],
-                       [#include <linux/dcache.h> ],
+                       [#include <linux/fs.h> ],
                        [printk("%p", &dcache_lock);],
                        [HAVE_DCACHE_LOCK],
                        [define if dcache_lock exists],
                        [])
 ])
 
+
+AC_DEFUN([LINUX_D_COUNT_IS_INT], [
+  AC_CHECK_LINUX_BUILD([if dentry->d_count is an int],
+                       [ac_cv_linux_d_count_int],
+                       [#include <linux/fs.h> ],
+                       [struct dentry _d;
+                       dget(&_d);
+                       _d.d_count = 1;],
+                       [D_COUNT_INT],
+                       [define if dentry->d_count is an int],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_DOP_D_DELETE_TAKES_CONST], [
+  AC_CHECK_LINUX_BUILD([whether dentry.d_op->d_delete takes a const argument],
+                       [ac_cv_linux_dop_d_delete_takes_const],
+                       [#include <linux/fs.h>
+                       #include <linux/dcache.h>
+                       static int _d_del(const struct dentry *de) { return 0; }
+                       struct dentry_operations _d_ops;],
+                       [_d_ops.d_delete = _d_del;],
+                       [DOP_D_DELETE_TAKES_CONST],
+                       [define if dentry.d_op->d_delete takes a const argument],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_IOP_MKDIR_TAKES_UMODE_T], [
+  AC_CHECK_LINUX_BUILD([whether inode.i_op->mkdir takes a umode_t argument],
+                       [ac_cv_linux_iop_mkdir_takes_umode_t],
+                       [#include <linux/fs.h>
+                       static int _mkdir(struct inode *i, struct dentry *d, umode_t m) { return 0; }
+                       struct inode_operations _i_ops;],
+                       [_i_ops.mkdir = _mkdir;],
+                       [IOP_MKDIR_TAKES_UMODE_T],
+                       [define if inode.i_op->mkdir takes a umode_t argument],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [
+  AC_CHECK_LINUX_BUILD([whether inode.i_op->create takes a umode_t argument],
+                       [ac_cv_linux_iop_create_takes_umode_t],
+                       [#include <linux/fs.h>],
+                       [struct inode_operations _i_ops;
+                       int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n)
+                               {return 0;};
+                       _i_ops.create = _create;],
+                       [IOP_CREATE_TAKES_UMODE_T],
+                       [define if inode.i_op->create takes a umode_t argument],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES], [
+  AC_CHECK_LINUX_BUILD([whether export operation encode_fh takes inode arguments],
+                       [ac_cv_linux_export_op_encode_fh__takes_inodes],
+                       [#include <linux/exportfs.h>
+                       static int _encode_fh(struct inode *i, __u32 *fh, int *len, struct inode *p) { return 0; }
+                       struct export_operations _exp_ops;],
+                       [_exp_ops.encode_fh = _encode_fh;],
+                       [EXPORT_OP_ENCODE_FH_TAKES_INODES],
+                       [define if encode_fh export op takes inode arguments],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE], [
+  AC_CHECK_LINUX_BUILD([whether kmap_atomic takes no km_type argument],
+                       [ac_cv_linux_kma_atomic_takes_no_km_type],
+                       [#include <linux/highmem.h>],
+                       [struct page *p = NULL;
+                       kmap_atomic(p);],
+                       [KMAP_ATOMIC_TAKES_NO_KM_TYPE],
+                       [define if kmap_atomic takes no km_type argument],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [
+  AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument],
+                       [ac_cv_linux_dentry_open_takes_path],
+                       [#include <linux/fs.h>],
+                       [struct path p;
+                       dentry_open(&p, 0, NULL);],
+                       [DENTRY_OPEN_TAKES_PATH],
+                       [define if dentry_open takes a path argument],
+                       [-Werror])
+])
+
+
+AC_DEFUN([LINUX_D_ALIAS_IS_HLIST], [
+  AC_CHECK_LINUX_BUILD([whether dentry->d_alias is an hlist],
+                       [ac_cv_linux_d_alias_is_hlist],
+                       [#include <linux/fs.h>],
+                       [struct dentry *d = NULL;
+                       struct hlist_node *hn = NULL;
+                       #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS)
+                       d->d_u.d_alias = *hn;
+                       #else
+                       d->d_alias = *hn;
+                       #endif],
+                       [D_ALIAS_IS_HLIST],
+                       [define if dentry->d_alias is an hlist],
+                       [])
+])
+
+
+AC_DEFUN([LINUX_HLIST_ITERATOR_NO_NODE], [
+  AC_CHECK_LINUX_BUILD([whether hlist iterators don't need a node parameter],
+                       [ac_cv_linux_hlist_takes_no_node],
+                       [#include <linux/list.h>
+                       #include <linux/fs.h>],
+                       [struct dentry *d = NULL, *cur;
+                       struct inode *ip;
+                       #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS)
+                       # define d_alias d_u.d_alias
+                       #endif
+                       hlist_for_each_entry(cur, &ip->i_dentry, d_alias) { }
+                       ],
+                       [HLIST_ITERATOR_NO_NODE],
+                       [define if hlist iterators don't need a node parameter],
+                       [])
+])
+
+
+AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [
+  AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a bool],
+                       [ac_cv_linux_func_i_create_takes_bool],
+                       [#include <linux/fs.h>
+                       #include <linux/namei.h>],
+                       [struct inode _inode = {};
+                       struct dentry _dentry;
+                       bool b = true;
+                       (void)_inode.i_op->create(&_inode, &_dentry, 0, b);],
+                      [IOP_CREATE_TAKES_BOOL],
+                      [define if your iops.create takes a bool argument],
+                      [-Werror])
+])
+
+
+AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED], [
+  AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes an unsigned int],
+                       [ac_cv_linux_func_d_revalidate_takes_unsigned],
+                       [#include <linux/fs.h>
+                       #include <linux/namei.h>
+                       static int reval(struct dentry *d, unsigned int i) { return 0; }
+                       struct dentry_operations _d_ops;],
+                       [_d_ops.d_revalidate = reval;],
+                      [DOP_REVALIDATE_TAKES_UNSIGNED],
+                      [define if your dops.d_revalidate takes an unsigned int argument],
+                      [-Werror])
+])
+
+
+AC_DEFUN([LINUX_IOP_LOOKUP_TAKES_UNSIGNED], [
+  AC_CHECK_LINUX_BUILD([whether inode operation lookup takes an unsigned int],
+                       [ac_cv_linux_func_lookup_takes_unsigned],
+                       [#include <linux/fs.h>
+                       #include <linux/namei.h>
+                       static struct dentry *look(struct inode *i, struct dentry *d, unsigned int j) { return NULL; }
+                       struct inode_operations _i_ops;],
+                       [_i_ops.lookup = look;],
+                      [IOP_LOOKUP_TAKES_UNSIGNED],
+                      [define if your iops.lookup takes an unsigned int argument],
+                      [-Werror])
+])
+
+
+AC_DEFUN([LINUX_D_INVALIDATE_IS_VOID], [
+  AC_CHECK_LINUX_BUILD([whether d_invalidate returns void],
+                       [ac_cv_linux_func_d_invalidate_returns_void],
+                       [#include <linux/fs.h>],
+                       [
+                       void d_invalidate(struct dentry *);
+                       ],
+                      [D_INVALIDATE_IS_VOID],
+                      [define if your d_invalidate returns void],
+                      [])
+])