datapath: add rounddown() definition into compatibility code
authorAndy Zhou <azhou@nicira.com>
Tue, 27 Aug 2013 23:19:53 +0000 (16:19 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 27 Aug 2013 23:30:39 +0000 (16:30 -0700)
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@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/linux/compat/include/linux/kernel.h

index fdd2005..6e248c5 100644 (file)
 #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 */