Linux: bdi doesn't always have a name
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Thu, 18 Feb 2010 23:09:40 +0000 (23:09 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 19 Feb 2010 02:08:58 +0000 (18:08 -0800)
The 'name' element of the backing_dev_info structure is new in
2.6.32 - add yet another configure test, and #ifdef to protect our
setting of it.

Change-Id: I0a3e411e571e05771619381bf621d299482c695b
Reviewed-on: http://gerrit.openafs.org/1341
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/LINUX/osi_vfsops.c
src/cf/linux-test4.m4

index a6f86e4..a88e464 100644 (file)
@@ -828,6 +828,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_DEFINES_PREV_TASK
                 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
                 LINUX_STRUCT_SUPER_BLOCK_HAS_S_BDI
+                LINUX_STRUCT_BDI_HAS_NAME
                 LINUX_FS_STRUCT_INODE_HAS_I_ALLOC_SEM
                 LINUX_FS_STRUCT_INODE_HAS_I_BLKBITS
                 LINUX_FS_STRUCT_INODE_HAS_I_BLKSIZE
index 47247ca..a7cd802 100644 (file)
@@ -110,7 +110,9 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
 #if defined(HAVE_BDI_INIT)
     bdi_init(afs_backing_dev_info);
 #endif
+#if defined(STRUCT_BDI_HAS_NAME)
     afs_backing_dev_info->name = "openafs";
+#endif
     afs_backing_dev_info->ra_pages = 32;
 #if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI)
     sb->s_bdi = afs_backing_dev_info;
index 05e872b..2420b7b 100644 (file)
@@ -1217,3 +1217,17 @@ _t.ctl_name = 0;],
     AC_DEFINE([STRUCT_CTL_TABLE_HAS_CTL_NAME], 1, [define if struct ctl_table has a ctl_name member])
   fi])
 
+AC_DEFUN([LINUX_STRUCT_BDI_HAS_NAME], [
+  AC_MSG_CHECKING([if struct backing_dev_info has name])
+  AC_CACHE_VAL([ac_cv_linux_struct_bdi_has_name], [
+    AC_TRY_KBUILD(
+[#include <linux/backing-dev.h>],
+[struct backing_dev_info _bdi;
+_bdi.name = NULL;],
+      ac_cv_linux_struct_bdi_has_name=yes,
+      ac_cv_linux_struct_bdi_has_name=no)])
+  AC_MSG_RESULT($ac_cv_linux_struct_bdi_has_name)
+  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])
+