From 5227148ae17949705487ea673d558ebfe143e635 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sat, 2 Jun 2012 21:35:53 -0400 Subject: [PATCH] Linux 3.5: encode_fh API change The encode_fh export operation now expects two inode arguments instead of a dentry and a "connectable" flag. Use the inode of the dentry we're interested in, and NULL as the parent inode which is the same as passing a 0 flag in the previous API. Change-Id: I05cf146fb2a4bacdca20a9f108d04ccb11530804 Reviewed-on: http://gerrit.openafs.org/7523 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- acinclude.m4 | 1 + src/afs/LINUX/osi_compat.h | 4 ++++ src/cf/linux-test4.m4 | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index b1a6d5d45..8c94911e1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -957,6 +957,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_D_COUNT_IS_INT LINUX_IOP_MKDIR_TAKES_UMODE_T LINUX_IOP_CREATE_TAKES_UMODE_T + LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES dnl If we are guaranteed that keyrings will work - that is dnl a) The kernel has keyrings enabled diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 62137341a..52c4d2d3d 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -351,7 +351,11 @@ afs_get_dentry_from_fh(struct super_block *afs_cacheSBp, afs_dcache_id_t *ainode static inline int afs_get_fh_from_dentry(struct dentry *dp, afs_ufs_dcache_id_t *ainode, int *max_lenp) { if (dp->d_sb->s_export_op->encode_fh) +#if defined(EXPORT_OP_ENCODE_FH_TAKES_INODES) + return dp->d_sb->s_export_op->encode_fh(dp->d_inode, &ainode->raw[0], max_lenp, NULL); +#else return dp->d_sb->s_export_op->encode_fh(dp, &ainode->raw[0], max_lenp, 0); +#endif #if defined(NEW_EXPORT_OPS) /* If fs doesn't provide an encode_fh method, assume the default INO32 type */ *max_lenp = sizeof(struct fid)/4; diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 7ff0a5ce0..ac3fbead5 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -651,3 +651,17 @@ AC_DEFUN([LINUX_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 ], + [struct export_operations _exp_ops; + int _encode_fh(struct inode *i, __u32 *fh, int *len, struct inode *p) + {return 0;}; + _exp_ops.encode_fh = _encode_fh;], + [EXPORT_OP_ENCODE_FH_TAKES_INODES], + [define if encode_fh export op takes inode arguments], + [-Werror]) +]) -- 2.39.5