Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 2.6.39 compat: Test if kstrtoul() exists #8761

Merged
merged 1 commit into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions config/kernel-kstrtoul.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dnl #
dnl # 2.6.39 API change
dnl #
dnl # 33ee3b2e2eb9 kstrto*: converting strings to integers done (hopefully) right
dnl #
dnl # If kstrtoul() doesn't exist, fallback to use strict_strtoul() which has
dnl # existed since 2.6.25.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_KSTRTOUL], [
AC_MSG_CHECKING([whether kstrtoul() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
],[
int ret __attribute__ ((unused)) = kstrtoul(NULL, 10, NULL);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KSTRTOUL, 1, [kstrtoul() exists])
],[
AC_MSG_RESULT(no)
])
])
1 change: 1 addition & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_TOTALHIGH_PAGES
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
ZFS_AC_KERNEL_KSTRTOUL

AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
Expand Down
4 changes: 4 additions & 0 deletions include/spl/sys/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@
#define bcopy(src, dest, size) memmove(dest, src, size)
#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size))

#ifndef HAVE_KSTRTOUL
#define kstrtoul strict_strtoul
#endif

#endif /* _SPL_SYS_STRINGS_H */