summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-08-06 04:52:39 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-08-06 04:52:39 +0000
commit877a32e91eb69b15744aa85ad22db385bd522b60 (patch)
tree72437071cec27dd45e7bf41c4d429adf39ba19bc
parent7afde631f6483cc5e2da95a84a98085e7453cf52 (diff)
Pull in fls64 compat changes from spl-00-rhel4-compat.patch,
to allow greater compatibility with kernels pre 2.6.16. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@149 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
-rw-r--r--autoconf/spl-build.m418
-rw-r--r--configure.ac1
-rw-r--r--include/linux/bitops_compat.c19
3 files changed, 38 insertions, 0 deletions
diff --git a/autoconf/spl-build.m4 b/autoconf/spl-build.m4
index 2f09fa87e..b311902e9 100644
--- a/autoconf/spl-build.m4
+++ b/autoconf/spl-build.m4
@@ -439,3 +439,21 @@ AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
AC_MSG_RESULT(no)
])
])
+
+dnl #
+dnl # 2.6.16 API change.
+dnl # Check if 'fls64()' is available
+dnl #
+AC_DEFUN([SPL_AC_FLS64],
+ [AC_MSG_CHECKING([whether fls64() is available])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/bitops.h>
+ ],[
+ return fls64(0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/configure.ac b/configure.ac
index c4d424ea0..99d341a66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@ SPL_AC_SET_SHRINKER
SPL_AC_PATH_IN_NAMEIDATA
SPL_AC_TASK_CURR
SPL_AC_CTL_UNNUMBERED
+SPL_AC_FLS64
TOPDIR=`/bin/pwd`
diff --git a/include/linux/bitops_compat.c b/include/linux/bitops_compat.c
new file mode 100644
index 000000000..8e1e25809
--- /dev/null
+++ b/include/linux/bitops_compat.c
@@ -0,0 +1,19 @@
+#ifndef _SPL_BITOPS_COMPAT_H
+#define _SPL_BITOPS_COMPAT_H
+
+#include <linux/bitops.h>
+
+#ifndef HAVE_FLS64
+
+static inline int fls64(__u64 x)
+{
+ __u32 h = x >> 32;
+ if (h)
+ return fls(h) + 32;
+ return fls(x);
+}
+
+#endif /* HAVE_FLS64 */
+
+#endif /* _SPL_BITOPS_COMPAT_H */
+