svn commit: r334711 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Wed Jun 6 13:37:32 UTC 2018


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 at 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)
 {


More information about the svn-src-head mailing list