Whamcloud - gitweb
fix building problem with 2.6.22 kernel.
[fs/lustre-release.git] / lnet / include / libcfs / linux / linux-time.h
index e928387..626defd 100644 (file)
@@ -73,7 +73,7 @@
 #define ONE_MILLION 1000000
 
 #ifdef __KERNEL__
-#ifdef HAVE_KERNEL_CONFIG_H
+#ifndef AUTOCONF_INCLUDED
 #include <linux/config.h>
 #endif
 #include <linux/module.h>
@@ -238,7 +238,8 @@ static inline void cfs_duration_usec(cfs_duration_t d, struct timeval *s)
 
         s->tv_sec = d / HZ;
         t = (d - (cfs_duration_t)s->tv_sec * HZ) * ONE_MILLION;
-        s->tv_usec = do_div (t, HZ);
+        do_div(t, HZ);
+        s->tv_usec = t;
 #else
         s->tv_sec = d / HZ;
         s->tv_usec = ((d - (cfs_duration_t)s->tv_sec * HZ) * ONE_MILLION) / HZ;
@@ -252,7 +253,8 @@ static inline void cfs_duration_nsec(cfs_duration_t d, struct timespec *s)
 
         s->tv_sec = d / HZ;
         t = (d - s->tv_sec * HZ) * ONE_BILLION;
-        s->tv_nsec = do_div (t, HZ);
+        do_div(t, HZ);
+        s->tv_nsec = t;
 #else
         s->tv_sec = d / HZ;
         s->tv_nsec = ((d - s->tv_sec * HZ) * ONE_BILLION) / HZ;
@@ -279,12 +281,17 @@ static inline int cfs_time_before_64(__u64 t1, __u64 t2)
         return (__s64)t2 - (__s64)t1 > 0;
 }
 
+static inline int cfs_time_beforeq_64(__u64 t1, __u64 t2)
+{
+        return (__s64)t2 - (__s64)t1 >= 0;
+}
+
 #else
 #define cfs_time_current_64 cfs_time_current
 #define cfs_time_add_64     cfs_time_add
 #define cfs_time_shift_64   cfs_time_shift
 #define cfs_time_before_64  cfs_time_before
-
+#define cfs_time_beforeq_64 cfs_time_beforeq
 #endif
 
 /*