svn commit: r322213 - head/sys/compat/linuxkpi/common/include/linux
Mark Johnston
markj at FreeBSD.org
Tue Aug 8 04:34:03 UTC 2017
Author: markj
Date: Tue Aug 8 04:34:02 2017
New Revision: 322213
URL: https://svnweb.freebsd.org/changeset/base/322213
Log:
Add round_jiffies_up(), local_clock() and __setup_timer() to the LinuxKPI.
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11871
Modified:
head/sys/compat/linuxkpi/common/include/linux/sched.h
head/sys/compat/linuxkpi/common/include/linux/timer.h
Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 8 04:30:22 2017 (r322212)
+++ head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 8 04:34:02 2017 (r322213)
@@ -36,14 +36,16 @@
#include <sys/proc.h>
#include <sys/sched.h>
#include <sys/sleepqueue.h>
+#include <sys/time.h>
+#include <linux/bitmap.h>
#include <linux/compat.h>
#include <linux/completion.h>
+#include <linux/mm_types.h>
#include <linux/pid.h>
#include <linux/slab.h>
-#include <linux/mm_types.h>
#include <linux/string.h>
-#include <linux/bitmap.h>
+#include <linux/time.h>
#include <asm/atomic.h>
@@ -149,5 +151,14 @@ int linux_schedule_timeout(int timeout);
#define io_schedule() schedule()
#define io_schedule_timeout(timeout) schedule_timeout(timeout)
+
+static inline uint64_t
+local_clock(void)
+{
+ struct timespec ts;
+
+ nanotime(&ts);
+ return ((uint64_t)ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec);
+}
#endif /* _LINUX_SCHED_H_ */
Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/timer.h Tue Aug 8 04:30:22 2017 (r322212)
+++ head/sys/compat/linuxkpi/common/include/linux/timer.h Tue Aug 8 04:34:02 2017 (r322213)
@@ -46,15 +46,20 @@ struct timer_list {
extern unsigned long linux_timer_hz_mask;
-#define setup_timer(timer, func, dat) \
-do { \
+#define TIMER_IRQSAFE 0x0001
+
+#define setup_timer(timer, func, dat) do { \
(timer)->function = (func); \
(timer)->data = (dat); \
callout_init(&(timer)->timer_callout, 1); \
} while (0)
-#define init_timer(timer) \
-do { \
+#define __setup_timer(timer, func, dat, flags) do { \
+ CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0); \
+ setup_timer(timer, func, dat); \
+} while (0)
+
+#define init_timer(timer) do { \
(timer)->function = NULL; \
(timer)->data = 0; \
callout_init(&(timer)->timer_callout, 1); \
@@ -67,9 +72,10 @@ extern void add_timer_on(struct timer_list *, int cpu)
#define del_timer(timer) callout_stop(&(timer)->timer_callout)
#define del_timer_sync(timer) callout_drain(&(timer)->timer_callout)
#define timer_pending(timer) callout_pending(&(timer)->timer_callout)
-#define round_jiffies(j) \
+#define round_jiffies(j) \
((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask))
-#define round_jiffies_relative(j) \
- round_jiffies(j)
+#define round_jiffies_relative(j) round_jiffies(j)
+#define round_jiffies_up(j) round_jiffies(j)
+#define round_jiffies_up_relative(j) round_jiffies_up(j)
#endif /* _LINUX_TIMER_H_ */
More information about the svn-src-all
mailing list