As part of changes to the truncate sequence, inode_setattr() no
longer exists, and all filesystems have to define the setattr op
so we can assume that it is not NULL.
Introduce a compat inline function afs_inode_setattr that hides
the tests and the different versions from the main code.
Note that the existing test for the inode_setattr() return type
will fail, but the value is no longer used in that case.
This is required for 2.6.36
Reviewed-on: http://gerrit.openafs.org/2543
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry-picked from commit
eaf3378f537935f6b9843886b43d)
Reviewed-on: http://gerrit.openafs.org/2550
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit
58e56d080b8d19117b60f04ecb37af0c6dcafc1a)
Change-Id: I4cfdd191c60d7672c80aa3b3789e52c3e5e87666
Reviewed-on: http://gerrit.openafs.org/3519
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
LINUX_HAVE_IGET
LINUX_HAVE_I_SIZE_READ
+ LINUX_HAVE_INODE_SETATTR
LINUX_FS_STRUCT_NAMEIDATA_HAS_PATH
LINUX_EXPORTS_INIT_MM
LINUX_EXPORTS_SYS_CHDIR
#endif
#endif
+
+static inline int
+afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
+
+ int code = 0;
+ struct inode *inode = OSIFILE_INODE(afile);
+#if !defined(HAVE_LINUX_INODE_SETATTR)
+ code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
+#elif defined(INODE_SETATTR_NOT_VOID)
+#if defined(AFS_LINUX26_ENV)
+ if (inode->i_op && inode->i_op->setattr)
+ code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
+ else
+#endif
+ code = inode_setattr(inode, newattrs);
+#else
+ inode_setattr(inode, newattrs);
+#endif
+ return code;
+}
#if !defined(HAVE_IGET)
#include "h/exportfs.h"
#endif
+#include "osi_compat.h"
int afs_osicred_initialized = 0;
struct AFS_UCRED afs_osi_cred;
lock_kernel();
code = inode_change_ok(inode, &newattrs);
if (!code)
-#ifdef INODE_SETATTR_NOT_VOID
-#if defined(AFS_LINUX26_ENV)
- if (inode->i_op && inode->i_op->setattr)
- code = inode->i_op->setattr(afile->filp->f_dentry, &newattrs);
- else
-#endif
- code = inode_setattr(inode, &newattrs);
-#else
- inode_setattr(inode, &newattrs);
-#endif
+ code = afs_inode_setattr(afile, &newattrs);
unlock_kernel();
if (!code)
truncate_inode_pages(&inode->i_data, asize);
if test "x$ac_cv_linux_struct_bdi_has_name" = "xyes"; then
AC_DEFINE([STRUCT_BDI_HAS_NAME], 1, [define if struct backing_dev_info has a name member])
fi])
+
+AC_DEFUN([LINUX_HAVE_INODE_SETATTR], [
+ AC_MSG_CHECKING([for linux inode_setattr()])
+ AC_CACHE_VAL([ac_cv_linux_inode_setattr], [
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+ AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[inode_setattr(NULL);],
+ ac_cv_linux_inode_setattr=yes,
+ ac_cv_linux_inode_setattr=no)
+ CPPFLAGS="$save_CPPFLAGS"])
+ AC_MSG_RESULT($ac_cv_linux_inode_setattr)
+ if test "x$ac_cv_linux_inode_setattr" = "xyes"; then
+ AC_DEFINE([HAVE_LINUX_INODE_SETATTR], 1, [define if your kernel has inode_setattr()])
+ fi])