diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2020-05-18 09:06:09 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2020-05-18 09:06:09 +0000 |
commit | 50f6561f989e73745c655014ac3532cb02017155 (patch) | |
tree | c388008256cc2a125aad865e61294b2d0de286be /sys/compat | |
parent | 0af4c757ddd9b8a367319608758214f6ea1ecbee (diff) | |
download | src-50f6561f989e73745c655014ac3532cb02017155.tar.gz src-50f6561f989e73745c655014ac3532cb02017155.zip |
MFC r360528:
Implement kstrtou64() in the LinuxKPI.
Submitted by: ashafer_badland.io (Austin Shafer)
Sponsored by: Mellanox Technologies
Notes
Notes:
svn path=/stable/11/; revision=361173
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/kernel.h | 15 |
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 ecdfcdc89230..6207c070781b 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -385,6 +385,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; |