Date: Fri, 1 May 2020 10:14:46 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360528 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <202005011014.041AEkHe079417@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri May 1 10:14:45 2020 New Revision: 360528 URL: https://svnweb.freebsd.org/changeset/base/360528 Log: Implement kstrtou64() in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri May 1 10:02:38 2020 (r360527) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri May 1 10:14:45 2020 (r360528) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005011014.041AEkHe079417>