]> granicus.if.org Git - zfs/commitdiff
Remap gethrestime() with #define to new symbol and export that new
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 10 Mar 2008 21:38:39 +0000 (21:38 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 10 Mar 2008 21:38:39 +0000 (21:38 +0000)
symbol to avoid direct use of GPL only symbol.

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@36 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c

include/sys/time.h
modules/spl/Makefile.in
modules/spl/spl-time.c [new file with mode: 0644]

index 6124a841d31da365bb1d1653999d885182c7ff8f..297e6ff749edbb007aee5b3d71afd6d49ac1bcc9 100644 (file)
@@ -15,14 +15,17 @@ extern "C" {
 #include <sys/types.h>
 
 extern unsigned long long monotonic_clock(void);
+extern void __gethrestime(timestruc_t *);
 
-#define TIME32_MAX      INT32_MAX
-#define TIME32_MIN      INT32_MIN
+#define gethrestime(ts)                        __gethrestime(ts)
 
-#define SEC             1
-#define MILLISEC        1000
-#define MICROSEC        1000000
-#define NANOSEC         1000000000
+#define TIME32_MAX                     INT32_MAX
+#define TIME32_MIN                     INT32_MIN
+
+#define SEC                            1
+#define MILLISEC                       1000
+#define MICROSEC                       1000000
+#define NANOSEC                                1000000000
 
 #define hz                                     \
 ({                                             \
@@ -30,7 +33,14 @@ extern unsigned long long monotonic_clock(void);
         HZ;                                    \
 })
 
-#define gethrestime(ts) getnstimeofday((ts))
+static __inline__ time_t
+gethrestime_sec(void)
+{
+        timestruc_t now;
+
+        __gethrestime(&now);
+        return now.tv_sec;
+}
 
 static __inline__ hrtime_t
 gethrtime(void) {
@@ -44,15 +54,6 @@ gethrtime(void) {
         return monotonic_clock();
 }
 
-static __inline__ time_t
-gethrestime_sec(void)
-{
-        timestruc_t now;
-
-        gethrestime(&now);
-        return (now.tv_sec);
-}
-
 
 #ifdef  __cplusplus
 }
index 1d152e61b325a10445a4a374394054e2fe81818b..78ebdfa0cb02bb4b050b49686060cc52557bb142 100644 (file)
@@ -15,6 +15,7 @@ spl-objs += spl-taskq.o
 spl-objs += spl-rwlock.o
 spl-objs += spl-vnode.o
 spl-objs += spl-err.o
+spl-objs += spl-time.o
 spl-objs += spl-generic.o
 
 splmodule := spl.ko
diff --git a/modules/spl/spl-time.c b/modules/spl/spl-time.c
new file mode 100644 (file)
index 0000000..f0ec4c5
--- /dev/null
@@ -0,0 +1,11 @@
+#include <sys/sysmacros.h>
+#include <sys/time.h>
+#include "config.h"
+
+void
+__gethrestime(timestruc_t *ts)
+{
+       getnstimeofday((struct timespec *)ts);
+}
+
+EXPORT_SYMBOL(__gethrestime);