From f3b65b776ea63fc3e77b4185685f8050765f71d3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 22 Sep 2003 14:12:56 -0700 Subject: [NET]: rtnetlink -- ASSERT_RTNL and BUG_TRAP. 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 --- include/linux/rtnetlink.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 3406e8cfc32c..1141ec3c5321 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -683,11 +683,21 @@ extern void rtnl_lock(void); 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__ */ -- cgit v1.2.3