Page MenuHomeFreeBSD

D11533.diff
No OneTemporary

D11533.diff

Index: head/sys/compat/linuxkpi/common/include/linux/jiffies.h
===================================================================
--- head/sys/compat/linuxkpi/common/include/linux/jiffies.h
+++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h
@@ -68,11 +68,14 @@
}
static inline int
-msecs_to_jiffies(const u64 msec)
+msecs_to_jiffies(uint64_t msec)
{
- u64 result;
+ uint64_t msec_max, result;
- result = howmany(msec * (u64)hz, 1000ULL);
+ msec_max = -1ULL / (uint64_t)hz;
+ if (msec > msec_max)
+ msec = msec_max;
+ result = howmany(msec * (uint64_t)hz, 1000ULL);
if (result > MAX_JIFFY_OFFSET)
result = MAX_JIFFY_OFFSET;
@@ -80,27 +83,61 @@
}
static inline int
-usecs_to_jiffies(const u64 u)
+usecs_to_jiffies(uint64_t usec)
{
- u64 result;
+ uint64_t usec_max, result;
- result = howmany(u * (u64)hz, 1000000ULL);
+ usec_max = -1ULL / (uint64_t)hz;
+ if (usec > usec_max)
+ usec = usec_max;
+ 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, 1000000000ULL);
+ 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) * (uint64_t)(unsigned int)j);
+}
+
+static inline uint64_t
+jiffies_to_usecs(int j)
+{
+
+ return ((1000000ULL / hz) * (uint64_t)(unsigned int)j);
+}
+
+static inline uint64_t
get_jiffies_64(void)
{
- return ((u64)(unsigned)ticks);
+
+ return ((uint64_t)(unsigned int)ticks);
}
static inline int

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 18, 6:05 PM (4 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25532610
Default Alt Text
D11533.diff (1 KB)

Event Timeline