Commit f3b65b77 authored by Stephen Hemminger's avatar Stephen Hemminger

[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
parent 70a209fb
...@@ -683,11 +683,21 @@ extern void rtnl_lock(void); ...@@ -683,11 +683,21 @@ extern void rtnl_lock(void);
extern void rtnl_unlock(void); extern void rtnl_unlock(void);
extern void rtnetlink_init(void); extern void rtnetlink_init(void);
#define ASSERT_RTNL() do { if (down_trylock(&rtnl_sem) == 0) { up(&rtnl_sem); \ #define ASSERT_RTNL() do { \
printk("RTNL: assertion failed at " __FILE__ "(%d)\n", __LINE__); } \ if (unlikely(down_trylock(&rtnl_sem) == 0)) { \
} while(0) up(&rtnl_sem); \
#define BUG_TRAP(x) if (!(x)) { printk("KERNEL: assertion (" #x ") failed at " __FILE__ "(%d)\n", __LINE__); } 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__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment