Index: sys/compat/linuxkpi/common/include/linux/jiffies.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/jiffies.h +++ sys/compat/linuxkpi/common/include/linux/jiffies.h @@ -68,11 +68,11 @@ } static inline int -msecs_to_jiffies(const u64 msec) +msecs_to_jiffies(const uint64_t msec) { - u64 result; + uint64_t result; - result = howmany(msec * (u64)hz, 1000ULL); + result = howmany(msec * (uint64_t)hz, 1000ULL); if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; @@ -80,27 +80,58 @@ } static inline int -usecs_to_jiffies(const u64 u) +usecs_to_jiffies(const uint64_t usec) { - u64 result; + uint64_t result; - result = howmany(u * (u64)hz, 1000000ULL); + result = howmany(usec * (uint64_t)hz, 1000000ULL); if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; return ((int)result); } -static inline u64 -nsecs_to_jiffies(const u64 n) +static inline uint64_t +nsecs_to_jiffies64(uint64_t nsec) +{ + uint64_t nsec_max, result; + + nsec_max = -1ULL / (uint64_t)hz; + if (nsec > nsec_max) + nsec = nsec_max; + result = howmany(nsec * (uint64_t)hz, 10000000ULL); + if (result > MAX_JIFFY_OFFSET) + result = MAX_JIFFY_OFFSET; + + return (result); +} + +static inline uint64_t +nsecs_to_jiffies(uint64_t n) { + return (usecs_to_jiffies(howmany(n, 1000ULL))); } -static inline u64 +static inline uint64_t +jiffies_to_nsecs(int j) +{ + + return ((1000000000ULL / hz) * j); +} + +static inline uint64_t +jiffies_to_usecs(int j) +{ + + return ((1000000ULL / hz) * j); +} + +static inline uint64_t get_jiffies_64(void) { - return ((u64)(unsigned)ticks); + + return ((uint64_t)(unsigned int)ticks); } static inline int