diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-07-26 00:43:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-26 00:43:18 -0400 |
commit | 547b792cac0a038b9dbf958d3c120df3740b5572 (patch) | |
tree | 08554d083b0ca7d65739dc1ce12f9b12a9b8e1f8 /net/ipv6/ip6_fib.c | |
parent | 53e5e96ec18da6f65e89f05674711e1c93d8df67 (diff) |
net: convert BUG_TRAP to generic WARN_ON
Removes legacy reinvent-the-wheel type thing. The generic
machinery integrates much better to automated debugging aids
such as kerneloops.org (and others), and is unambiguous due to
better naming. Non-intuively BUG_TRAP() is actually equal to
WARN_ON() rather than BUG_ON() though some might actually be
promoted to BUG_ON() but I left that to future.
I could make at least one BUILD_BUG_ON conversion.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r-- | net/ipv6/ip6_fib.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 08ea2de28d63..52dddc25d3e6 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -287,7 +287,7 @@ static int fib6_dump_node(struct fib6_walker_t *w) | |||
287 | w->leaf = rt; | 287 | w->leaf = rt; |
288 | return 1; | 288 | return 1; |
289 | } | 289 | } |
290 | BUG_TRAP(res!=0); | 290 | WARN_ON(res == 0); |
291 | } | 291 | } |
292 | w->leaf = NULL; | 292 | w->leaf = NULL; |
293 | return 0; | 293 | return 0; |
@@ -778,7 +778,7 @@ out: | |||
778 | pn->leaf = fib6_find_prefix(info->nl_net, pn); | 778 | pn->leaf = fib6_find_prefix(info->nl_net, pn); |
779 | #if RT6_DEBUG >= 2 | 779 | #if RT6_DEBUG >= 2 |
780 | if (!pn->leaf) { | 780 | if (!pn->leaf) { |
781 | BUG_TRAP(pn->leaf != NULL); | 781 | WARN_ON(pn->leaf == NULL); |
782 | pn->leaf = info->nl_net->ipv6.ip6_null_entry; | 782 | pn->leaf = info->nl_net->ipv6.ip6_null_entry; |
783 | } | 783 | } |
784 | #endif | 784 | #endif |
@@ -942,7 +942,7 @@ struct fib6_node * fib6_locate(struct fib6_node *root, | |||
942 | 942 | ||
943 | #ifdef CONFIG_IPV6_SUBTREES | 943 | #ifdef CONFIG_IPV6_SUBTREES |
944 | if (src_len) { | 944 | if (src_len) { |
945 | BUG_TRAP(saddr!=NULL); | 945 | WARN_ON(saddr == NULL); |
946 | if (fn && fn->subtree) | 946 | if (fn && fn->subtree) |
947 | fn = fib6_locate_1(fn->subtree, saddr, src_len, | 947 | fn = fib6_locate_1(fn->subtree, saddr, src_len, |
948 | offsetof(struct rt6_info, rt6i_src)); | 948 | offsetof(struct rt6_info, rt6i_src)); |
@@ -996,9 +996,9 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
996 | RT6_TRACE("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter); | 996 | RT6_TRACE("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter); |
997 | iter++; | 997 | iter++; |
998 | 998 | ||
999 | BUG_TRAP(!(fn->fn_flags&RTN_RTINFO)); | 999 | WARN_ON(fn->fn_flags & RTN_RTINFO); |
1000 | BUG_TRAP(!(fn->fn_flags&RTN_TL_ROOT)); | 1000 | WARN_ON(fn->fn_flags & RTN_TL_ROOT); |
1001 | BUG_TRAP(fn->leaf==NULL); | 1001 | WARN_ON(fn->leaf != NULL); |
1002 | 1002 | ||
1003 | children = 0; | 1003 | children = 0; |
1004 | child = NULL; | 1004 | child = NULL; |
@@ -1014,7 +1014,7 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
1014 | fn->leaf = fib6_find_prefix(net, fn); | 1014 | fn->leaf = fib6_find_prefix(net, fn); |
1015 | #if RT6_DEBUG >= 2 | 1015 | #if RT6_DEBUG >= 2 |
1016 | if (fn->leaf==NULL) { | 1016 | if (fn->leaf==NULL) { |
1017 | BUG_TRAP(fn->leaf); | 1017 | WARN_ON(!fn->leaf); |
1018 | fn->leaf = net->ipv6.ip6_null_entry; | 1018 | fn->leaf = net->ipv6.ip6_null_entry; |
1019 | } | 1019 | } |
1020 | #endif | 1020 | #endif |
@@ -1025,16 +1025,17 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
1025 | pn = fn->parent; | 1025 | pn = fn->parent; |
1026 | #ifdef CONFIG_IPV6_SUBTREES | 1026 | #ifdef CONFIG_IPV6_SUBTREES |
1027 | if (FIB6_SUBTREE(pn) == fn) { | 1027 | if (FIB6_SUBTREE(pn) == fn) { |
1028 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1028 | WARN_ON(!(fn->fn_flags & RTN_ROOT)); |
1029 | FIB6_SUBTREE(pn) = NULL; | 1029 | FIB6_SUBTREE(pn) = NULL; |
1030 | nstate = FWS_L; | 1030 | nstate = FWS_L; |
1031 | } else { | 1031 | } else { |
1032 | BUG_TRAP(!(fn->fn_flags&RTN_ROOT)); | 1032 | WARN_ON(fn->fn_flags & RTN_ROOT); |
1033 | #endif | 1033 | #endif |
1034 | if (pn->right == fn) pn->right = child; | 1034 | if (pn->right == fn) pn->right = child; |
1035 | else if (pn->left == fn) pn->left = child; | 1035 | else if (pn->left == fn) pn->left = child; |
1036 | #if RT6_DEBUG >= 2 | 1036 | #if RT6_DEBUG >= 2 |
1037 | else BUG_TRAP(0); | 1037 | else |
1038 | WARN_ON(1); | ||
1038 | #endif | 1039 | #endif |
1039 | if (child) | 1040 | if (child) |
1040 | child->parent = pn; | 1041 | child->parent = pn; |
@@ -1154,14 +1155,14 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info) | |||
1154 | 1155 | ||
1155 | #if RT6_DEBUG >= 2 | 1156 | #if RT6_DEBUG >= 2 |
1156 | if (rt->u.dst.obsolete>0) { | 1157 | if (rt->u.dst.obsolete>0) { |
1157 | BUG_TRAP(fn==NULL); | 1158 | WARN_ON(fn != NULL); |
1158 | return -ENOENT; | 1159 | return -ENOENT; |
1159 | } | 1160 | } |
1160 | #endif | 1161 | #endif |
1161 | if (fn == NULL || rt == net->ipv6.ip6_null_entry) | 1162 | if (fn == NULL || rt == net->ipv6.ip6_null_entry) |
1162 | return -ENOENT; | 1163 | return -ENOENT; |
1163 | 1164 | ||
1164 | BUG_TRAP(fn->fn_flags&RTN_RTINFO); | 1165 | WARN_ON(!(fn->fn_flags & RTN_RTINFO)); |
1165 | 1166 | ||
1166 | if (!(rt->rt6i_flags&RTF_CACHE)) { | 1167 | if (!(rt->rt6i_flags&RTF_CACHE)) { |
1167 | struct fib6_node *pn = fn; | 1168 | struct fib6_node *pn = fn; |
@@ -1266,7 +1267,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1266 | w->node = pn; | 1267 | w->node = pn; |
1267 | #ifdef CONFIG_IPV6_SUBTREES | 1268 | #ifdef CONFIG_IPV6_SUBTREES |
1268 | if (FIB6_SUBTREE(pn) == fn) { | 1269 | if (FIB6_SUBTREE(pn) == fn) { |
1269 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1270 | WARN_ON(!(fn->fn_flags & RTN_ROOT)); |
1270 | w->state = FWS_L; | 1271 | w->state = FWS_L; |
1271 | continue; | 1272 | continue; |
1272 | } | 1273 | } |
@@ -1281,7 +1282,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1281 | continue; | 1282 | continue; |
1282 | } | 1283 | } |
1283 | #if RT6_DEBUG >= 2 | 1284 | #if RT6_DEBUG >= 2 |
1284 | BUG_TRAP(0); | 1285 | WARN_ON(1); |
1285 | #endif | 1286 | #endif |
1286 | } | 1287 | } |
1287 | } | 1288 | } |
@@ -1323,7 +1324,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) | |||
1323 | } | 1324 | } |
1324 | return 0; | 1325 | return 0; |
1325 | } | 1326 | } |
1326 | BUG_TRAP(res==0); | 1327 | WARN_ON(res != 0); |
1327 | } | 1328 | } |
1328 | w->leaf = rt; | 1329 | w->leaf = rt; |
1329 | return 0; | 1330 | return 0; |