datapath: Clean-up previous undefined symbol commit
authorJustin Pettit <jpettit@nicira.com>
Sun, 1 Aug 2010 00:09:31 +0000 (17:09 -0700)
committerJustin Pettit <jpettit@nicira.com>
Sun, 1 Aug 2010 00:46:15 +0000 (17:46 -0700)
The previous commit still had some issues with the
"set_normalized_timespec" symbol being undefined.  Here we just replace
it.  We can search for a more elegant solution later if necessary.

datapath/linux-2.6/.gitignore
datapath/linux-2.6/Modules.mk
datapath/linux-2.6/compat-2.6/include/linux/time.h [deleted file]
datapath/linux-2.6/compat-2.6/time.c [new file with mode: 0644]

index 4b5658b29dfb2dcfd90a48da3041f10eff8297a6..bd99f2408c827f1c1ce7b7ab5155d40a25d34039 100644 (file)
@@ -25,6 +25,7 @@
 /random32.c
 /skbuff-openvswitch.c
 /table.c
+/time.c
 /tmp
 /veth.c
 /vport-generic.c
index b6cb3e9296bdae157c2c11a3af74875dfb8a0d84..7f4cae6eadaf866b2ef503ab62ccf6766f159f9a 100644 (file)
@@ -5,7 +5,8 @@ openvswitch_sources += \
        linux-2.6/compat-2.6/ip_output-openvswitch.c \
        linux-2.6/compat-2.6/kmemdup.c \
        linux-2.6/compat-2.6/random32.c \
-       linux-2.6/compat-2.6/skbuff-openvswitch.c
+       linux-2.6/compat-2.6/skbuff-openvswitch.c \
+       linux-2.6/compat-2.6/time.c
 openvswitch_headers += \
        linux-2.6/compat-2.6/compat26.h \
        linux-2.6/compat-2.6/include/asm-generic/bug.h \
@@ -38,7 +39,6 @@ openvswitch_headers += \
        linux-2.6/compat-2.6/include/linux/slab.h \
        linux-2.6/compat-2.6/include/linux/stddef.h \
        linux-2.6/compat-2.6/include/linux/tcp.h \
-       linux-2.6/compat-2.6/include/linux/time.h \
        linux-2.6/compat-2.6/include/linux/timer.h \
        linux-2.6/compat-2.6/include/linux/types.h \
        linux-2.6/compat-2.6/include/linux/udp.h \
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/time.h b/datapath/linux-2.6/compat-2.6/include/linux/time.h
deleted file mode 100644 (file)
index fa325fa..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef __LINUX_TIME_WRAPPER_H
-#define __LINUX_TIME_WRAPPER_H 1
-
-#include_next <linux/time.h>
-
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
-
-/* "set_normalized_timespec" is defined but not exported in kernels 
- * before 2.6.26. */
-#define set_normalized_timespec(ts, sec, nsec) \
-       rpl_set_normalized_timespec(ts, sec, nsec)
-
-/**
- * set_normalized_timespec - set timespec sec and nsec parts and normalize
- *
- * @ts:         pointer to timespec variable to be set
- * @sec:        seconds to set
- * @nsec:       nanoseconds to set
- *
- * Set seconds and nanoseconds field of a timespec variable and
- * normalize to the timespec storage format
- *
- * Note: The tv_nsec part is always in the range of
- *      0 <= tv_nsec < NSEC_PER_SEC
- * For negative values only the tv_sec field is negative !
- */
-static inline void rpl_set_normalized_timespec(struct timespec *ts, 
-                   time_t sec, long nsec)
-{
-       while (nsec >= NSEC_PER_SEC) {
-               nsec -= NSEC_PER_SEC;
-               ++sec;
-       }
-       while (nsec < 0) {
-               nsec += NSEC_PER_SEC;
-               --sec;
-       }
-       ts->tv_sec = sec;
-       ts->tv_nsec = nsec;
-}
-
-#endif /* linux kernel < 2.6.26 */
-
-#endif
diff --git a/datapath/linux-2.6/compat-2.6/time.c b/datapath/linux-2.6/compat-2.6/time.c
new file mode 100644 (file)
index 0000000..b07ee26
--- /dev/null
@@ -0,0 +1,39 @@
+#include <linux/time.h>
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
+
+/* "set_normalized_timespec" is defined but not exported in kernels 
+ * before 2.6.26. */
+
+/**
+ * set_normalized_timespec - set timespec sec and nsec parts and normalize
+ *
+ * @ts:         pointer to timespec variable to be set
+ * @sec:        seconds to set
+ * @nsec:       nanoseconds to set
+ *
+ * Set seconds and nanoseconds field of a timespec variable and
+ * normalize to the timespec storage format
+ *
+ * Note: The tv_nsec part is always in the range of
+ *      0 <= tv_nsec < NSEC_PER_SEC
+ * For negative values only the tv_sec field is negative !
+ */
+void set_normalized_timespec(struct timespec *ts, 
+                   time_t sec, long nsec)
+{
+       while (nsec >= NSEC_PER_SEC) {
+               nsec -= NSEC_PER_SEC;
+               ++sec;
+       }
+       while (nsec < 0) {
+               nsec += NSEC_PER_SEC;
+               --sec;
+       }
+       ts->tv_sec = sec;
+       ts->tv_nsec = nsec;
+}
+
+#endif /* linux kernel < 2.6.26 */