EXTRA_KCFLAGS="$tmp_flags"
])
-# LIBCFS_TASKLIST_LOCK
-# 2.6.18 remove tasklist_lock export
-AC_DEFUN([LIBCFS_TASKLIST_LOCK],
-[LB_CHECK_SYMBOL_EXPORT([tasklist_lock],
-[kernel/fork.c],[
-AC_DEFINE(HAVE_TASKLIST_LOCK, 1,
- [tasklist_lock exported])
-],[
-])
-])
-
-# LIBCFS_DIGEST_SETKEY_FLAGS
-# digest_alg.dia_setkey takes 4 args (2.6.18)
-#
-AC_DEFUN([LIBCFS_DIGEST_SETKEY_FLAGS],
-[AC_MSG_CHECKING([if kernel dia_setkey takes 4 args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct digest_alg alg;
-
- alg.dia_setkey(NULL, NULL, 0, NULL);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_DIGEST_SETKEY_FLAGS, 1, [kernel dia_setkey takes 4 args])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.19 API changes
-# kmem_cache_destroy(cachep) return void instead of
-# int
-AC_DEFUN([LIBCFS_KMEM_CACHE_DESTROY_INT],
-[AC_MSG_CHECKING([kmem_cache_destroy(cachep) return int])
-LB_LINUX_TRY_COMPILE([
- #include <linux/slab.h>
-],[
- int i __attribute__ ((unused));
- i = kmem_cache_destroy(NULL);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_KMEM_CACHE_DESTROY_INT, 1,
- [kmem_cache_destroy(cachep) return int])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
# check cpumask_size (2.6.28)
AC_DEFUN([LIBCFS_CPUMASK_SIZE],
[AC_MSG_CHECKING([whether have cpumask_size()])
])
-# 2.6.20 API change INIT_WORK use 2 args and not
-# store data inside
-AC_DEFUN([LIBCFS_3ARGS_INIT_WORK],
-[AC_MSG_CHECKING([check INIT_WORK want 3 args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/workqueue.h>
-],[
- struct work_struct work __attribute__ ((unused));
-
- INIT_WORK(&work, NULL, NULL);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
- [INIT_WORK use 3 args and store data inside])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-# 2.6.21 api change. 'register_sysctl_table' use only one argument,
-# instead of more old which need two.
-AC_DEFUN([LIBCFS_2ARGS_REGISTER_SYSCTL],
-[AC_MSG_CHECKING([check register_sysctl_table want 2 args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/sysctl.h>
-],[
- register_sysctl_table(NULL,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
- [register_sysctl_table want 2 args])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-# 2.6.23 lost dtor argument
-AC_DEFUN([LIBCFS_KMEM_CACHE_CREATE_DTOR],
-[AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
-LB_LINUX_TRY_COMPILE([
- #include <linux/slab.h>
-],[
- kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_KMEM_CACHE_CREATE_DTOR, 1,
- [kmem_cache_create has dtor argument])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-#2.6.23 has new shrinker API
-AC_DEFUN([LC_REGISTER_SHRINKER],
-[AC_MSG_CHECKING([if kernel has register_shrinker])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- register_shrinker(NULL);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
- [kernel has register_shrinker])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.24 request not use real numbers for ctl_name
AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
[AC_MSG_CHECKING([for CTL_UNNUMBERED])
])
])
-# 2.6.24 lost scatterlist->page
-AC_DEFUN([LIBCFS_SCATTERLIST_SETPAGE],
-[AC_MSG_CHECKING([for exist sg_set_page])
-LB_LINUX_TRY_COMPILE([
- #include <asm/types.h>
- #include <linux/scatterlist.h>
-],[
- sg_set_page(NULL,NULL,0,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SCATTERLIST_SETPAGE, 1,
- [struct scatterlist has no page member])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-# 2.6.24-rc1 sg_init_table
-AC_DEFUN([LIBCFS_SCATTERLIST_INITTABLE],
-[AC_MSG_CHECKING([for sg_init_table])
-LB_LINUX_TRY_COMPILE([
- #include <asm/types.h>
- #include <linux/scatterlist.h>
-],[
- sg_init_table(NULL,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SCATTERLIST_INITTABLE, 1,
- [scatterlist has sg_init_table])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-# 2.6.24
-AC_DEFUN([LIBCFS_NETWORK_NAMESPACE],
-[AC_MSG_CHECKING([for network stack has namespaces])
-LB_LINUX_TRY_COMPILE([
- #include <net/net_namespace.h>
-],[
- struct net *net __attribute__ ((unused));
- net = &init_net;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_INIT_NET, 1,
- [kernel is support network namespaces ])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
#
# LIBCFS_FUNC_DUMP_TRACE
#
])
-# 2.6.26 use int instead of atomic for sem.count
-AC_DEFUN([LIBCFS_SEM_COUNT],
-[AC_MSG_CHECKING([atomic sem.count])
-LB_LINUX_TRY_COMPILE([
- #include <asm/semaphore.h>
-],[
- struct semaphore s __attribute__ ((unused));
-
- atomic_read(&s.count);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SEM_COUNT_ATOMIC, 1,
- [semaphore counter is atomic])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
# 2.6.27 have second argument to sock_map_fd
AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
[AC_MSG_CHECKING([sock_map_fd have second argument])
])
])
-# LIBCFS_CRED_WRAPPERS
-#
-# wrappers for task's credentials are in sles11
-#
-AC_DEFUN([LIBCFS_CRED_WRAPPERS],
-[AC_MSG_CHECKING([if kernel has wrappers for task's credentials])
-LB_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
-],[
- uid_t uid;
-
- uid = current_uid() + sizeof(uid);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_CRED_WRAPPERS, 1, [task's cred wrappers found])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# LN_STRUCT_CRED_IN_TASK
-#
-# struct cred was introduced in 2.6.29 to streamline credentials in task struct
-#
-AC_DEFUN([LIBCFS_STRUCT_CRED_IN_TASK],
-[AC_MSG_CHECKING([if kernel has struct cred])
-LB_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
-],[
- struct task_struct *tsk = NULL;
- tsk->real_cred = NULL;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_CRED, 1, [struct cred found])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# LIBCFS_STRUCT_SHASH_ALG
-# struct shash_alg was introduced in 2.6.29
-#
-AC_DEFUN([LIBCFS_STRUCT_SHASH_ALG],
-[AC_MSG_CHECKING([if kernel has struct shash_alg])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <crypto/internal/hash.h>
-],[
- struct shash_alg foo;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_SHASH_ALG, 1, [kernel has struct shash_alg])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-
-#
-# LIBCFS_FUNC_UNSHARE_FS_STRUCT
-#
-# unshare_fs_struct was introduced in 2.6.30 to prevent others to directly
-# mess with copy_fs_struct
-#
-AC_DEFUN([LIBCFS_FUNC_UNSHARE_FS_STRUCT],
-[AC_MSG_CHECKING([if kernel defines unshare_fs_struct()])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
- #include <linux/fs_struct.h>
-],[
- unshare_fs_struct();
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_UNSHARE_FS_STRUCT, 1, [unshare_fs_struct found])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
#
# LIBCFS_HAVE_IS_COMPAT_TASK
#
])
#
-# check set_mems_allowed
-# 2.6.31 adds function set_mems_allowed in cpuset.h
-#
-AC_DEFUN([LIBCFS_HAVE_SET_MEMS_ALLOWED],
-[AC_MSG_CHECKING([whether have set_mems_allowed()])
-LB_LINUX_TRY_COMPILE([
- #include <linux/cpuset.h>
-],[
- nodemask_t mask;
-
- set_mems_allowed(mask);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SET_MEMS_ALLOWED, 1, [have set_mems_allowed()])
-],[
- AC_MSG_RESULT(NO)
-])
-])
-
-
-#
# RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
#
AC_DEFUN([LC_SHRINKER_WANT_SHRINK_PTR],
LIBCFS_U64_LONG_LONG_LINUX
# 2.6.18
-LIBCFS_TASKLIST_LOCK
LIBCFS_HAVE_IS_COMPAT_TASK
-LIBCFS_DIGEST_SETKEY_FLAGS
-# 2.6.19
-LIBCFS_KMEM_CACHE_DESTROY_INT
-# 2.6.20
-LIBCFS_3ARGS_INIT_WORK
-# 2.6.21
-LIBCFS_2ARGS_REGISTER_SYSCTL
-# 2.6.23
-LIBCFS_KMEM_CACHE_CREATE_DTOR
-LC_REGISTER_SHRINKER
# 2.6.24
LIBCFS_SYSCTL_UNNUMBERED
-LIBCFS_SCATTERLIST_SETPAGE
-LIBCFS_SCATTERLIST_INITTABLE
-LIBCFS_NETWORK_NAMESPACE
LIBCFS_FUNC_DUMP_TRACE
LIBCFS_HAVE_KEYTYPE_H
-# 2.6.26
-LIBCFS_SEM_COUNT
-# 2.6.27
-LIBCFS_CRED_WRAPPERS
# 2.6.28
LIBCFS_CPUMASK_SIZE
# 2.6.29
-LIBCFS_STRUCT_CRED_IN_TASK
LIBCFS_CPU_TOPOLOGY
-LIBCFS_STRUCT_SHASH_ALG
# 2.6.30
-LIBCFS_FUNC_UNSHARE_FS_STRUCT
LIBCFS_SOCK_MAP_FD_2ARG
-# 2.6.31
-LIBCFS_HAVE_SET_MEMS_ALLOWED
# 2.6.32
LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
LC_SHRINKER_WANT_SHRINK_PTR
#include <libcfs/linux/portals_compat25.h>
-#ifdef HAVE_3ARGS_INIT_WORK
-
-#define prepare_work(wq,cb,cbdata) \
-do { \
- INIT_WORK((wq), (void *)(cb), (void *)(cbdata)); \
-} while (0)
-
-#define cfs_get_work_data(type,field,data) (data)
-
-#else
-
-#define prepare_work(wq,cb,cbdata) \
-do { \
- INIT_WORK((wq), (void *)(cb)); \
-} while (0)
-
#define cfs_get_work_data(type,field,data) container_of(data,type,field)
-#endif
-
#define cfs_num_online_cpus() num_online_cpus()
#define wait_on_page wait_on_page_locked
#define our_recalc_sigpending(current) recalc_sigpending()
#define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
#define LASSERT_MUTEX_LOCKED(x) LASSERT(mutex_is_locked(x))
-#ifdef HAVE_SEM_COUNT_ATOMIC
-#define SEM_COUNT(sem) (atomic_read(&(sem)->count))
-#else
-#define SEM_COUNT(sem) ((sem)->count)
-#endif
-
#define LIBCFS_PANIC(msg) panic(msg)
/* ------------------------------------------------------------------- */
#undef _LWORDSIZE
-/* compat macroses */
-#ifndef HAVE_SCATTERLIST_SETPAGE
-static inline void sg_set_page(struct scatterlist *sg, struct page *page,
- unsigned int len, unsigned int offset)
-{
- sg->page = page;
- sg->offset = offset;
- sg->length = len;
-}
-
-static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
-{
- sg->page = page;
-}
-#endif
-
#define cfs_smp_processor_id() smp_processor_id()
#ifndef get_cpu
#define WITH_WATCHDOG
#endif
-#ifndef HAVE_STRUCT_CRED
-
-#define current_cred() (current)
-
-#define current_cred_xxx(xxx) \
-({ \
- current->xxx; \
-})
-
-#ifndef HAVE_CRED_WRAPPERS
-
-#define current_uid() (current_cred_xxx(uid))
-#define current_gid() (current_cred_xxx(gid))
-#define current_euid() (current_cred_xxx(euid))
-#define current_egid() (current_cred_xxx(egid))
-#define current_suid() (current_cred_xxx(suid))
-#define current_sgid() (current_cred_xxx(sgid))
-#define current_fsuid() (current_cred_xxx(fsuid))
-#define current_fsgid() (current_cred_xxx(fsgid))
-#define current_cap() (current_cred_xxx(cap_effective))
-
-#endif /* HAVE_LINUX_CRED_H */
-
-#define current_user() (current_cred_xxx(user))
-#define current_user_ns() (current_cred_xxx(user)->user_ns)
-#define current_security() (current_cred_xxx(security))
-
-#define cred task_struct
-
-#define prepare_creds() (current)
-#define commit_creds(a)
-
-#endif /* HAVE_STRUCT_CRED */
-
-#ifndef HAVE_SCATTERLIST_INITTABLE
-#define sg_init_table(sg, nents) memset(sg, 0, sizeof(*(sg))*(nents))
-#endif
-
-#ifndef HAVE_SCATTERLIST_SETPAGE
-#define sg_set_page(sg, p, len, off) \
- sg_set_buf(sg, page_address(p) + ((off) & ~CFS_PAGE_MASK), len)
-#endif
-
#endif /* _LINUX_LIBCFS_H */
# define shrink_param(sc, var) (var)
#endif
-#ifdef HAVE_REGISTER_SHRINKER
typedef int (*shrinker_t)(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask));
static inline
unregister_shrinker(shrinker);
kfree(shrinker);
}
-#endif
#endif /* __LINUX_CFS_MEM_H__ */
typedef struct ctl_table cfs_sysctl_table_t;
typedef struct ctl_table_header cfs_sysctl_table_header_t;
-#ifdef HAVE_2ARGS_REGISTER_SYSCTL
-#define cfs_register_sysctl_table(t, a) register_sysctl_table(t, a)
-#else
#define cfs_register_sysctl_table(t, a) register_sysctl_table(t)
-#endif
#define cfs_unregister_sysctl_table(t) unregister_sysctl_table(t)
#define DECLARE_PROC_HANDLER(name) \
#else
#define cfs_sk_sleep(sk) sk_sleep(sk)
#endif
-
-#ifdef HAVE_INIT_NET
-#define DEFAULT_NET (&init_net)
-#else
-/* some broken backports */
-#define DEFAULT_NET (NULL)
-#endif
-
#endif
#define cfs_work_struct_t WORK_QUEUE_ITEM
-#define cfs_prepare_work(tq, routine, contex)
#define cfs_schedule_work(tq)
#define cfs_get_work_data(type,field,data) (data)
#else
rc = set_cpus_allowed_ptr(cfs_current(), cpumask);
#endif
-#ifdef HAVE_SET_MEMS_ALLOWED
set_mems_allowed(*nodemask);
-#endif
if (rc == 0)
cfs_schedule(); /* switch to allowed CPU */
#include <linux/module.h>
#include <linux/zutil.h>
-#ifdef HAVE_STRUCT_SHASH_ALG
#include <crypto/internal/hash.h>
-#else
-#include <linux/crypto.h>
-#endif
#define CHKSUM_BLOCK_SIZE 1
return 0;
}
-#ifdef HAVE_STRUCT_SHASH_ALG
static int adler32_setkey(struct crypto_shash *hash, const u8 *key,
unsigned int keylen)
{
.cra_init = adler32_cra_init,
}
};
-#else /* HAVE_STRUCT_SHASH_ALG */
-#ifdef HAVE_DIGEST_SETKEY_FLAGS
-static int adler32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen, u32 *flags)
-#else
-static int adler32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen)
-#endif
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- if (keylen != sizeof(u32)) {
- tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
- return -EINVAL;
- }
- *mctx = le32_to_cpup((__le32 *)key);
- return 0;
-}
-
-static void adler32_digest_init(struct crypto_tfm *tfm)
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- *mctx = 0;
-
-}
-static void adler32_digest_update(struct crypto_tfm *tfm, const u8 *data,
- unsigned int len)
-{
- u32 *crcp = crypto_tfm_ctx(tfm);
-
- *crcp = __adler32(*crcp, data, len);
-}
-
-static void adler32_digest_final(struct crypto_tfm *tfm, u8 *out)
-{
- u32 *chksum = crypto_tfm_ctx(tfm);
-
- *(__le32 *)out = cpu_to_le32p(chksum);
-}
-
-static struct crypto_alg alg = {
- .cra_name = "adler32",
- .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
- .cra_driver_name = "adler32-zlib",
- .cra_priority = 100,
- .cra_blocksize = CHKSUM_BLOCK_SIZE,
- .cra_ctxsize = sizeof(u32),
- .cra_module = THIS_MODULE,
- .cra_init = adler32_cra_init,
- .cra_list = LIST_HEAD_INIT(alg.cra_list),
- .cra_u = {
- .digest = {
- .dia_digestsize = CHKSUM_DIGEST_SIZE,
- .dia_setkey = adler32_digest_setkey,
- .dia_init = adler32_digest_init,
- .dia_update = adler32_digest_update,
- .dia_final = adler32_digest_final
- }
- }
-};
-#endif /* HAVE_STRUCT_SHASH_ALG */
-
int cfs_crypto_adler32_register(void)
{
-#ifdef HAVE_STRUCT_SHASH_ALG
return crypto_register_shash(&alg);
-#else
- return crypto_register_alg(&alg);
-#endif
}
EXPORT_SYMBOL(cfs_crypto_adler32_register);
void cfs_crypto_adler32_unregister(void)
{
-#ifdef HAVE_STRUCT_SHASH_ALG
crypto_unregister_shash(&alg);
-#else
- crypto_unregister_alg(&alg);
-#endif
}
EXPORT_SYMBOL(cfs_crypto_adler32_unregister);
#include <linux/module.h>
#include <linux/crc32.h>
-#ifdef HAVE_STRUCT_SHASH_ALG
#include <crypto/internal/hash.h>
-#else
-#include <linux/crypto.h>
-#endif
#define CHKSUM_BLOCK_SIZE 1
#define CHKSUM_DIGEST_SIZE 4
}
-#ifdef HAVE_STRUCT_SHASH_ALG
/*
* Setting the seed allows arbitrary accumulators and flexible XOR policy
* If your algorithm starts with ~0, then XOR with ~0 before you set
.cra_init = crc32_cra_init,
}
};
-#else /* HAVE_STRUCT_SHASH_ALG */
-#ifdef HAVE_DIGEST_SETKEY_FLAGS
-static int crc32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen, unsigned int *flags)
-#else
-static int crc32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen)
-#endif
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- if (keylen != sizeof(u32)) {
- tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
- return -EINVAL;
- }
- *mctx = le32_to_cpup((__le32 *)key);
- return 0;
-}
-
-static void crc32_digest_init(struct crypto_tfm *tfm)
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- *mctx = 0;
-
-}
-static void crc32_digest_update(struct crypto_tfm *tfm, const u8 *data,
- unsigned int len)
-{
- u32 *crcp = crypto_tfm_ctx(tfm);
-
- *crcp = __crc32_le(*crcp, data, len);
-}
-
-static void crc32_digest_final(struct crypto_tfm *tfm, u8 *out)
-{
- u32 *crcp = crypto_tfm_ctx(tfm);
-
- *(__le32 *)out = cpu_to_le32p(crcp);
-}
-
-static struct crypto_alg alg = {
- .cra_name = "crc32",
- .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
- .cra_driver_name = "crc32-table",
- .cra_priority = 100,
- .cra_blocksize = CHKSUM_BLOCK_SIZE,
- .cra_ctxsize = sizeof(u32),
- .cra_module = THIS_MODULE,
- .cra_init = crc32_cra_init,
- .cra_list = LIST_HEAD_INIT(alg.cra_list),
- .cra_u = {
- .digest = {
- .dia_digestsize = CHKSUM_DIGEST_SIZE,
- .dia_setkey = crc32_digest_setkey,
- .dia_init = crc32_digest_init,
- .dia_update = crc32_digest_update,
- .dia_final = crc32_digest_final
- }
- }
-};
-#endif /* HAVE_STRUCT_SHASH_ALG */
int cfs_crypto_crc32_register(void)
{
-#ifdef HAVE_STRUCT_SHASH_ALG
return crypto_register_shash(&alg);
-#else
- return crypto_register_alg(&alg);
-#endif
}
EXPORT_SYMBOL(cfs_crypto_crc32_register);
void cfs_crypto_crc32_unregister(void)
{
-#ifdef HAVE_STRUCT_SHASH_ALG
crypto_unregister_shash(&alg);
-#else
- crypto_unregister_alg(&alg);
-#endif
}
EXPORT_SYMBOL(cfs_crypto_crc32_unregister);
* Author: Alexander Boyko <Alexander_Boyko@xyratex.com>
*/
#include <linux/crc32.h>
-#ifdef HAVE_STRUCT_SHASH_ALG
#include <crypto/internal/hash.h>
-#else
-#include <linux/crypto.h>
-#endif
#include <linux/crc32.h>
#include <asm/cpufeature.h>
#include <asm/i387.h>
return 0;
}
-#ifdef HAVE_STRUCT_SHASH_ALG
/*
* Setting the seed allows arbitrary accumulators and flexible XOR policy
* If your algorithm starts with ~0, then XOR with ~0 before you set
.cra_init = crc32_pclmul_cra_init,
}
};
-#else /* HAVE_STRUCT_SHASH_ALG */
-#ifdef HAVE_DIGEST_SETKEY_FLAGS
-static int crc32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen, unsigned int *flags)
-#else
-static int crc32_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
- unsigned int keylen)
-#endif
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- if (keylen != sizeof(u32)) {
- tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
- return -EINVAL;
- }
- *mctx = le32_to_cpup((__le32 *)key);
- return 0;
-}
-
-static void crc32_digest_init(struct crypto_tfm *tfm)
-{
- u32 *mctx = crypto_tfm_ctx(tfm);
-
- *mctx = 0;
-}
-
-static void crc32_digest_update(struct crypto_tfm *tfm, const u8 *data,
- unsigned int len)
-{
- u32 *crcp = crypto_tfm_ctx(tfm);
-
- *crcp = crc32_pclmul_le(*crcp, data, len);
-}
-
-static void crc32_digest_final(struct crypto_tfm *tfm, u8 *out)
-{
- u32 *crcp = crypto_tfm_ctx(tfm);
-
- *(__le32 *)out = cpu_to_le32p(crcp);
-}
-
-static struct crypto_alg alg = {
- .cra_name = "crc32",
- .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
- .cra_driver_name = "crc32-pclmul",
- .cra_priority = 200,
- .cra_blocksize = CHKSUM_BLOCK_SIZE,
- .cra_ctxsize = sizeof(u32),
- .cra_module = THIS_MODULE,
- .cra_init = crc32_pclmul_cra_init,
- .cra_list = LIST_HEAD_INIT(alg.cra_list),
- .cra_u = {
- .digest = {
- .dia_digestsize = CHKSUM_DIGEST_SIZE,
- .dia_setkey = crc32_digest_setkey,
- .dia_init = crc32_digest_init,
- .dia_update = crc32_digest_update,
- .dia_final = crc32_digest_final
- }
- }
-};
-#endif /* HAVE_STRUCT_SHASH_ALG */
#ifndef X86_FEATURE_PCLMULQDQ
#define X86_FEATURE_PCLMULQDQ (4 * 32 + 1) /* PCLMULQDQ instruction */
"detected.\n");
return -ENODEV;
}
-#ifdef HAVE_STRUCT_SHASH_ALG
return crypto_register_shash(&alg);
-#else
- return crypto_register_alg(&alg);
-#endif
}
void cfs_crypto_crc32_pclmul_unregister(void)
{
-#ifdef HAVE_STRUCT_SHASH_ALG
crypto_unregister_shash(&alg);
-#else
- crypto_unregister_alg(&alg);
-#endif
}
*/
static int cfs_crypto_hash_speeds[CFS_HASH_ALG_MAX];
-
-#ifndef HAVE_STRUCT_HASH_DESC
-/** 2.6.18 kernel have no crypto_hash function
- * this part was copied from lustre_compat25.h */
-#define crypto_hash crypto_tfm
-struct hash_desc {
- struct crypto_hash *tfm;
- unsigned int flags;
-};
-
-static inline
-struct crypto_hash *crypto_alloc_hash(const char *alg, unsigned int type,
- unsigned int mask)
-{
- return crypto_alloc_tfm(alg, 0);
-}
-
-static inline void crypto_free_hash(struct crypto_hash *tfm)
-{
- crypto_free_tfm(tfm);
-}
-
-static inline int crypto_hash_init(struct hash_desc *desc)
-{
- crypto_digest_init(desc->tfm);
- return 0;
-}
-
-static inline int crypto_hash_update(struct hash_desc *desc,
- struct scatterlist *sg,
- unsigned int nbytes)
-{
- if (desc->tfm->crt_digest.dit_update == NULL)
- return -1;
-
- LASSERT(nbytes == sg->length);
- crypto_digest_update(desc->tfm, sg, 1);
-
- return 0;
-}
-
-static inline int crypto_hash_digest(struct hash_desc *desc,
- struct scatterlist *sg,
- unsigned int nbytes, unsigned char *out)
-{
- crypto_hash_update(desc, sg, nbytes);
- crypto_digest_final(desc->tfm, out);
- return 0;
-}
-
-static inline int crypto_hash_final(struct hash_desc *desc, unsigned char *out)
-{
- crypto_digest_final(desc->tfm, out);
- return 0;
-}
-
-static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
-{
- return tfm;
-}
-
-#define crypto_hash_setkey(tfm, key, keylen) \
- crypto_digest_setkey(tfm, key, keylen)
-#define crypto_hash_digestsize(tfm) crypto_tfm_alg_digestsize(tfm)
-#define crypto_hash_blocksize(tfm) crypto_tfm_alg_blocksize(tfm)
-#endif
-
static int cfs_crypto_hash_alloc(unsigned char alg_id,
const struct cfs_crypto_hash_type **type,
struct hash_desc *desc, unsigned char *key,
desc->flags = 0;
- /** Shash have different logic for initialization then digest
- * shash: crypto_hash_setkey, crypto_hash_init
- * digest: crypto_digest_init, crypto_digest_setkey
- * Skip this function for digest, because we use shash logic at
- * cfs_crypto_hash_alloc.
- */
-#ifndef HAVE_STRUCT_SHASH_ALG
- crypto_hash_init(desc);
-#endif
if (key != NULL) {
err = crypto_hash_setkey(desc->tfm, key, key_len);
} else if ((*type)->cht_key != 0) {
(crypto_hash_tfm(desc->tfm))->__crt_alg->cra_driver_name,
cfs_crypto_hash_speeds[alg_id]);
-#ifdef HAVE_STRUCT_SHASH_ALG
return crypto_hash_init(desc);
-#else
- return 0;
-#endif
}
int cfs_crypto_hash_digest(unsigned char alg_id,
static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
void *buf, int len, int write)
{
-#ifdef HAVE_ACCESS_PROCESS_VM
- return access_process_vm(tsk, addr, buf, len, write);
-#else
/* Just copied from kernel for the kernels which doesn't
* have access_process_vm() exported */
struct mm_struct *mm;
mmput(mm);
return buf - old_buf;
-#endif /* HAVE_ACCESS_PROCESS_VM */
}
/* Read the environment variable of current process specified by @key. */
lcw_dump(struct lc_watchdog *lcw)
{
ENTRY;
-#if defined(HAVE_TASKLIST_LOCK)
- read_lock(&tasklist_lock);
-#else
rcu_read_lock();
-#endif
if (lcw->lcw_task == NULL) {
LCONSOLE_WARN("Process " LPPID " was not found in the task "
"list; watchdog callback may be incomplete\n",
libcfs_debug_dumpstack(lcw->lcw_task);
}
-#if defined(HAVE_TASKLIST_LOCK)
- read_unlock(&tasklist_lock);
-#else
rcu_read_unlock();
-#endif
EXIT;
}
[kernel export delete_from_page_cache])])
])
-AC_DEFUN([LC_EXPORT_D_REHASH_COND],
-[LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
-[fs/dcache.c],[
-AC_DEFINE(HAVE_D_REHASH_COND, 1,
- [d_rehash_cond is exported by the kernel])
-],[
-])
-])
-
-AC_DEFUN([LC_EXPORT___D_REHASH],
-[LB_CHECK_SYMBOL_EXPORT([__d_rehash],
-[fs/dcache.c],[
-AC_DEFINE(HAVE___D_REHASH, 1,
- [__d_rehash is exported by the kernel])
-],[
-])
-])
-
# The actual symbol exported varies among architectures, so we need
# to check many symbols (but only in the current architecture.) No
# matter what symbol is exported, the kernel #defines node_to_cpumask
])
#
-#
-# between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
-#
-AC_DEFUN([LC_FILEMAP_POPULATE],
-[AC_MSG_CHECKING([for exported filemap_populate])
-LB_LINUX_TRY_COMPILE([
- #include <asm/page.h>
- #include <linux/mm.h>
-],[
- filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
# added in 2.6.17
#
AC_DEFUN([LC_BIT_SPINLOCK_H],
fi
])
-AC_DEFUN([LC_TASK_CLENV_STORE],
-[
- AC_MSG_CHECKING([if we can store cl_env in task_struct])
- if test x$have_task_clenv_store != xyes ; then
- LC_TASK_CLENV_TUX_INFO
- fi
-])
-
# 2.6.12
# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
EXTRA_KCFLAGS="$tmp_flags"
])
-# 2.6.18
-
-# LC_UMOUNTBEGIN_HAS_VFSMOUNT
-# 2.6.18~2.6.25 umount_begin has different parameters
-AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
-[AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-
- struct vfsmount;
- static void cfg_umount_begin (struct vfsmount *v, int flags)
- {
- ;
- }
-
- static struct super_operations cfg_super_operations = {
- .umount_begin = cfg_umount_begin,
- };
-],[
- cfg_super_operations.umount_begin(NULL,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
- [Define umount_begin need second argument])
-],[
- AC_MSG_RESULT(no)
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
#2.6.18 + RHEL5 (fc6)
#
])
])
-# 2.6.20
-
-# LC_CANCEL_DIRTY_PAGE
-# 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
-AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
- [AC_MSG_CHECKING([kernel has cancel_dirty_page])
- # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
- # backport is broken, so ignore it
- if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
- test "$(sed -ne '/^static inline void cancel_dirty_page(struct page \*page, unsigned int account_size)$/,/^}$/p' $OFED_BACKPORT_PATH/linux/mm.h | md5sum)" = "c518cb32d6394760c5bca14cb7538d3e -"; then
- AC_MSG_RESULT(no)
- else
- LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-],[
- cancel_dirty_page(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
- [kernel has cancel_dirty_page instead of clear_page_dirty])
-],[
- AC_MSG_RESULT(no)
-])
- fi
-])
-
# raid5-zerocopy patch
#
])
#
-# check for crypto API
-#
-AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
-[AC_MSG_CHECKING([if kernel has block cipher support])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct crypto_blkcipher *tfm;
- tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for struct hash_desc
-#
-AC_DEFUN([LC_STRUCT_HASH_DESC],
-[AC_MSG_CHECKING([if kernel has struct hash_desc])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct hash_desc foo __attribute__ ((unused));
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for struct blkcipher_desc
-#
-AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
-[AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct blkcipher_desc foo __attribute__ ((unused));
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
# 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
#
AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
])
])
-# 2.6.23 change .sendfile to .splice_read
-AC_DEFUN([LC_KERNEL_SPLICE_READ],
-[AC_MSG_CHECKING([if kernel has .splice_read])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations file;
-
- file.splice_read = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
- [kernel has .slice_read])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 change .sendfile to .splice_read
-# RHEL4 (-92 kernel) have both sendfile and .splice_read API
-AC_DEFUN([LC_KERNEL_SENDFILE],
-[AC_MSG_CHECKING([if kernel has .sendfile])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations file;
-
- file.sendfile = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
- [kernel has .sendfile])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 extract nfs export related data into exportfs.h
-AC_DEFUN([LC_HAVE_EXPORTFS_H],
-[LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
- AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
- [kernel has include/exportfs.h])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 has new page fault handling API
-AC_DEFUN([LC_VM_OP_FAULT],
-[AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- struct vm_operations_struct op;
-
- op.fault = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_VM_OP_FAULT, 1,
- [kernel has .fault in vm_operation_struct])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.23 add code to wait other users to complete before removing procfs entry
AC_DEFUN([LC_PROCFS_USERS],
[AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
])
])
-# 2.6.23 exports exportfs_decode_fh
-AC_DEFUN([LC_EXPORTFS_DECODE_FH],
-[LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
-[fs/exportfs/expfs.c],[
- AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
- [exportfs_decode_fh has been export])
-],[
-])
-])
-
# 2.6.24
-# 2.6.24 need linux/mm_types.h included
-AC_DEFUN([LC_HAVE_MMTYPES_H],
-[LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
- AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
- [kernel has include/mm_types.h])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.24 has bio_endio with 2 args
AC_DEFUN([LC_BIO_ENDIO_2ARG],
[AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
])
])
-# 2.6.24 has new members in exports struct.
-AC_DEFUN([LC_FH_TO_DENTRY],
-[AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-#ifdef HAVE_LINUX_EXPORTFS_H
- #include <linux/exportfs.h>
-#endif
-],[
- do{ }while(sizeof(((struct export_operations *)0)->fh_to_dentry));
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
- [kernel has .fh_to_dentry member in export_operations struct])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.24 removes long aged procfs entry -> deleted member
AC_DEFUN([LC_PROCFS_DELETED],
[AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
])
])
-# 2.6.24 has bdi_init()/bdi_destroy() functions.
-AC_DEFUN([LC_EXPORT_BDI_INIT],
-[LB_CHECK_SYMBOL_EXPORT([bdi_init],
-[mm/backing-dev.c],[
- AC_DEFINE(HAVE_BDI_INIT, 1,
- [bdi_init/bdi_destroy functions are present])
-],[
-])
-])
-
# 2.6.26
# 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
])
])
-AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
-[AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
- [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-AC_DEFUN([LC_PGMKWRITE_COMPACT],
-[AC_MSG_CHECKING([if kernel .page_mkwrite is located in vm_operation_struct._pmkw])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- struct vm_operations_struct *vm_ops;
-
- vm_ops = NULL;
- vm_ops->_pmkw.page_mkwrite(NULL, NULL);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PGMKWRITE_COMPACT, 1,
- [kernel .page_mkwrite is located in vm_operation_struct._pmkw])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
AC_DEFUN([LC_INODE_PERMISION_2ARGS],
[AC_MSG_CHECKING([inode_operations->permission has two args])
LB_LINUX_TRY_COMPILE([
])
])
-# 2.6.27 have new page locking API
-AC_DEFUN([LC_TRYLOCKPAGE],
-[AC_MSG_CHECKING([kernel uses trylock_page for page lock])
-LB_LINUX_TRY_COMPILE([
- #include <linux/pagemap.h>
-],[
- trylock_page(NULL);
-],[
- AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
- [kernel uses trylock_page for page lock])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 removed the read_inode from super_operations.
-AC_DEFUN([LC_READ_INODE_IN_SBOPS],
-[AC_MSG_CHECKING([super_operations has a read_inode field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct super_operations *sop;
- sop->read_inode(NULL);
-],[
- AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
- [super_operations has a read_inode])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 has inode_permission instead of permisson
-AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
-[LB_CHECK_SYMBOL_EXPORT([inode_permission],
-[fs/namei.c],[
-AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
- [inode_permission is exported by the kernel])
-],[
-])
-])
-
# 2.6.27 use 5th parameter in quota_on for remount.
AC_DEFUN([LC_QUOTA_ON_5ARGS],
[AC_MSG_CHECKING([quota_on needs 5 parameters])
])
])
-# 2.6.27 has vfs_dq_off inline function.
-AC_DEFUN([LC_VFS_DQ_OFF],
-[AC_MSG_CHECKING([vfs_dq_off is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/quotaops.h>
-],[
- vfs_dq_off(NULL, 0);
-],[
- AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA],
tmp_flags="$EXTRA_KCFLAGS"
])
])
-# 2.6.27 sles11 has sb_any_quota_active
-AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
-[AC_MSG_CHECKING([Kernel has sb_any_quota_active])
-LB_LINUX_TRY_COMPILE([
- #include <linux/quotaops.h>
-],[
- sb_any_quota_active(NULL);
-],[
- AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
- [Kernel has a sb_any_quota_active])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 sles11 has sb_has_quota_active
-AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
-[AC_MSG_CHECKING([Kernel has sb_has_quota_active])
-LB_LINUX_TRY_COMPILE([
- #include <linux/quotaops.h>
-],[
- sb_has_quota_active(NULL, 0);
-],[
- AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
- [Kernel has a sb_has_quota_active])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 exported add_to_page_cache_lru.
-AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
-[LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
-[mm/filemap.c],[
- AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
- [add_to_page_cache_lru functions are present])
-],[
-])
-])
-
-#
-# 2.6.29 introduce sb_any_quota_loaded.
-#
-AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
-[AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
-LB_LINUX_TRY_COMPILE([
- #include <linux/quotaops.h>
-],[
- sb_any_quota_loaded(NULL);
-],[
- AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
- [Kernel has a sb_any_quota_loaded])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
[LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
])
-# 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
-AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
-[AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/blkdev.h>
-],[
- blk_queue_logical_block_size(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
- [blk_queue_logical_block_size is defined])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
# 2.6.32
-# 2.6.32 introduced inode_newsize_ok
-AC_DEFUN([LC_VFS_INODE_NEWSIZE_OK],
-[AC_MSG_CHECKING([if inode_newsize_ok is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- return inode_newsize_ok(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_VFS_INODE_NEWSIZE_OK, 1,
- [inode_newsize_ok is defined])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.32 changes cache_detail's member cache_request to cache_upcall
-# in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
-AC_DEFUN([LC_CACHE_UPCALL],
-[AC_MSG_CHECKING([if cache_detail has cache_upcall field])
- LB_LINUX_TRY_COMPILE([
- #include <linux/sunrpc/cache.h>
- ],[
- struct cache_detail cd;
- cd.cache_upcall = NULL;
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CACHE_UPCALL, 1,
- [cache_detail has cache_upcall field])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
-
-# 2.6.32 add a limits member in struct request_queue.
-AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
-[AC_MSG_CHECKING([if request_queue has a limits field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/blkdev.h>
-],[
- struct request_queue rq;
- rq.limits.io_min = 0;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
- [request_queue has a limits field])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.32 has bdi_register() functions.
-AC_DEFUN([LC_EXPORT_BDI_REGISTER],
-[LB_CHECK_SYMBOL_EXPORT([bdi_register],
-[mm/backing-dev.c],[
- AC_DEFINE(HAVE_BDI_REGISTER, 1,
- [bdi_register function is present])
-],[
-])
-])
-
-# 2.6.32 add s_bdi for super block
-AC_DEFUN([LC_SB_BDI],
-[AC_MSG_CHECKING([if super_block has s_bdi field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct super_block sb;
- sb.s_bdi = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SB_BDI, 1,
- [super_block has s_bdi field])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
-AC_DEFUN([LC_BDI_NAME],
-[AC_MSG_CHECKING([if backing_device_info has name field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/blkdev.h>
-],[
- struct backing_dev_info bdi;
- bdi.name = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_BDI_NAME, 1,
- [backing_device_info has name field])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
-# check blk_queue_max_sectors and use it until disappear.
-AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
-[AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/blkdev.h>
-],[
- blk_queue_max_sectors(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
- [blk_queue_max_sectors is defined])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
# 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
[AC_MSG_CHECKING([if blk_queue_max_segments is defined])
LB_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <linux/fs.h>
- #ifdef HAVE_QUOTAIO_H
- # include <linux/quotaio_v2.h>
- int versions[] = V2_INITQVERSIONS_R1;
- struct v2_disk_dqblk_r1 dqblk_r1;
- #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
+ #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
# include <quota/quotaio_v2.h>
struct v2r1_disk_dqblk dqblk_r1;
- #elif defined(HAVE_FS_QUOTAIO_H)
- # include <quotaio_v2.h>
- struct v2r1_disk_dqblk dqblk_r1;
#else
#include <linux/quota.h>
int ver = QFMT_VFS_V1;
[set_cpus_allowed is exported by the kernel])],
[AC_MSG_RESULT([no])] )])
-# 2.6.32 introduces selinux_is_enabled()
-AC_DEFUN([LC_SELINUX_IS_ENABLED],
-[AC_MSG_CHECKING([if selinux_is_enabled is available])
-LB_LINUX_TRY_COMPILE([
- #include <linux/selinux.h>
-],[
- selinux_is_enabled();
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_SELINUX_IS_ENABLED, 1,
- [selinux_is_enabled is defined])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_D_OBTAIN_ALIAS
-# starting from 2.6.28 kernel replaces d_alloc_anon() with
-# d_obtain_alias() for getting anonymous dentries
-# RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
-#
-AC_DEFUN([LC_D_OBTAIN_ALIAS],
-[AC_MSG_CHECKING([d_obtain_alias exist in kernel])
-LB_LINUX_TRY_COMPILE([
- #include <linux/dcache.h>
-],[
- d_obtain_alias(NULL);
-],[
- AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
- [d_obtain_alias exist in kernel])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
-#
-AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
- [LB_CHECK_SYMBOL_EXPORT(
- [generic_error_remove_page],
- [mm/truncate.c],
- [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
- [kernel export generic_error_remove_page])],
- [])
- ]
-)
-
-# 2.6.32 if kernel export access_process_vm().
-AC_DEFUN([LC_EXPORT_ACCESS_PROCESS_VM],
- [LB_CHECK_SYMBOL_EXPORT([access_process_vm],
- [mm/memory.c],
- [AC_DEFINE(HAVE_ACCESS_PROCESS_VM, 1,
- [access_process_vm function is present])],
- [])
- ]
-)
-
#
# 2.6.36 fs_struct.lock use spinlock instead of rwlock.
#
# RHEL4 patches
LC_EXPORT_TRUNCATE_COMPLETE
- LC_EXPORT_D_REHASH_COND
- LC_EXPORT___D_REHASH
LC_EXPORT_NODE_TO_CPUMASK
- LC_FILEMAP_POPULATE
LC_BIT_SPINLOCK_H
LC_CAPA_CRYPTO
LC_CONFIG_RMTCLIENT
LC_CONFIG_GSS
- LC_TASK_CLENV_STORE
# 2.6.12
LC_RW_TREE_LOCK
- # 2.6.18
- LC_UMOUNTBEGIN_HAS_VFSMOUNT
-
#2.6.18 + RHEL5 (fc6)
LC_LINUX_FIEMAP_H
LC_FILE_WRITEV
LC_FILE_READV
- # 2.6.20
- LC_CANCEL_DIRTY_PAGE
-
# raid5-zerocopy patch
LC_PAGE_CONSTANT
# 2.6.22
LC_INVALIDATE_BDEV_2ARG
- LC_ASYNC_BLOCK_CIPHER
- LC_STRUCT_HASH_DESC
- LC_STRUCT_BLKCIPHER_DESC
LC_FS_RENAME_DOES_D_MOVE
# 2.6.23
LC_UNREGISTER_BLKDEV_RETURN_INT
- LC_KERNEL_SPLICE_READ
- LC_KERNEL_SENDFILE
- LC_HAVE_EXPORTFS_H
- LC_VM_OP_FAULT
LC_PROCFS_USERS
- LC_EXPORTFS_DECODE_FH
# 2.6.24
- LC_HAVE_MMTYPES_H
LC_BIO_ENDIO_2ARG
- LC_FH_TO_DENTRY
LC_PROCFS_DELETED
- LC_EXPORT_BDI_INIT
# 2.6.26
LC_FS_STRUCT_USE_PATH
# 2.6.27
LC_SECURITY_PLUG # for SLES10 SP2
- LC_PGMKWRITE_USE_VMFAULT
- LC_PGMKWRITE_COMPACT
LC_INODE_PERMISION_2ARGS
- LC_TRYLOCKPAGE
- LC_READ_INODE_IN_SBOPS
- LC_EXPORT_INODE_PERMISSION
LC_QUOTA_ON_5ARGS
LC_QUOTA_OFF_3ARGS
- LC_VFS_DQ_OFF
LC_LOCK_MAP_ACQUIRE
# 2.6.27.15-2 sles11
LC_BI_HW_SEGMENTS
LC_HAVE_QUOTAIO_H
- LC_BDI_NAME
- LC_SB_ANY_QUOTA_ACTIVE
- LC_SB_HAS_QUOTA_ACTIVE
- LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
-
- # 2.6.29
- LC_SB_ANY_QUOTA_LOADED
# 2.6.30
LC_EXPORT_CPUMASK_OF_NODE
- # 2.6.31
- LC_BLK_QUEUE_LOG_BLK_SIZE
-
# 2.6.32
- LC_REQUEST_QUEUE_LIMITS
- LC_EXPORT_BDI_REGISTER
- LC_SB_BDI
- LC_BLK_QUEUE_MAX_SECTORS
LC_BLK_QUEUE_MAX_SEGMENTS
LC_SET_CPUS_ALLOWED
- LC_CACHE_UPCALL
- LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
- LC_SELINUX_IS_ENABLED
- LC_EXPORT_ACCESS_PROCESS_VM
- LC_VFS_INODE_NEWSIZE_OK
# 2.6.34
LC_HAVE_DQUOT_FS_DISK_QUOTA
AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
fi
-# 2.6.29 change prepare/commit_write to write_begin/end
-AC_DEFUN([LC_WRITE_BEGIN_END],
-[AC_MSG_CHECKING([if kernel has .write_begin/end])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
- #include <linux/pagemap.h>
-#ifdef HAVE_LINUX_MMTYPES_H
- #include <linux/mm_types.h>
-#endif
-],[
- struct address_space_operations aops;
- struct page *page;
-
- aops.write_begin = NULL;
- aops.write_end = NULL;
- page = grab_cache_page_write_begin(NULL, 0, 0);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
- [kernel has .write_begin/end])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
# 2.6.29 blkdev_put has 2 arguments
AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
[AC_MSG_CHECKING([blkdev_put needs 2 parameters])
])
])
-# 2.6.29 dentry_open has 4 arguments
-AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
-[AC_MSG_CHECKING([dentry_open needs 4 parameters])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- dentry_open(NULL, NULL, 0, NULL);
-],[
- AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
- [dentry_open needs 4 paramters])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.29 split file and anonymous page queues
-AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
-[AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/pagevec.h>
-],[
- struct pagevec lru_pagevec;
-
- pagevec_init(&lru_pagevec, 0);
- pagevec_lru_add_file(&lru_pagevec);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
- [kernel has .pagevec_lru_add_file])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
#
# --enable-mpitest
#
fi
])
-# RHEL5(2.6.18) has tux_info
-AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
-[AC_MSG_CHECKING([tux_info])
-LB_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
-],[
- struct task_struct task;
- &task.tux_info;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
- have_task_clenv_store='yes'
-],[
- AC_MSG_RESULT([no])
-])
-])
-
#
# LC_LLITE_LLOOP_MODULE
# lloop_llite.ko does not currently work with page sizes
fi
#2.6.29
- LC_WRITE_BEGIN_END
- LC_D_OBTAIN_ALIAS
LC_BLKDEV_PUT_2ARGS
- LC_DENTRY_OPEN_4ARGS
- LC_PAGEVEC_LRU_ADD_FILE
])
#define module_init(a) late_initcall(a)
#endif
-#ifndef HAVE_TRYLOCK_PAGE
-#define trylock_page(page) (!TestSetPageLocked(page))
-#endif
-
#define LTIME_S(time) (time.tv_sec)
-#ifdef HAVE_EXPORT_INODE_PERMISSION
-#define ll_permission(inode,mask,nd) inode_permission(inode,mask)
-#else
-#define ll_permission(inode,mask,nd) permission(inode,mask,nd)
-#endif
-
#ifdef HAVE_GENERIC_PERMISSION_2ARGS
# define ll_generic_permission(inode, mask, flags, check_acl) \
generic_permission(inode, mask)
{
mntget(path->mnt);
dget(path->dentry);
-# ifdef HAVE_DENTRY_OPEN_4ARGS
return dentry_open(path->dentry, path->mnt, flags, cred);
-# else
- return dentry_open(path->dentry, path->mnt, flags);
-# endif
}
#endif
#define FS_RENAME_DOES_D_MOVE FS_ODD_RENAME
#endif
-#ifndef HAVE_D_OBTAIN_ALIAS
-/* The old d_alloc_anon() didn't free the inode reference on error
- * like d_obtain_alias(). Hide that difference/inconvenience here. */
-static inline struct dentry *d_obtain_alias(struct inode *inode)
-{
- struct dentry *anon = d_alloc_anon(inode);
-
- if (anon == NULL) {
- iput(inode);
- anon = ERR_PTR(-ENOMEM);
- }
-
- return anon;
-}
-#endif
-
/* add a lustre compatible layer for crypto API */
#include <linux/crypto.h>
-#ifdef HAVE_ASYNC_BLOCK_CIPHER
#define ll_crypto_hash crypto_hash
#define ll_crypto_cipher crypto_blkcipher
#define ll_crypto_alloc_hash(name, type, mask) crypto_alloc_hash(name, type, mask)
#define ll_crypto_blkcipher_blocksize(tfm) crypto_blkcipher_blocksize(tfm)
#define ll_crypto_free_hash(tfm) crypto_free_hash(tfm)
#define ll_crypto_free_blkcipher(tfm) crypto_free_blkcipher(tfm)
-#else /* HAVE_ASYNC_BLOCK_CIPHER */
-#include <linux/scatterlist.h>
-#define ll_crypto_hash crypto_tfm
-#define ll_crypto_cipher crypto_tfm
-#ifndef HAVE_STRUCT_HASH_DESC
-struct hash_desc {
- struct ll_crypto_hash *tfm;
- u32 flags;
-};
-#endif
-#ifndef HAVE_STRUCT_BLKCIPHER_DESC
-struct blkcipher_desc {
- struct ll_crypto_cipher *tfm;
- void *info;
- u32 flags;
-};
-#endif
-#define ll_crypto_blkcipher_setkey(tfm, key, keylen) \
- crypto_cipher_setkey(tfm, key, keylen)
-#define ll_crypto_blkcipher_set_iv(tfm, src, len) \
- crypto_cipher_set_iv(tfm, src, len)
-#define ll_crypto_blkcipher_get_iv(tfm, dst, len) \
- crypto_cipher_get_iv(tfm, dst, len)
-#define ll_crypto_blkcipher_encrypt(desc, dst, src, bytes) \
- crypto_cipher_encrypt((desc)->tfm, dst, src, bytes)
-#define ll_crypto_blkcipher_decrypt(desc, dst, src, bytes) \
- crypto_cipher_decrypt((desc)->tfm, dst, src, bytes)
-#define ll_crypto_blkcipher_decrypt_iv(desc, dst, src, bytes) \
- crypto_cipher_decrypt_iv((desc)->tfm, dst, src, bytes, (desc)->info)
-#define ll_crypto_blkcipher_encrypt_iv(desc, dst, src, bytes) \
- crypto_cipher_encrypt_iv((desc)->tfm, dst, src, bytes, (desc)->info)
-
-static inline
-struct ll_crypto_cipher *ll_crypto_alloc_blkcipher(const char * algname,
- u32 type, u32 mask)
-{
- struct ll_crypto_cipher *rtn;
- char buf[CRYPTO_MAX_ALG_NAME + 1];
- const char *pan = algname;
- u32 flag = 0;
-
- if (strncmp("cbc(", algname, 4) == 0)
- flag |= CRYPTO_TFM_MODE_CBC;
- else if (strncmp("ecb(", algname, 4) == 0)
- flag |= CRYPTO_TFM_MODE_ECB;
- if (flag) {
- char *vp = strnchr(algname, CRYPTO_MAX_ALG_NAME, ')');
- if (vp) {
- memcpy(buf, algname + 4, vp - algname - 4);
- buf[vp - algname - 4] = '\0';
- pan = buf;
- } else {
- flag = 0;
- }
- }
- rtn = crypto_alloc_tfm(pan, flag);
- return (rtn == NULL ? ERR_PTR(-ENOMEM) : rtn);
-}
-
-static inline
-struct ll_crypto_hash *ll_crypto_alloc_hash(const char *alg, u32 type, u32 mask)
-{
- char buf[CRYPTO_MAX_ALG_NAME + 1];
- const char *pan = alg;
-
- if (strncmp("hmac(", alg, 5) == 0) {
- char *vp = strnchr(alg, CRYPTO_MAX_ALG_NAME, ')');
- if (vp) {
- memcpy(buf, alg+ 5, vp - alg- 5);
- buf[vp - alg - 5] = 0x00;
- pan = buf;
- }
- }
- return crypto_alloc_tfm(pan, 0);
-}
-static inline int ll_crypto_hash_init(struct hash_desc *desc)
-{
- crypto_digest_init(desc->tfm); return 0;
-}
-static inline int ll_crypto_hash_update(struct hash_desc *desc,
- struct scatterlist *sg,
- unsigned int nbytes)
-{
- struct scatterlist *sl = sg;
- unsigned int count;
- /*
- * This way is very weakness. We must ensure that
- * the sum of sg[0..i]->length isn't greater than nbytes.
- * In the upstream kernel the crypto_hash_update() also
- * via the nbytes computed the count of sg[...].
- * The old style is more safely. but it gone.
- */
- for (count = 0; nbytes > 0; count ++, sl ++) {
- nbytes -= sl->length;
- }
- crypto_digest_update(desc->tfm, sg, count); return 0;
-}
-static inline int ll_crypto_hash_final(struct hash_desc *desc, u8 *out)
-{
- crypto_digest_final(desc->tfm, out); return 0;
-}
-static inline int ll_crypto_hmac(struct crypto_tfm *tfm,
- u8 *key, unsigned int *keylen,
- struct scatterlist *sg,
- unsigned int nbytes,
- u8 *out)
-{
- struct scatterlist *sl = sg;
- int count;
- for (count = 0; nbytes > 0; count ++, sl ++) {
- nbytes -= sl->length;
- }
- crypto_hmac(tfm, key, keylen, sg, count, out);
- return 0;
-}
-
-#define ll_crypto_hash_setkey(tfm, key, keylen) crypto_digest_setkey(tfm, key, keylen)
-#define ll_crypto_blkcipher_blocksize(tfm) crypto_tfm_alg_blocksize(tfm)
-#define ll_crypto_blkcipher_ivsize(tfm) crypto_tfm_alg_ivsize(tfm)
-#define ll_crypto_hash_digestsize(tfm) crypto_tfm_alg_digestsize(tfm)
-#define ll_crypto_hash_blocksize(tfm) crypto_tfm_alg_blocksize(tfm)
-#define ll_crypto_free_hash(tfm) crypto_free_tfm(tfm)
-#define ll_crypto_free_blkcipher(tfm) crypto_free_tfm(tfm)
-#define ll_crypto_tfm_alg_min_keysize crypto_tfm_alg_min_keysize
-#define ll_crypto_tfm_alg_max_keysize crypto_tfm_alg_max_keysize
-#endif /* HAVE_ASYNC_BLOCK_CIPHER */
#ifdef HAVE_SECURITY_PLUG
#define ll_vfs_rmdir(dir,entry,mnt) vfs_rmdir(dir,entry,mnt)
#define SLAB_DESTROY_BY_RCU 0
#endif
-#ifndef HAVE_SB_HAS_QUOTA_ACTIVE
-#define sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type)
-#endif
-
-#ifndef HAVE_SB_ANY_QUOTA_LOADED
-# ifdef HAVE_SB_ANY_QUOTA_ACTIVE
-# define sb_any_quota_loaded(sb) sb_any_quota_active(sb)
-# else
-# define sb_any_quota_loaded(sb) sb_any_quota_enabled(sb)
-# endif
-#endif
-
static inline int
ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
{
return -ENOSYS;
}
-#ifndef HAVE_BLK_QUEUE_LOG_BLK_SIZE /* added in 2.6.31 */
-#define blk_queue_logical_block_size(q, sz) blk_queue_hardsect_size(q, sz)
-#endif
-
#ifndef HAVE_DQUOT_SUSPEND
-#ifndef HAVE_VFS_DQ_OFF
-# define ll_vfs_dq_init DQUOT_INIT
-# define ll_vfs_dq_drop DQUOT_DROP
-# define ll_vfs_dq_transfer DQUOT_TRANSFER
-# define ll_vfs_dq_off(sb, remount) DQUOT_OFF(sb)
-#else
# define ll_vfs_dq_init vfs_dq_init
# define ll_vfs_dq_drop vfs_dq_drop
# define ll_vfs_dq_transfer vfs_dq_transfer
# define ll_vfs_dq_off(sb, remount) vfs_dq_off(sb, remount)
-#endif
#else
# define ll_vfs_dq_init dquot_initialize
# define ll_vfs_dq_drop dquot_drop
# define ll_vfs_dq_off(sb, remount) dquot_suspend(sb, -1)
#endif
-#ifndef HAVE_BDI_INIT
-#define bdi_init(bdi) 0
-#define bdi_destroy(bdi) do { } while (0)
-#endif
-
-#ifdef HAVE_BLK_QUEUE_MAX_SECTORS /* removed in rhel6 */
-#define blk_queue_max_hw_sectors(q, sect) blk_queue_max_sectors(q, sect)
-#endif
-
#ifndef HAVE_BLKDEV_GET_BY_DEV
# define blkdev_get_by_dev(dev, mode, holder) open_by_devnum(dev, mode)
#endif
-#ifndef HAVE_REQUEST_QUEUE_LIMITS
-#define queue_max_sectors(rq) ((rq)->max_sectors)
-#define queue_max_hw_sectors(rq) ((rq)->max_hw_sectors)
-#define queue_max_phys_segments(rq) ((rq)->max_phys_segments)
-#define queue_max_hw_segments(rq) ((rq)->max_hw_segments)
-#endif
-
#ifndef HAVE_BLK_QUEUE_MAX_SEGMENTS
#define blk_queue_max_segments(rq, seg) \
do { blk_queue_max_phys_segments(rq, seg); \
#define bio_hw_segments(q, bio) 0
#endif
-#ifndef HAVE_PAGEVEC_LRU_ADD_FILE
-#define pagevec_lru_add_file pagevec_lru_add
-#endif
-
-#ifdef HAVE_ADD_TO_PAGE_CACHE_LRU
-#define ll_pagevec_init(pv, cold) do {} while (0)
-#define ll_pagevec_add(pv, pg) (0)
-#define ll_pagevec_lru_add_file(pv) do {} while (0)
-#else
-#define add_to_page_cache_lru(pg, mapping, off, gfp) \
- add_to_page_cache(pg, mapping, off, gfp)
-#define ll_pagevec_init(pv, cold) pagevec_init(pv, cold);
-#define ll_pagevec_add(pv, pg) \
-({ \
- int __ret; \
- \
- page_cache_get(pg); \
- __ret = pagevec_add(pv, pg); \
-})
-#define ll_pagevec_lru_add_file(pv) pagevec_lru_add_file(pv)
-#endif
-
#if !defined(HAVE_CPUMASK_OF_NODE) && defined(HAVE_NODE_TO_CPUMASK)
# ifdef HAVE_OFED_CPUMASK_OF_NODE
# undef cpumask_of_node
# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET)
#endif
-#ifndef HAVE_SELINUX_IS_ENABLED
-static inline bool selinux_is_enabled(void)
-{
- return 0;
-}
-#endif
-
#ifndef HAVE_LM_XXX_LOCK_MANAGER_OPS
# define lm_compare_owner fl_compare_owner
#endif
#include <linux/mm.h>
#include <linux/hash.h>
-#ifndef HAVE_CANCEL_DIRTY_PAGE /* 2.6.20 */
-#define cancel_dirty_page(page, size) clear_page_dirty(page)
-#endif
-
#ifndef HAVE_DELETE_FROM_PAGE_CACHE /* 2.6.39 */
#ifndef HAVE_REMOVE_FROM_PAGE_CACHE /* 2.6.35 - 2.6.38 */
__u64 hash = *((__u64 *)_hash);
struct page **page_pool;
struct page *page;
-#ifndef HAVE_ADD_TO_PAGE_CACHE_LRU
- struct pagevec lru_pvec;
-#endif
struct lu_dirpage *dp;
int max_pages = ll_i2sbi(inode)->ll_md_brw_size >> PAGE_CACHE_SHIFT;
int nrdpgs = 0; /* number of pages read actually */
CDEBUG(D_VFSTRACE, "read %d/%d pages\n", nrdpgs, npages);
- ll_pagevec_init(&lru_pvec, 0);
for (i = 1; i < npages; i++) {
unsigned long offset;
int ret;
prefetchw(&page->flags);
ret = add_to_page_cache_lru(page, inode->i_mapping, offset,
GFP_KERNEL);
- if (ret == 0) {
+ if (ret == 0)
unlock_page(page);
- if (ll_pagevec_add(&lru_pvec, page) == 0)
- ll_pagevec_lru_add_file(&lru_pvec);
- } else {
+ else
CDEBUG(D_VFSTRACE, "page %lu add to page cache failed:"
" %d\n", offset, ret);
- }
page_cache_release(page);
}
- ll_pagevec_lru_add_file(&lru_pvec);
if (page_pool != &page0)
OBD_FREE(page_pool, sizeof(struct page *) * max_pages);
}
#endif
-
-#ifdef HAVE_KERNEL_SENDFILE
-/*
- * Send file content (through pagecache) somewhere with helper
- */
-static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
- read_actor_t actor, void *target)
-{
- struct lu_env *env;
- struct vvp_io_args *args;
- ssize_t result;
- int refcheck;
- ENTRY;
-
- env = cl_env_get(&refcheck);
- if (IS_ERR(env))
- RETURN(PTR_ERR(env));
-
- args = vvp_env_args(env, IO_SENDFILE);
- args->u.sendfile.via_target = target;
- args->u.sendfile.via_actor = actor;
-
- result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
- cl_env_put(env, &refcheck);
- RETURN(result);
-}
-#endif
-
-#ifdef HAVE_KERNEL_SPLICE_READ
/*
* Send file content (through pagecache) somewhere with helper
*/
cl_env_put(env, &refcheck);
RETURN(result);
}
-#endif
static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
obd_count ost_idx)
if (!S_ISREG(llss->inode2->i_mode))
GOTO(free, rc = -EINVAL);
- if (ll_permission(llss->inode1, MAY_WRITE, NULL) ||
- ll_permission(llss->inode2, MAY_WRITE, NULL))
+ if (inode_permission(llss->inode1, MAY_WRITE) ||
+ inode_permission(llss->inode2, MAY_WRITE))
GOTO(free, rc = -EPERM);
if (llss->inode2->i_sb != llss->inode1->i_sb)
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#ifdef HAVE_KERNEL_SENDFILE
- .sendfile = ll_file_sendfile,
-#endif
-#ifdef HAVE_KERNEL_SPLICE_READ
.splice_read = ll_file_splice_read,
-#endif
.fsync = ll_fsync,
.flush = ll_flush
};
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#ifdef HAVE_KERNEL_SENDFILE
- .sendfile = ll_file_sendfile,
-#endif
-#ifdef HAVE_KERNEL_SPLICE_READ
.splice_read = ll_file_splice_read,
-#endif
.fsync = ll_fsync,
.flush = ll_flush,
.flock = ll_file_flock,
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#ifdef HAVE_KERNEL_SENDFILE
- .sendfile = ll_file_sendfile,
-#endif
-#ifdef HAVE_KERNEL_SPLICE_READ
.splice_read = ll_file_splice_read,
-#endif
.fsync = ll_fsync,
.flush = ll_flush,
.flock = ll_file_noflock,
int ll_iocontrol(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
int ll_flush_ctx(struct inode *inode);
-#ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
-void ll_umount_begin(struct vfsmount *vfsmnt, int flags);
-#else
void ll_umount_begin(struct super_block *sb);
-#endif
int ll_remount_fs(struct super_block *sb, int *flags, char *data);
#ifdef HAVE_SUPEROPS_USE_DENTRY
int ll_show_options(struct seq_file *seq, struct dentry *dentry);
* locked page returned from vvp_io
*/
struct page *ft_vmpage;
-#ifndef HAVE_VM_OP_FAULT
- struct vm_nopage_api {
- /**
- * Virtual address at which fault occurred.
- */
- unsigned long ft_address;
- /**
- * Fault type, as to be supplied to
- * filemap_nopage().
- */
- int *ft_type;
- } nopage;
-#else
struct vm_fault_api {
/**
* kernel fault info
*/
unsigned int ft_flags;
} fault;
-#endif
} fault;
} u;
/**
static inline int ll_bdi_register(struct backing_dev_info *bdi)
{
-#ifdef HAVE_BDI_REGISTER
static atomic_t ll_bdi_num = ATOMIC_INIT(0);
-#ifdef HAVE_BDI_NAME
bdi->name = "lustre";
-#endif
return bdi_register(bdi, NULL, "lustre-%d",
atomic_inc_return(&ll_bdi_num));
-#else
- return 0;
-#endif
}
int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
if (err)
GOTO(out_free, err);
-#ifdef HAVE_SB_BDI
sb->s_bdi = &lsi->lsi_bdi;
-#endif
/* Generate a string unique to this super, in case some joker tries
to mount the same fs at two mount points.
return rc;
}
-#ifndef HAVE_VFS_INODE_NEWSIZE_OK
-/**
- * inode_newsize_ok - may this inode be truncated to a given size
- * @inode: the inode to be truncated
- * @offset: the new size to assign to the inode
- * @Returns: 0 on success, -ve errno on failure
- *
- * inode_newsize_ok will check filesystem limits and ulimits to check that the
- * new inode size is within limits. inode_newsize_ok will also send SIGXFSZ
- * when necessary. Caller must not proceed with inode size change if failure is
- * returned. @inode must be a file (not directory), with appropriate
- * permissions to allow truncate (inode_newsize_ok does NOT check these
- * conditions).
- *
- * inode_newsize_ok must be called with i_mutex held.
- */
-int inode_newsize_ok(const struct inode *inode, loff_t offset)
-{
- if (inode->i_size < offset) {
- unsigned long limit;
-
- limit = rlimit(RLIMIT_FSIZE);
- if (limit != RLIM_INFINITY && offset > limit)
- goto out_sig;
- if (offset > inode->i_sb->s_maxbytes)
- goto out_big;
- } else {
- /*
- * truncation of in-use swapfiles is disallowed - it would
- * cause subsequent swapout to scribble on the now-freed
- * blocks.
- */
- if (IS_SWAPFILE(inode))
- return -ETXTBSY;
- }
-
- return 0;
-out_sig:
- send_sig(SIGXFSZ, current, 0);
-out_big:
- return -EFBIG;
-}
-#endif
-
/* If this inode has objects allocated to it (lsm != NULL), then the OST
* object(s) determine the file size and mtime. Otherwise, the MDS will
* keep these values until such a time that objects are allocated for it.
}
/* umount -f client means force down, don't save state */
-#ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
-void ll_umount_begin(struct vfsmount *vfsmnt, int flags)
-{
- struct super_block *sb = vfsmnt->mnt_sb;
-#else
void ll_umount_begin(struct super_block *sb)
{
-#endif
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd;
struct obd_ioctl_data *ioc_data;
ENTRY;
-#ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
- if (!(flags & MNT_FORCE)) {
- EXIT;
- return;
- }
-#endif
-
CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
sb->s_count, atomic_read(&sb->s_active));
* schedule() and sleep one second if needed, and hope.
*/
cfs_schedule();
-#ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
- if (atomic_read(&vfsmnt->mnt_count) > 2) {
- cfs_schedule_timeout_and_set_state(CFS_TASK_INTERRUPTIBLE,
- cfs_time_seconds(1));
- if (atomic_read(&vfsmnt->mnt_count) > 2)
- LCONSOLE_WARN("Mount still busy with %d refs! You "
- "may try to umount it a bit later\n",
- atomic_read(&vfsmnt->mnt_count));
- }
-#endif
-
EXIT;
}
return result;
}
-
-#ifndef HAVE_VM_OP_FAULT
-/**
- * Lustre implementation of a vm_operations_struct::nopage() method, called by
- * VM to server page fault (both in kernel and user space).
- *
- * This function sets up CIT_FAULT cl_io that does the job.
- *
- * \param vma - is virtiual area struct related to page fault
- * \param address - address when hit fault
- * \param type - of fault
- *
- * \return allocated and filled _unlocked_ page for address
- * \retval NOPAGE_SIGBUS if page not exist on this address
- * \retval NOPAGE_OOM not have memory for allocate new page
- */
-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
- int *type)
-{
- struct lu_env *env;
- struct cl_env_nest nest;
- struct cl_io *io;
- struct page *page = NOPAGE_SIGBUS;
- struct vvp_io *vio = NULL;
- unsigned long ra_flags;
- pgoff_t pg_offset;
- int result;
- const unsigned long writable = VM_SHARED|VM_WRITE;
- cfs_sigset_t set;
- ENTRY;
-
- pg_offset = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
- io = ll_fault_io_init(vma, &env, &nest, pg_offset, &ra_flags);
- if (IS_ERR(io))
- return NOPAGE_SIGBUS;
-
- result = io->ci_result;
- if (result < 0)
- goto out_err;
-
- io->u.ci_fault.ft_writable = (vma->vm_flags&writable) == writable;
-
- vio = vvp_env_io(env);
- vio->u.fault.ft_vma = vma;
- vio->u.fault.nopage.ft_address = address;
- vio->u.fault.nopage.ft_type = type;
- vio->u.fault.ft_vmpage = NULL;
-
- set = cfs_block_sigsinv(sigmask(SIGKILL)|sigmask(SIGTERM));
- result = cl_io_loop(env, io);
- cfs_restore_sigs(set);
-
- page = vio->u.fault.ft_vmpage;
- if (result != 0 && page != NULL) {
- page_cache_release(page);
- page = NOPAGE_SIGBUS;
- }
-
-out_err:
- if (result == -ENOMEM)
- page = NOPAGE_OOM;
-
- vma->vm_flags &= ~VM_RAND_READ;
- vma->vm_flags |= ra_flags;
-
- cl_io_fini(env, io);
- cl_env_nested_put(&nest, env);
-
- RETURN(page);
-}
-
-#else
-
static inline int to_fault_error(int result)
{
switch(result) {
cfs_restore_sigs(set);
return result;
}
-#endif
-
-#ifndef HAVE_PGMKWRITE_USE_VMFAULT
-static int ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage)
-{
- int count = 0;
- bool printed = false;
- bool retry;
- int result;
-
- do {
- retry = false;
- result = ll_page_mkwrite0(vma, vmpage, &retry);
-
- if (!printed && ++count > 16) {
- CWARN("app(%s): the page %lu of file %lu is under heavy"
- " contention.\n",
- current->comm, page_index(vmpage),
- vma->vm_file->f_dentry->d_inode->i_ino);
- printed = true;
- }
- } while (retry);
- if (result == 0)
- unlock_page(vmpage);
- else if (result == -ENODATA)
- result = 0; /* kernel will know truncate has happened and
- * retry */
-
- return result;
-}
-#else
static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
int count = 0;
return result;
}
-#endif
/**
* To avoid cancel the locks covering mmapped region for lock cache pressure,
EXIT;
}
-#ifndef HAVE_VM_OP_FAULT
-#ifndef HAVE_FILEMAP_POPULATE
-static int (*filemap_populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
-#endif
-static int ll_populate(struct vm_area_struct *area, unsigned long address,
- unsigned long len, pgprot_t prot, unsigned long pgoff,
- int nonblock)
-{
- int rc = 0;
- ENTRY;
-
- /* always set nonblock as true to avoid page read ahead */
- rc = filemap_populate(area, address, len, prot, pgoff, 1);
- RETURN(rc);
-}
-#endif
-
/* return the user space pointer that maps to a file offset via a vma */
static inline unsigned long file_to_user(struct vm_area_struct *vma, __u64 byte)
{
}
static struct vm_operations_struct ll_file_vm_ops = {
-#ifndef HAVE_VM_OP_FAULT
- .nopage = ll_nopage,
- .populate = ll_populate,
-#else
.fault = ll_fault,
-#endif
-#ifndef HAVE_PGMKWRITE_COMPACT
.page_mkwrite = ll_page_mkwrite,
-#else
- ._pmkw.page_mkwrite = ll_page_mkwrite,
-#endif
.open = ll_vm_open,
.close = ll_vm_close,
};
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_MAP, 1);
rc = generic_file_mmap(file, vma);
if (rc == 0) {
-#if !defined(HAVE_FILEMAP_POPULATE) && !defined(HAVE_VM_OP_FAULT)
- if (!filemap_populate)
- filemap_populate = vma->vm_ops->populate;
-#endif
vma->vm_ops = &ll_file_vm_ops;
vma->vm_ops->open(vma);
/* update the inode's size and mtime */
#define DEBUG_SUBSYSTEM S_LLITE
#include <lustre_lite.h>
#include "llite_internal.h"
-#ifdef HAVE_LINUX_EXPORTFS_H
#include <linux/exportfs.h>
-#endif
__u32 get_uuid2int(const char *name, int len)
{
return rc;
}
-#ifdef HAVE_FH_TO_DENTRY
static struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type)
{
RETURN(ll_iget_for_nfs(sb, &nfs_fid->lnf_parent, NULL));
}
-
-#else
-
-/*
- * This length is counted as amount of __u32,
- * It is composed of a fid and a mode
- */
-static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int fh_len,
- int fh_type,
- int (*acceptable)(void *, struct dentry *),
- void *context)
-{
- struct lustre_nfs_fid *nfs_fid = (void *)fh;
- struct dentry *entry;
- ENTRY;
-
- CDEBUG(D_INFO, "decoding for "DFID" fh_len=%d fh_type=%x\n",
- PFID(&nfs_fid->lnf_child), fh_len, fh_type);
-
- if (fh_type != LUSTRE_NFS_FID)
- RETURN(ERR_PTR(-EPROTO));
-
- entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->lnf_child,
- &nfs_fid->lnf_parent,
- acceptable, context);
- RETURN(entry);
-}
-
-static struct dentry *ll_get_dentry(struct super_block *sb, void *data)
-{
- struct dentry *entry;
- ENTRY;
-
- entry = ll_iget_for_nfs(sb, data, NULL);
- RETURN(entry);
-}
-#endif
static struct dentry *ll_get_parent(struct dentry *dchild)
{
struct ptlrpc_request *req = NULL;
.get_parent = ll_get_parent,
.encode_fh = ll_encode_fh,
.get_name = ll_get_name,
-#ifdef HAVE_FH_TO_DENTRY
.fh_to_dentry = ll_fh_to_dentry,
.fh_to_parent = ll_fh_to_parent,
-#else
- .get_dentry = ll_get_dentry,
- .decode_fh = ll_decode_fh,
-#endif
};
RETURN(tot_bytes ? : result);
}
-#if defined(HAVE_KERNEL_WRITE_BEGIN_END) || defined(MS_HAS_NEW_AOPS)
static int ll_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
return rc ?: copied;
}
-#endif
#ifdef CONFIG_MIGRATION
int ll_migratepage(struct address_space *mapping,
.writepage = ll_writepage,
.writepages = ll_writepages,
.set_page_dirty = ll_set_page_dirty,
-#ifdef HAVE_KERNEL_WRITE_BEGIN_END
.write_begin = ll_write_begin,
.write_end = ll_write_end,
-#else
- .prepare_write = ll_prepare_write,
- .commit_write = ll_commit_write,
-#endif
.invalidatepage = ll_invalidatepage,
.releasepage = (void *)ll_releasepage,
#ifdef CONFIG_MIGRATION
case IO_NORMAL:
result = lustre_generic_file_read(file, cio, &pos);
break;
-#ifdef HAVE_KERNEL_SENDFILE
- case IO_SENDFILE:
- result = generic_file_sendfile(file, &pos, cnt,
- vio->u.sendfile.cui_actor,
- vio->u.sendfile.cui_target);
- break;
-#endif
-#ifdef HAVE_KERNEL_SPLICE_READ
case IO_SPLICE:
result = generic_file_splice_read(file, &pos,
vio->u.splice.cui_pipe, cnt,
* buffers. */
io->ci_continue = 0;
break;
-#endif
default:
CERROR("Wrong IO type %u\n", vio->cui_io_subtype);
LBUG();
RETURN(result);
}
-#ifndef HAVE_VM_OP_FAULT
-static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
-{
- struct page *vmpage;
-
- vmpage = filemap_nopage(cfio->ft_vma, cfio->nopage.ft_address,
- cfio->nopage.ft_type);
-
- if (vmpage == NOPAGE_SIGBUS) {
- CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n",
- cfio->nopage.ft_address,(long)cfio->nopage.ft_type);
- return -EFAULT;
- } else if (vmpage == NOPAGE_OOM) {
- CDEBUG(D_PAGE, "got addr %lu type %lx - OOM\n",
- cfio->nopage.ft_address, (long)cfio->nopage.ft_type);
- return -ENOMEM;
- }
-
- LL_CDEBUG_PAGE(D_PAGE, vmpage, "got addr %lu type %lx\n",
- cfio->nopage.ft_address, (long)cfio->nopage.ft_type);
-
- cfio->ft_vmpage = vmpage;
- lock_page(vmpage);
-
- return 0;
-}
-#else
static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
{
struct vm_fault *vmf = cfio->fault.ft_vmf;
return -EINVAL;
}
-#endif
-
static int vvp_io_fault_start(const struct lu_env *env,
const struct cl_io_slice *ios)
{
/* return unlocked vmpage to avoid deadlocking */
if (vmpage != NULL)
unlock_page(vmpage);
-#ifdef HAVE_VM_OP_FAULT
cfio->fault.ft_flags &= ~VM_FAULT_LOCKED;
-#endif
return result;
}
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/mm.h>
-#ifdef HAVE_SELINUX_IS_ENABLED
#include <linux/selinux.h>
-#endif
#define DEBUG_SUBSYSTEM S_LLITE
#define ClearPageConstant(page) do {} while (0)
#endif
-#ifndef HAS_GENERIC_ERROR_REMOVE_PAGE
-int generic_error_remove_page(struct address_space *mapping, struct page *page)
-{
- if (mapping == NULL)
- return -EINVAL;
-
- if (mapping != page->mapping)
- return -EIO;
- /*
- * Only punch for normal data pages for now.
- * Handling other types like directories would need more auditing.
- */
- if (!S_ISREG(mapping->host->i_mode))
- return -EIO;
-
- if (page_mapped(page)) {
- unmap_mapping_range(mapping,
- (loff_t)page->index << PAGE_CACHE_SHIFT,
- PAGE_CACHE_SIZE, 0);
- }
- truncate_complete_page(mapping, page);
- return 0;
-}
-#endif
-
static int __osd_init_iobuf(struct osd_device *d, struct osd_iobuf *iobuf,
int rw, int line, int pages)
{
return(ret);
}
-#ifdef HAVE_ASYNC_BLOCK_CIPHER
-
static inline
int krb5_digest_hmac(struct ll_crypto_hash *tfm,
rawobj_t *key,
return ll_crypto_hash_final(&desc, cksum->data);
}
-#else /* ! HAVE_ASYNC_BLOCK_CIPHER */
-
-static inline
-int krb5_digest_hmac(struct ll_crypto_hash *tfm,
- rawobj_t *key,
- struct krb5_header *khdr,
- int msgcnt, rawobj_t *msgs,
- int iovcnt, lnet_kiov_t *iovs,
- rawobj_t *cksum)
-{
- struct scatterlist sg[1];
- __u32 keylen = key->len, i;
-
- crypto_hmac_init(tfm, key->data, &keylen);
-
- for (i = 0; i < msgcnt; i++) {
- if (msgs[i].len == 0)
- continue;
- buf_to_sg(sg, (char *) msgs[i].data, msgs[i].len);
- crypto_hmac_update(tfm, sg, 1);
- }
-
- for (i = 0; i < iovcnt; i++) {
- if (iovs[i].kiov_len == 0)
- continue;
-
- sg_set_page(&sg[0], iovs[i].kiov_page, iovs[i].kiov_len,
- iovs[i].kiov_offset);
- crypto_hmac_update(tfm, sg, 1);
- }
-
- if (khdr) {
- buf_to_sg(sg, (char *) khdr, sizeof(*khdr));
- crypto_hmac_update(tfm, sg, 1);
- }
-
- crypto_hmac_final(tfm, key->data, &keylen, cksum->data);
- return 0;
-}
-
-#endif /* HAVE_ASYNC_BLOCK_CIPHER */
-
static inline
int krb5_digest_norm(struct ll_crypto_hash *tfm,
struct krb5_keyblock *kb,
(*bpp)[-1] = '\n';
}
-#ifdef HAVE_CACHE_UPCALL
static int rsi_upcall(struct cache_detail *cd, struct cache_head *h)
{
return sunrpc_cache_pipe_upcall(cd, h, rsi_request);
}
-#endif
static inline void __rsi_init(struct rsi *new, struct rsi *item)
{
.hash_table = rsi_table,
.name = "auth.sptlrpc.init",
.cache_put = rsi_put,
-#ifdef HAVE_CACHE_UPCALL
.cache_upcall = rsi_upcall,
-#else
- .cache_request = rsi_request,
-#endif
.cache_parse = rsi_parse,
.match = rsi_match,
.init = rsi_init,