[ovs-dev] [PATCH] datapath: add rounddown() definition into compatibility code

Andy Zhou azhou at nicira.com
Tue Aug 27 23:19:53 UTC 2013


rounddown() was not available in older kenrel, such as kernel 2.6.32.61.
Add it to the compatibility code.

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 datapath/linux/compat/include/linux/kernel.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h
index fdd2005..6e248c5 100644
--- a/datapath/linux/compat/include/linux/kernel.h
+++ b/datapath/linux/compat/include/linux/kernel.h
@@ -87,4 +87,13 @@
 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
 #endif
 
+#ifndef rounddown
+#define rounddown(x, y) (				\
+{							\
+	typeof(x) __x = (x);				\
+	__x - (__x % (y));				\
+}							\
+)
+#endif
+
 #endif /* linux/kernel.h */
-- 
1.7.9.5




More information about the dev mailing list