Date: Wed, 22 May 2019 04:08:45 +0000 (UTC) From: Johannes Lundberg <johalun@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348088 - stable/12/sys/compat/linuxkpi/common/include/linux Message-ID: <201905220408.x4M48jDJ052914@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: johalun Date: Wed May 22 04:08:45 2019 New Revision: 348088 URL: https://svnweb.freebsd.org/changeset/base/348088 Log: MFC r347619: LinuxKPI: Expand ktime functionality. Also, make ktime_get_raw call getnanouptime instead of getnanotime to match (the correct) ktime_get_raw_ns. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Wed May 22 04:02:10 2019 (r348087) +++ stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Wed May 22 04:08:45 2019 (r348088) @@ -35,8 +35,6 @@ #include <linux/time.h> #include <linux/jiffies.h> -#define ktime_get_ts(x) getnanouptime(x) - /* time values in nanoseconds */ typedef s64 ktime_t; @@ -93,6 +91,13 @@ ktime_add_ms(ktime_t kt, int64_t ms) } static inline ktime_t +ktime_add_us(ktime_t kt, int64_t us) +{ + + return (ktime_add_ns(kt, us * NSEC_PER_USEC)); +} + +static inline ktime_t ktime_sub_ns(ktime_t kt, int64_t ns) { return (kt - ns); @@ -172,11 +177,20 @@ timeval_to_ktime(struct timeval tv) return (ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC)); } +static inline int64_t +timespec64_to_ns(struct timespec64 *ts) +{ + return (timespec_to_ns(ts)); +} + #define ktime_to_timespec(kt) ns_to_timespec(kt) #define ktime_to_timespec64(kt) ns_to_timespec(kt) #define ktime_to_timeval(kt) ns_to_timeval(kt) #define ktime_to_ns(kt) (kt) -#define ktime_get_ts64(ts) ktime_get_ts(ts) +#define ktime_get_ts(ts) getnanouptime(ts) +#define ktime_get_ts64(ts) getnanouptime(ts) +#define ktime_get_raw_ts64(ts) getnanouptime(ts) +#define getrawmonotonic64(ts) getnanouptime(ts) static inline int64_t ktime_get_ns(void) @@ -229,7 +243,7 @@ ktime_get_raw(void) { struct timespec ts; - nanotime(&ts); + nanouptime(&ts); return (timespec_to_ktime(ts)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905220408.x4M48jDJ052914>