]> git.proxmox.com Git - mirror_spl.git/commitdiff
Pull in fls64 compat changes from spl-00-rhel4-compat.patch,
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Wed, 6 Aug 2008 04:52:39 +0000 (04:52 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Wed, 6 Aug 2008 04:52:39 +0000 (04:52 +0000)
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

autoconf/spl-build.m4
configure.ac
include/linux/bitops_compat.c [new file with mode: 0644]

index 2f09fa87e5fc14521099b053349b1084ea585577..b311902e93c06c84bd7f8974a5aac3634f9a726c 100644 (file)
@@ -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)
+       ])
+])
index c4d424ea027eca9049a218c22d29ca8406555cbd..99d341a6618f891dd868b7eb882a8e97bd6ab8b8 100644 (file)
@@ -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 (file)
index 0000000..8e1e258
--- /dev/null
@@ -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 */
+