From 3c6952624a8f600f9a0fbc1f5db5560a7ef9b13e Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Wed, 15 Nov 2006 21:27:47 -0200 Subject: [DCCP]: Introduce DCCP_{BUG{_ON},CRIT} macros, use enum:8 for the ccid3 states This patch tackles the following problem: * the ccid3_hc_{t,r}x_sock define ccid3hc{t,r}x_state as `u8', but in reality there can only be a few, pre-defined enum names * this necessitates addiditional checking for unexpected values which would otherwise be caught by the compiler Signed-off-by: Gerrit Renker Signed-off-by: Arnaldo Carvalho de Melo --- net/dccp/dccp.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'net/dccp/dccp.h') diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 363fa520056e..ecb4e7bd1a84 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -18,6 +18,14 @@ #include #include "ackvec.h" +#define DCCP_CRIT(fmt, a...) LIMIT_NETDEBUG(KERN_CRIT fmt " at %s:%d/%s()\n", \ + ##a, __FILE__, __LINE__, __FUNCTION__) +#define DCCP_BUG(fmt, a...) do { DCCP_CRIT(fmt, ##a); dump_stack(); } while (0) +#define DCCP_BUG_ON(cond) do { if (unlikely((cond) == 0)) \ + DCCP_BUG("BUG: condition \"%s\" fails",\ + __stringify((cond))); \ + } while (0) + #ifdef CONFIG_IP_DCCP_DEBUG extern int dccp_debug; -- cgit v1.2.3-70-g09d2