aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-05-01 10:14:45 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-05-01 10:14:45 +0000
commit61f7fe6b2d147bbbbc167b2518a1ccaae1166778 (patch)
tree58ba17ade9afa1fa50def6892d61d414792dae9c /sys/compat
parent1cc60ae8d8871cf269e108b2f587def3e37551cf (diff)
downloadsrc-61f7fe6b2d147bbbbc167b2518a1ccaae1166778.tar.gz
src-61f7fe6b2d147bbbbc167b2518a1ccaae1166778.zip
Implement kstrtou64() in the LinuxKPI.
Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=360528
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kernel.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index cb9f419595d4..d463f1b047a2 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -390,6 +390,21 @@ kstrtou32(const char *cp, unsigned int base, u32 *res)
}
static inline int
+kstrtou64(const char *cp, unsigned int base, u64 *res)
+{
+ char *end;
+
+ *res = strtouq(cp, &end, base);
+
+ /* skip newline character, if any */
+ if (*end == '\n')
+ end++;
+ if (*cp == 0 || *end != 0)
+ return (-EINVAL);
+ return (0);
+}
+
+static inline int
kstrtobool(const char *s, bool *res)
{
int len;