netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] (3/3) rtnetlink -- ASSERT_RTNL and BUG_TRAP
@ 2003-09-22 23:39 Stephen Hemminger
  2003-09-23 11:02 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2003-09-22 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

Change ASSERT_RTNL and BUG_TRAP
	- unlikely to occur
	- tag message as error
	- dump_stack in ASSERT_RTNL to aide finding code path
	- make all format's which a smart compiler can optimize

diff -Nru a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
--- a/include/linux/rtnetlink.h	Mon Sep 22 16:31:24 2003
+++ b/include/linux/rtnetlink.h	Mon Sep 22 16:31:24 2003
@@ -683,11 +683,21 @@
 extern void rtnl_unlock(void);
 extern void rtnetlink_init(void);
 
-#define ASSERT_RTNL() do { if (down_trylock(&rtnl_sem) == 0)  { up(&rtnl_sem); \
-printk("RTNL: assertion failed at " __FILE__ "(%d)\n", __LINE__); } \
-		   } while(0)
-#define BUG_TRAP(x) if (!(x)) { printk("KERNEL: assertion (" #x ") failed at " __FILE__ "(%d)\n", __LINE__); }
+#define ASSERT_RTNL() do { \
+	if (unlikely(down_trylock(&rtnl_sem) == 0)) { \
+		up(&rtnl_sem); \
+		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
+		       __FILE__,  __LINE__); \
+		dump_stack(); \
+	} \
+} while(0)
 
+#define BUG_TRAP(x) do { \
+	if (unlikely(!(x))) { \
+		printk(KERN_ERR "KERNEL: assertion (%s) failed at %s (%d)\n", \
+			#x,  __FILE__ , __LINE__); \
+	} \
+} while(0)
 
 #endif /* __KERNEL__ */
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] (3/3) rtnetlink -- ASSERT_RTNL and BUG_TRAP
  2003-09-22 23:39 [PATCH] (3/3) rtnetlink -- ASSERT_RTNL and BUG_TRAP Stephen Hemminger
@ 2003-09-23 11:02 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-09-23 11:02 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On Mon, 22 Sep 2003 16:39:46 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> Change ASSERT_RTNL and BUG_TRAP
> 	- unlikely to occur
> 	- tag message as error
> 	- dump_stack in ASSERT_RTNL to aide finding code path
> 	- make all format's which a smart compiler can optimize

Looks good to me, applied thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-23 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-22 23:39 [PATCH] (3/3) rtnetlink -- ASSERT_RTNL and BUG_TRAP Stephen Hemminger
2003-09-23 11:02 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).