summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/Makefile.am1
-rw-r--r--include/linux/time_compat.h45
-rw-r--r--include/sys/time.h79
-rw-r--r--include/sys/types.h1
4 files changed, 31 insertions, 95 deletions
diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am
index ec7023d15..c921cc576 100644
--- a/include/linux/Makefile.am
+++ b/include/linux/Makefile.am
@@ -15,7 +15,6 @@ KERNEL_H = \
$(top_srcdir)/include/linux/rwsem_compat.h \
$(top_srcdir)/include/linux/smp_compat.h \
$(top_srcdir)/include/linux/sysctl_compat.h \
- $(top_srcdir)/include/linux/time_compat.h \
$(top_srcdir)/include/linux/uaccess_compat.h \
$(top_srcdir)/include/linux/wait_compat.h \
$(top_srcdir)/include/linux/zlib_compat.h
diff --git a/include/linux/time_compat.h b/include/linux/time_compat.h
deleted file mode 100644
index efa023299..000000000
--- a/include/linux/time_compat.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************\
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <[email protected]>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- * For details, see <http://zfsonlinux.org/>.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
-
-#ifndef _SPL_TIME_COMPAT_H
-#define _SPL_TIME_COMPAT_H
-
-#include <linux/time.h>
-
-/* timespec_sub() API changes
- * 2.6.18 - 2.6.x: Inline function provided by linux/time.h
- */
-#ifndef HAVE_TIMESPEC_SUB
-static inline struct timespec
-timespec_sub(struct timespec lhs, struct timespec rhs)
-{
- struct timespec ts_delta;
- set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
- lhs.tv_nsec - rhs.tv_nsec);
- return ts_delta;
-}
-#endif /* HAVE_TIMESPEC_SUB */
-
-#endif /* _SPL_TIME_COMPAT_H */
-
diff --git a/include/sys/time.h b/include/sys/time.h
index d8e81c9a7..b9826d2b7 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -23,74 +23,57 @@
\*****************************************************************************/
#ifndef _SPL_TIME_H
-#define _SPL_TIME_H
+#define _SPL_TIME_H
-/*
- * Structure returned by gettimeofday(2) system call,
- * and used in other calls.
- */
#include <linux/module.h>
#include <linux/time.h>
#include <sys/types.h>
#include <sys/timer.h>
#if defined(CONFIG_64BIT)
-#define TIME_MAX INT64_MAX
-#define TIME_MIN INT64_MIN
+#define TIME_MAX INT64_MAX
+#define TIME_MIN INT64_MIN
#else
-#define TIME_MAX INT32_MAX
-#define TIME_MIN INT32_MIN
+#define TIME_MAX INT32_MAX
+#define TIME_MIN INT32_MIN
#endif
-#define SEC 1
-#define MILLISEC 1000
-#define MICROSEC 1000000
-#define NANOSEC 1000000000
+#define SEC 1
+#define MILLISEC 1000
+#define MICROSEC 1000000
+#define NANOSEC 1000000000
#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
-/* Already defined in include/linux/time.h */
-#undef CLOCK_THREAD_CPUTIME_ID
-#undef CLOCK_REALTIME
-#undef CLOCK_MONOTONIC
-#undef CLOCK_PROCESS_CPUTIME_ID
+#define hz HZ
-typedef enum clock_type {
- __CLOCK_REALTIME0 = 0, /* obsolete; same as CLOCK_REALTIME */
- CLOCK_VIRTUAL = 1, /* thread's user-level CPU clock */
- CLOCK_THREAD_CPUTIME_ID = 2, /* thread's user+system CPU clock */
- CLOCK_REALTIME = 3, /* wall clock */
- CLOCK_MONOTONIC = 4, /* high resolution monotonic clock */
- CLOCK_PROCESS_CPUTIME_ID = 5, /* process's user+system CPU clock */
- CLOCK_HIGHRES = CLOCK_MONOTONIC, /* alternate name */
- CLOCK_PROF = CLOCK_THREAD_CPUTIME_ID,/* alternate name */
-} clock_type_t;
-
-#define hz \
-({ \
- ASSERT(HZ >= 100 && HZ <= MICROSEC); \
- HZ; \
-})
-
-extern void __gethrestime(timestruc_t *);
-extern int __clock_gettime(clock_type_t, timespec_t *);
-extern hrtime_t __gethrtime(void);
+#define TIMESPEC_OVERFLOW(ts) \
+ ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
-#define gethrestime(ts) __gethrestime(ts)
-#define clock_gettime(fl, tp) __clock_gettime(fl, tp)
-#define gethrtime() __gethrtime()
+static inline void
+gethrestime(timestruc_t *now)
+{
+ struct timespec ts;
+ getnstimeofday(&ts);
+ now->tv_sec = ts.tv_sec;
+ now->tv_nsec = ts.tv_nsec;
+}
-static __inline__ time_t
+static inline time_t
gethrestime_sec(void)
{
- timestruc_t now;
-
- __gethrestime(&now);
- return now.tv_sec;
+ struct timespec ts;
+ getnstimeofday(&ts);
+ return (ts.tv_sec);
}
-#define TIMESPEC_OVERFLOW(ts) \
- ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
+static inline hrtime_t
+gethrtime(void)
+{
+ struct timespec now;
+ getrawmonotonic(&now);
+ return (((hrtime_t)now.tv_sec * NSEC_PER_SEC) + now.tv_nsec);
+}
#endif /* _SPL_TIME_H */
diff --git a/include/sys/types.h b/include/sys/types.h
index fcec0fa31..11a325494 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -31,7 +31,6 @@
#include <linux/uaccess_compat.h>
#include <linux/file_compat.h>
#include <linux/list_compat.h>
-#include <linux/time_compat.h>
#include <linux/bitops_compat.h>
#include <linux/smp_compat.h>
#include <linux/kallsyms_compat.h>