These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / include / linux / time64.h
index a383147..367d5af 100644 (file)
@@ -2,6 +2,7 @@
 #define _LINUX_TIME64_H
 
 #include <uapi/linux/time.h>
+#include <linux/math64.h>
 
 typedef __s64 time64_t;
 
@@ -11,11 +12,18 @@ typedef __s64 time64_t;
  */
 #if __BITS_PER_LONG == 64
 # define timespec64 timespec
+#define itimerspec64 itimerspec
 #else
 struct timespec64 {
        time64_t        tv_sec;                 /* seconds */
        long            tv_nsec;                /* nanoseconds */
 };
+
+struct itimerspec64 {
+       struct timespec64 it_interval;
+       struct timespec64 it_value;
+};
+
 #endif
 
 /* Parameters used to convert the timespec values: */
@@ -28,6 +36,7 @@ struct timespec64 {
 #define FSEC_PER_SEC   1000000000000000LL
 
 /* Located here for timespec[64]_valid_strict */
+#define TIME64_MAX                     ((s64)~((u64)1 << 63))
 #define KTIME_MAX                      ((s64)~((u64)1 << 63))
 #define KTIME_SEC_MAX                  (KTIME_MAX / NSEC_PER_SEC)
 
@@ -43,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
        return ts;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64)
+{
+       return *its64;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its)
+{
+       return *its;
+}
+
 # define timespec64_equal              timespec_equal
 # define timespec64_compare            timespec_compare
 # define set_normalized_timespec64     set_normalized_timespec
@@ -75,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
        return ret;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64)
+{
+       struct itimerspec ret;
+
+       ret.it_interval = timespec64_to_timespec(its64->it_interval);
+       ret.it_value = timespec64_to_timespec(its64->it_value);
+       return ret;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its)
+{
+       struct itimerspec64 ret;
+
+       ret.it_interval = timespec_to_timespec64(its->it_interval);
+       ret.it_value = timespec_to_timespec64(its->it_value);
+       return ret;
+}
+
 static inline int timespec64_equal(const struct timespec64 *a,
                                   const struct timespec64 *b)
 {