[ovs-dev] [PATCH] datapath: Add backport for USHRT_MAX.

Jesse Gross jesse at nicira.com
Thu Mar 3 21:40:39 UTC 2011


Kernels before 2.6.26 didn't have type limits for short at all
and before 2.6.35 it was called SHORT instead of SHRT.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 .../linux-2.6/compat-2.6/include/linux/kernel.h    |    6 ++++++
 1 files changed, 6 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 1c9f401..2c2220b 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
@@ -48,4 +48,10 @@
 #error "CONFIG_PREEMPT is broken before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\""
 #endif
 
+#ifndef USHRT_MAX
+#define USHRT_MAX	((u16)(~0U))
+#define SHRT_MAX	((s16)(USHRT_MAX>>1))
+#define SHRT_MIN	((s16)(-SHRT_MAX - 1))
+#endif
+
 #endif /* linux/kernel.h */
-- 
1.7.1





More information about the dev mailing list