[ovs-dev] [PATCH] datapath: Backport DIV_ROUND_UP.

Jesse Gross jesse at nicira.com
Tue Apr 26 23:13:09 UTC 2011


Older kernels didn't define DIV_ROUND_UP, so this provides a
backported version.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 .../linux-2.6/compat-2.6/include/linux/kernel.h    |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/datapath/linux-2.6/compat-2.6/include/linux/kernel.h b/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
index 2c2220b..4af8851 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
@@ -54,4 +54,8 @@
 #define SHRT_MIN	((s16)(-SHRT_MAX - 1))
 #endif
 
+#ifndef DIV_ROUND_UP
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#endif
+
 #endif /* linux/kernel.h */
-- 
1.7.1




More information about the dev mailing list