#
# Linux kernel 3.12 introduced struct kernel_param_ops
# This has been backported to all lustre supported
-# clients expect RHEL6. We have to handle the differences.
+# clients except RHEL6. We have to handle the differences.
#
AC_DEFUN([LIBCFS_KERNEL_PARAM_OPS],[
LB_CHECK_COMPILE([does 'struct kernel_param_ops' exist],
#include <linux/module.h>
],[
struct kernel_param_ops ops;
+
+ ops.set = NULL;
],[
AC_DEFINE(HAVE_KERNEL_PARAM_OPS, 1,
['struct kernel_param_ops' is available])
#include <linux/mmzone.h>
#include <linux/shrinker.h>
],[
- ((struct shrinker*)0)->count_objects(NULL, NULL);
+ struct shrinker shrinker;
+
+ shrinker.count_objects = NULL;
],[
AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
[shrinker has count_objects member])
#include <linux/ktime.h>
],[
struct timespec64 ts;
- ktime_t now;
+ ktime_t now = { };
ts = ktime_to_timespec64(now);
],[
timespec64_sub, [
#include <linux/time.h>
],[
- struct timespec64 later,earlier,diff;
+ struct timespec64 later = { }, earlier = { }, diff;
diff = timespec64_sub(later, earlier);
],[
#include <linux/wait.h>
],[
wait_queue_entry_t e;
+
+ e.flags = 0;
],[
AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY, 1,
['wait_queue_entry_t' is available])
set_cpus_allowed_ptr, [
#include <linux/sched.h>
],[
- struct task_struct *t;
- #if HAVE_CPUMASK_T
- cpumask_t m;
- #else
- unsigned long m;
- #endif
+ struct task_struct *t = NULL;
+ cpumask_t m = { };
+
set_cpus_allowed_ptr(t, &m);
],[
AC_DEFINE(CPU_AFFINITY, 1,
#endif
#include <linux/kthread.h>
],[
- struct kthread_work *kth_wrk __attribute__ ((unused));
+ struct kthread_work *kth_wrk = NULL;
flush_kthread_work(kth_wrk);
],[
AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
#
AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
- [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
- [kmap_to_page is exported by the kernel])])
+ [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
+ [kmap_to_page is exported by the kernel])])
]) # LN_EXPORT_KMAP_TO_PAG
#
__add_wait_queue_exclusive, [
#include <linux/wait.h>
],[
- wait_queue_head_t queue;
- wait_queue_t wait;
+ wait_queue_head_t queue = { };
+ wait_queue_t wait = { };
__add_wait_queue_exclusive(&queue, &wait);
],[
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
],[
- ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
+ struct fs_struct fss = { };
+ rwlock_t rwl = { };
+
+ fss.lock = rwl;
],[
AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
])
file_system_type_mount, [
#include <linux/fs.h>
],[
- struct file_system_type fst;
- void *i = (void *) fst.mount;
+ struct file_system_type fst = { };
+ void *mount;
+
+ mount = (void *)fst.mount;
],[
AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
[struct file_system_type has mount field])
dirty_inode_super_operation_flag, [
#include <linux/fs.h>
],[
- struct inode *inode;
+ struct inode *inode = NULL;
inode->i_sb->s_op->dirty_inode(NULL, 0);
],[
AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
#include <linux/migrate_mode.h>
#endif
],[
- struct address_space_operations aops;
+ struct address_space_operations aops = { };
aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
],[
AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
bio_end_sector, [
#include <linux/bio.h>
],[
- struct bio bio;
+ struct bio bio = { };
+ unsigned long long end;
- bio_end_sector(&bio);
+ end = bio_end_sector(&bio);
],[
AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
[bio_end_sector is defined])
is_sxid, [
#include <linux/fs.h>
],[
- struct inode inode;
+ struct inode inode = { };
is_sxid(inode.i_mode);
],[
AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
LB_CHECK_COMPILE([if get_projid exists],
get_projid, [
+ struct inode;
#include <linux/quota.h>
],[
- struct dquot_operations ops;
+ struct dquot_operations ops = { };
ops.get_projid(NULL, NULL);
],[
#error "back to use readdir in kabi_extand mode"
#else
struct dir_context ctx;
+
ctx.pos = 0;
#endif
],[
# 3.11 need to access d_count to get dentry reference count
#
AC_DEFUN([LC_HAVE_DCOUNT], [
-LB_CHECK_COMPILE([if 'd_count' exist],
+LB_CHECK_COMPILE([if 'd_count' exists],
d_count, [
#include <linux/dcache.h>
],[
- struct dentry de;
- d_count(&de);
+ struct dentry de = { };
+ int count;
+
+ count = d_count(&de);
],[
AC_DEFINE(HAVE_D_COUNT, 1,
[d_count exist])
#include <linux/bio.h>
],[
struct bvec_iter iter;
+
iter.bi_bvec_done = 0;
], [
AC_DEFINE(HAVE_BVEC_ITER, 1,
#include <asm/atomic.h>
#include <linux/bio.h>
],[
- struct bio bio;
+ struct bio bio = { };
int cnt;
cnt = atomic_read(&bio.bi_cnt);
], [
#include <linux/bio.h>
],[
struct bio bio;
- bio.bi_rw;
+
+ bio.bi_rw = 0;
], [
AC_DEFINE(HAVE_BI_RW, 1,
[struct bio has bi_rw])
direct_io_iter, [
#include <linux/fs.h>
],[
- struct address_space_operations ops;
+ struct address_space_operations ops = { };
struct iov_iter *iter = NULL;
loff_t offset = 0;
#include <linux/key-type.h>
],[
struct key_match_data data;
+
+ data.raw_data = NULL;
],[
AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
[struct key_match_data exist])
ki_nbytes, [
#include <linux/fs.h>
],[
- struct kiocb iocb;
+ struct kiocb iocb = { };
iocb.ki_nbytes = 0;
],[
key_payload_data_array, [
#include <linux/key.h>
],[
- ((struct key *)0)->payload.data[0] = NULL;
+ struct key key = { };
+
+ key.payload.data[0] = NULL;
],[
AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
])
direct_io_2args, [
#include <linux/fs.h>
],[
- struct address_space_operations ops;
+ struct address_space_operations ops = { };
struct iov_iter *iter = NULL;
struct kiocb *iocb = NULL;
int rc;
+
rc = ops.direct_IO(iocb, iter);
],[
AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
],[
struct kiocb *iocb = NULL;
ssize_t rc;
+
rc = generic_write_sync(iocb, 0);
],[
AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,