[OpenAFS] AFS on linux 2.6.17/18

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Fri, 04 Aug 2006 08:52:06 -0400


In message <1154693382.11126.3.camel@heplnw8.pp.rl.ac.uk>,William Murray writes
:
>Thank you. I just upgraded to 2.6.17-1.2517.fc6 hoping that would
>change something. It did. I didn't need to make anything in the kernel
>area. But rlim is still there:

the build test fails.

	/lib/modules/2.6.17-1.2517.fc6/build/include/asm/processor.h:80: error: 'CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)

testing for features against the kernel keeps getting more complicated.
take a look at http://rt.central.org/rt/Ticket/Display.html?id=34561
if you decide to try the patch you will need to run regen.sh after you
apply the patch.  i suspect 2.6.17 will have other problems though
since get_sb_nodev() changed and takes an extra parameter.  this
patch depends on ticket #34561.  its hard to hit a moving target.

Index: src/afs/LINUX/osi_vfsops.c
===================================================================
--- src/afs/LINUX/osi_vfsops.c	(revision 34)
+++ src/afs/LINUX/osi_vfsops.c	(revision 36)
@@ -49,7 +49,6 @@
 static int afs_root(struct super_block *afsp);
 struct super_block *afs_read_super(struct super_block *sb, void *data, int silent);
 int afs_fill_super(struct super_block *sb, void *data, int silent);
-static struct super_block *afs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data);
 
 /* afs_file_system
  * VFS entry for Linux - installed in init_module
@@ -64,6 +63,29 @@
 	.state		= 0,
 };
 
+
+/* afs_read_super
+ * read the "super block" for AFS - roughly eguivalent to struct vfs.
+ * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super.
+ */
+#if defined(AFS_LINUX26_ENV)
+static struct super_block *
+#ifdef GET_SB_HAS_STRUCT_VFSMOUNT
+afs_get_sb(struct file_system_type *fs_type, int flags,
+	   const char *dev_name, void *data, struct vfsmount *mnt)
+#else
+afs_get_sb(struct file_system_type *fs_type, int flags,
+	   const char *dev_name, void *data)
+#endif
+{
+#ifdef GET_SB_HAS_STRUCT_VFSMOUNT
+    return get_sb_nodev(fs_type, flags, data, afs_fill_super, mnt);
+#else
+    return get_sb_nodev(fs_type, flags, data, afs_fill_super);
+#endif
+}
+
+
 struct file_system_type afs_fs_type = {
     .owner = THIS_MODULE,
     .name = "afs",
@@ -83,16 +105,6 @@
 };
 #endif
 
-/* afs_read_super
- * read the "super block" for AFS - roughly eguivalent to struct vfs.
- * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super.
- */
-#if defined(AFS_LINUX26_ENV)
-static struct super_block *
-afs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
-{
-    return get_sb_nodev(fs_type, flags, data, afs_fill_super);
-}
 
 int
 afs_fill_super(struct super_block *sb, void *data, int silent)
Index: src/cf/linux-test4.m4
===================================================================
--- src/cf/linux-test4.m4	(revision 34)
+++ src/cf/linux-test4.m4	(revision 36)
@@ -577,3 +577,13 @@
       ac_cv_linux_func_d_revalidate_takes_nameidata=yes,
       ac_cv_linux_func_d_revalidate_takes_nameidata=no)])
   AC_MSG_RESULT($ac_cv_linux_func_d_revalidate_takes_nameidata)])
+
+AC_DEFUN([LINUX_GET_SB_HAS_STRUCT_VFSMOUNT], [
+  AC_MSG_CHECKING([for struct vfsmount * in get_sb_nodev()])
+  AC_CACHE_VAL([ac_cv_linux_get_sb_has_struct_vfsmount], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[get_sb_nodev(0,0,0,0,0);],
+      ac_cv_linux_get_sb_has_struct_vfsmount=yes,
+      ac_cv_linux_get_sb_has_struct_vfsmount=no)])
+  AC_MSG_RESULT($ac_cv_linux_get_sb_has_struct_vfsmount)])