Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jun 2018 13:37:31 +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: r334711 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201806061337.w56DbVrk009662@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Jun  6 13:37:31 2018
New Revision: 334711
URL: https://svnweb.freebsd.org/changeset/base/334711

Log:
  Implement the ktime_compare() and ktime_after() functions in the LinuxKPI.
  
  Submitted by:	Johannes Lundberg <johalun0@gmail.com>
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies
  Sponsored by:	Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/ktime.h

Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/ktime.h	Wed Jun  6 13:29:52 2018	(r334710)
+++ head/sys/compat/linuxkpi/common/include/linux/ktime.h	Wed Jun  6 13:37:31 2018	(r334711)
@@ -127,6 +127,25 @@ ktime_add(ktime_t lhs, ktime_t rhs)
 	return (lhs + rhs);
 }
 
+static inline int
+ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+	if (cmp1 > cmp2)
+		return (1);
+	else if (cmp1 < cmp2)
+		return (-1);
+	else
+		return (0);
+}
+
+static inline bool
+ktime_after(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+	return (ktime_compare(cmp1, cmp2) > 0);
+}
+
 static inline ktime_t
 timespec_to_ktime(struct timespec ts)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806061337.w56DbVrk009662>