LB_LINUX_TRY_COMPILE([
#include <linux/err.h>
#include <linux/crypto.h>
-
- static int foo(struct crypto_tfm *tfm, const u8 *key, unsigned int l, u32* f)
- {
- return 1;
- }
],[
- struct digest_alg alg = {.dia_setkey=foo};
+ 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])
])
])
-
# 2.6.19 API changes
# kmem_cache_destroy(cachep) return void instead of
# int
])
])
-
#
# 2.6.27
#
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.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],
# 2.6.27
LC_SECURITY_PLUG # for SLES10 SP2
LC_PGMKWRITE_USE_VMFAULT
+ LC_PGMKWRITE_COMPACT
LC_INODE_PERMISION_2ARGS
LC_FILE_REMOVE_SUID
LC_TRYLOCKPAGE
LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
LC_SELINUX_IS_ENABLED
LC_EXPORT_ACCESS_PROCESS_VM
+ LC_VFS_INODE_NEWSIZE_OK
# 2.6.35, 3.0.0
LC_FILE_FSYNC
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.
static struct vm_operations_struct ll_file_vm_ops = {
#ifndef HAVE_VM_OP_FAULT
- .nopage = ll_nopage,
- .populate = ll_populate,
-
+ .nopage = ll_nopage,
+ .populate = ll_populate,
+#else
+ .fault = ll_fault,
+#endif
+#ifndef HAVE_PGMKWRITE_COMPACT
+ .page_mkwrite = ll_page_mkwrite,
#else
- .fault = ll_fault,
+ ._pmkw.page_mkwrite = ll_page_mkwrite,
#endif
- .page_mkwrite = ll_page_mkwrite,
- .open = ll_vm_open,
- .close = ll_vm_close,
+ .open = ll_vm_open,
+ .close = ll_vm_close,
};
int ll_file_mmap(struct file *file, struct vm_area_struct * vma)