Subject: Collected Debian patches for OpenAFS
Author: Russ Allbery <rra@debian.org>

The packaging for OpenAFS is maintained in Git with no Debian-specific
patches, just cherry-picks from upstream (possibly from upstream Gerrit).
This makes it complex to separate the changes into individual patches.
They are therefore all included in a single Debian patch.

For full commit history and separated commits, see the packaging Git
repository.
--- openafs-1.6.1.orig/acinclude.m4
+++ openafs-1.6.1/acinclude.m4
@@ -840,6 +840,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinu
 #include <linux/page-flags.h>],
 				     [struct page *_page;
                                       int bchecked = PageFsMisc(_page);])
+		 AC_CHECK_LINUX_FUNC([clear_inode],
+				     [#include <linux/fs.h>],
+				     [clear_inode(NULL);])
 		 AC_CHECK_LINUX_FUNC([current_kernel_time],
 				     [#include <linux/time.h>],
 			             [struct timespec s;
@@ -955,6 +958,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinu
 		 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
--- openafs-1.6.1.orig/src/cf/linux-test4.m4
+++ openafs-1.6.1/src/cf/linux-test4.m4
@@ -661,3 +661,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 <linux/exportfs.h>],
+			[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])
+])
--- openafs-1.6.1.orig/src/afs/LINUX/osi_compat.h
+++ openafs-1.6.1/src/afs/LINUX/osi_compat.h
@@ -333,7 +333,11 @@ afs_get_dentry_from_fh(struct super_bloc
 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;
--- openafs-1.6.1.orig/src/afs/LINUX/osi_vfsops.c
+++ openafs-1.6.1/src/afs/LINUX/osi_vfsops.c
@@ -284,7 +284,11 @@ afs_evict_inode(struct inode *ip)
 	osi_Panic("inode freed while still hashed");
 
     truncate_inode_pages(&ip->i_data, 0);
+#if defined(HAVE_LINUX_CLEAR_INODE)
+    clear_inode(ip);
+#else
     end_writeback(ip);
+#endif
 
 #if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
     afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
--- openafs-1.6.1.orig/src/packaging/Debian/sysname
+++ openafs-1.6.1/src/packaging/Debian/sysname
@@ -9,7 +9,7 @@ case `dpkg --print-architecture` in
 alpha)
     echo alpha_linux_26
     ;;
-arm|armel|armv5tel)
+arm|armel|armhf|armv5tel)
     echo arm_linux26
     ;;
 amd64)
--- openafs-1.6.1.orig/src/packaging/Debian/module/sysname
+++ openafs-1.6.1/src/packaging/Debian/module/sysname
@@ -21,7 +21,7 @@ alpha)
         ;;
     esac
     ;;
-arm|armel|armv5tel)
+arm|armel|armhf|armv5tel)
     case $KVERS in
     2.4*)
         echo arm_linux24
