Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136425730
D11533.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D11533.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11533: Add nsecs_to_jiffies64() and jiffies_to_{nsecs,usecs}().
Attached
Detach File
Event Timeline
Log In to Comment