diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-02 23:48:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-02 23:48:47 -0500 |
commit | b299e4f001cfa16205f9121f4630970049652268 (patch) | |
tree | 81ea9a19ff8096f40b1340a8e41c4c254623ef2f | |
parent | 442b9635c569fef038d5367a7acd906db4677ae1 (diff) |
ipv4: Fix fib_trie build in some configurations.
If we end up including include/linux/node.h (either explicitly
or implicitly) that header has a definition of "structt node"
too.
So rename the one we use in fib_trie to "rt_trie_node" to avoid
the conflict.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/fib_trie.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 73cb98475ce6..1eae90b054eb 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -95,7 +95,7 @@ typedef unsigned int t_key; | |||
95 | #define IS_TNODE(n) (!(n->parent & T_LEAF)) | 95 | #define IS_TNODE(n) (!(n->parent & T_LEAF)) |
96 | #define IS_LEAF(n) (n->parent & T_LEAF) | 96 | #define IS_LEAF(n) (n->parent & T_LEAF) |
97 | 97 | ||
98 | struct node { | 98 | struct rt_trie_node { |
99 | unsigned long parent; | 99 | unsigned long parent; |
100 | t_key key; | 100 | t_key key; |
101 | }; | 101 | }; |
@@ -126,7 +126,7 @@ struct tnode { | |||
126 | struct work_struct work; | 126 | struct work_struct work; |
127 | struct tnode *tnode_free; | 127 | struct tnode *tnode_free; |
128 | }; | 128 | }; |
129 | struct node *child[0]; | 129 | struct rt_trie_node *child[0]; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | #ifdef CONFIG_IP_FIB_TRIE_STATS | 132 | #ifdef CONFIG_IP_FIB_TRIE_STATS |
@@ -151,16 +151,16 @@ struct trie_stat { | |||
151 | }; | 151 | }; |
152 | 152 | ||
153 | struct trie { | 153 | struct trie { |
154 | struct node *trie; | 154 | struct rt_trie_node *trie; |
155 | #ifdef CONFIG_IP_FIB_TRIE_STATS | 155 | #ifdef CONFIG_IP_FIB_TRIE_STATS |
156 | struct trie_use_stats stats; | 156 | struct trie_use_stats stats; |
157 | #endif | 157 | #endif |
158 | }; | 158 | }; |
159 | 159 | ||
160 | static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n); | 160 | static void put_child(struct trie *t, struct tnode *tn, int i, struct rt_trie_node *n); |
161 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, | 161 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, |
162 | int wasfull); | 162 | int wasfull); |
163 | static struct node *resize(struct trie *t, struct tnode *tn); | 163 | static struct rt_trie_node *resize(struct trie *t, struct tnode *tn); |
164 | static struct tnode *inflate(struct trie *t, struct tnode *tn); | 164 | static struct tnode *inflate(struct trie *t, struct tnode *tn); |
165 | static struct tnode *halve(struct trie *t, struct tnode *tn); | 165 | static struct tnode *halve(struct trie *t, struct tnode *tn); |
166 | /* tnodes to free after resize(); protected by RTNL */ | 166 | /* tnodes to free after resize(); protected by RTNL */ |
@@ -177,12 +177,12 @@ static const int sync_pages = 128; | |||
177 | static struct kmem_cache *fn_alias_kmem __read_mostly; | 177 | static struct kmem_cache *fn_alias_kmem __read_mostly; |
178 | static struct kmem_cache *trie_leaf_kmem __read_mostly; | 178 | static struct kmem_cache *trie_leaf_kmem __read_mostly; |
179 | 179 | ||
180 | static inline struct tnode *node_parent(struct node *node) | 180 | static inline struct tnode *node_parent(struct rt_trie_node *node) |
181 | { | 181 | { |
182 | return (struct tnode *)(node->parent & ~NODE_TYPE_MASK); | 182 | return (struct tnode *)(node->parent & ~NODE_TYPE_MASK); |
183 | } | 183 | } |
184 | 184 | ||
185 | static inline struct tnode *node_parent_rcu(struct node *node) | 185 | static inline struct tnode *node_parent_rcu(struct rt_trie_node *node) |
186 | { | 186 | { |
187 | struct tnode *ret = node_parent(node); | 187 | struct tnode *ret = node_parent(node); |
188 | 188 | ||
@@ -192,22 +192,22 @@ static inline struct tnode *node_parent_rcu(struct node *node) | |||
192 | /* Same as rcu_assign_pointer | 192 | /* Same as rcu_assign_pointer |
193 | * but that macro() assumes that value is a pointer. | 193 | * but that macro() assumes that value is a pointer. |
194 | */ | 194 | */ |
195 | static inline void node_set_parent(struct node *node, struct tnode *ptr) | 195 | static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) |
196 | { | 196 | { |
197 | smp_wmb(); | 197 | smp_wmb(); |
198 | node->parent = (unsigned long)ptr | NODE_TYPE(node); | 198 | node->parent = (unsigned long)ptr | NODE_TYPE(node); |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline struct node *tnode_get_child(struct tnode *tn, unsigned int i) | 201 | static inline struct rt_trie_node *tnode_get_child(struct tnode *tn, unsigned int i) |
202 | { | 202 | { |
203 | BUG_ON(i >= 1U << tn->bits); | 203 | BUG_ON(i >= 1U << tn->bits); |
204 | 204 | ||
205 | return tn->child[i]; | 205 | return tn->child[i]; |
206 | } | 206 | } |
207 | 207 | ||
208 | static inline struct node *tnode_get_child_rcu(struct tnode *tn, unsigned int i) | 208 | static inline struct rt_trie_node *tnode_get_child_rcu(struct tnode *tn, unsigned int i) |
209 | { | 209 | { |
210 | struct node *ret = tnode_get_child(tn, i); | 210 | struct rt_trie_node *ret = tnode_get_child(tn, i); |
211 | 211 | ||
212 | return rcu_dereference_rtnl(ret); | 212 | return rcu_dereference_rtnl(ret); |
213 | } | 213 | } |
@@ -378,7 +378,7 @@ static void __tnode_free_rcu(struct rcu_head *head) | |||
378 | { | 378 | { |
379 | struct tnode *tn = container_of(head, struct tnode, rcu); | 379 | struct tnode *tn = container_of(head, struct tnode, rcu); |
380 | size_t size = sizeof(struct tnode) + | 380 | size_t size = sizeof(struct tnode) + |
381 | (sizeof(struct node *) << tn->bits); | 381 | (sizeof(struct rt_trie_node *) << tn->bits); |
382 | 382 | ||
383 | if (size <= PAGE_SIZE) | 383 | if (size <= PAGE_SIZE) |
384 | kfree(tn); | 384 | kfree(tn); |
@@ -402,7 +402,7 @@ static void tnode_free_safe(struct tnode *tn) | |||
402 | tn->tnode_free = tnode_free_head; | 402 | tn->tnode_free = tnode_free_head; |
403 | tnode_free_head = tn; | 403 | tnode_free_head = tn; |
404 | tnode_free_size += sizeof(struct tnode) + | 404 | tnode_free_size += sizeof(struct tnode) + |
405 | (sizeof(struct node *) << tn->bits); | 405 | (sizeof(struct rt_trie_node *) << tn->bits); |
406 | } | 406 | } |
407 | 407 | ||
408 | static void tnode_free_flush(void) | 408 | static void tnode_free_flush(void) |
@@ -443,7 +443,7 @@ static struct leaf_info *leaf_info_new(int plen) | |||
443 | 443 | ||
444 | static struct tnode *tnode_new(t_key key, int pos, int bits) | 444 | static struct tnode *tnode_new(t_key key, int pos, int bits) |
445 | { | 445 | { |
446 | size_t sz = sizeof(struct tnode) + (sizeof(struct node *) << bits); | 446 | size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); |
447 | struct tnode *tn = tnode_alloc(sz); | 447 | struct tnode *tn = tnode_alloc(sz); |
448 | 448 | ||
449 | if (tn) { | 449 | if (tn) { |
@@ -456,7 +456,7 @@ static struct tnode *tnode_new(t_key key, int pos, int bits) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), | 458 | pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), |
459 | sizeof(struct node) << bits); | 459 | sizeof(struct rt_trie_node) << bits); |
460 | return tn; | 460 | return tn; |
461 | } | 461 | } |
462 | 462 | ||
@@ -465,7 +465,7 @@ static struct tnode *tnode_new(t_key key, int pos, int bits) | |||
465 | * and no bits are skipped. See discussion in dyntree paper p. 6 | 465 | * and no bits are skipped. See discussion in dyntree paper p. 6 |
466 | */ | 466 | */ |
467 | 467 | ||
468 | static inline int tnode_full(const struct tnode *tn, const struct node *n) | 468 | static inline int tnode_full(const struct tnode *tn, const struct rt_trie_node *n) |
469 | { | 469 | { |
470 | if (n == NULL || IS_LEAF(n)) | 470 | if (n == NULL || IS_LEAF(n)) |
471 | return 0; | 471 | return 0; |
@@ -474,7 +474,7 @@ static inline int tnode_full(const struct tnode *tn, const struct node *n) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | static inline void put_child(struct trie *t, struct tnode *tn, int i, | 476 | static inline void put_child(struct trie *t, struct tnode *tn, int i, |
477 | struct node *n) | 477 | struct rt_trie_node *n) |
478 | { | 478 | { |
479 | tnode_put_child_reorg(tn, i, n, -1); | 479 | tnode_put_child_reorg(tn, i, n, -1); |
480 | } | 480 | } |
@@ -484,10 +484,10 @@ static inline void put_child(struct trie *t, struct tnode *tn, int i, | |||
484 | * Update the value of full_children and empty_children. | 484 | * Update the value of full_children and empty_children. |
485 | */ | 485 | */ |
486 | 486 | ||
487 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, | 487 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, |
488 | int wasfull) | 488 | int wasfull) |
489 | { | 489 | { |
490 | struct node *chi = tn->child[i]; | 490 | struct rt_trie_node *chi = tn->child[i]; |
491 | int isfull; | 491 | int isfull; |
492 | 492 | ||
493 | BUG_ON(i >= 1<<tn->bits); | 493 | BUG_ON(i >= 1<<tn->bits); |
@@ -515,7 +515,7 @@ static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, | |||
515 | } | 515 | } |
516 | 516 | ||
517 | #define MAX_WORK 10 | 517 | #define MAX_WORK 10 |
518 | static struct node *resize(struct trie *t, struct tnode *tn) | 518 | static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) |
519 | { | 519 | { |
520 | int i; | 520 | int i; |
521 | struct tnode *old_tn; | 521 | struct tnode *old_tn; |
@@ -605,7 +605,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
605 | 605 | ||
606 | /* Keep root node larger */ | 606 | /* Keep root node larger */ |
607 | 607 | ||
608 | if (!node_parent((struct node *)tn)) { | 608 | if (!node_parent((struct rt_trie_node *)tn)) { |
609 | inflate_threshold_use = inflate_threshold_root; | 609 | inflate_threshold_use = inflate_threshold_root; |
610 | halve_threshold_use = halve_threshold_root; | 610 | halve_threshold_use = halve_threshold_root; |
611 | } else { | 611 | } else { |
@@ -635,7 +635,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
635 | 635 | ||
636 | /* Return if at least one inflate is run */ | 636 | /* Return if at least one inflate is run */ |
637 | if (max_work != MAX_WORK) | 637 | if (max_work != MAX_WORK) |
638 | return (struct node *) tn; | 638 | return (struct rt_trie_node *) tn; |
639 | 639 | ||
640 | /* | 640 | /* |
641 | * Halve as long as the number of empty children in this | 641 | * Halve as long as the number of empty children in this |
@@ -663,7 +663,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
663 | if (tn->empty_children == tnode_child_length(tn) - 1) { | 663 | if (tn->empty_children == tnode_child_length(tn) - 1) { |
664 | one_child: | 664 | one_child: |
665 | for (i = 0; i < tnode_child_length(tn); i++) { | 665 | for (i = 0; i < tnode_child_length(tn); i++) { |
666 | struct node *n; | 666 | struct rt_trie_node *n; |
667 | 667 | ||
668 | n = tn->child[i]; | 668 | n = tn->child[i]; |
669 | if (!n) | 669 | if (!n) |
@@ -676,7 +676,7 @@ one_child: | |||
676 | return n; | 676 | return n; |
677 | } | 677 | } |
678 | } | 678 | } |
679 | return (struct node *) tn; | 679 | return (struct rt_trie_node *) tn; |
680 | } | 680 | } |
681 | 681 | ||
682 | static struct tnode *inflate(struct trie *t, struct tnode *tn) | 682 | static struct tnode *inflate(struct trie *t, struct tnode *tn) |
@@ -723,14 +723,14 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) | |||
723 | goto nomem; | 723 | goto nomem; |
724 | } | 724 | } |
725 | 725 | ||
726 | put_child(t, tn, 2*i, (struct node *) left); | 726 | put_child(t, tn, 2*i, (struct rt_trie_node *) left); |
727 | put_child(t, tn, 2*i+1, (struct node *) right); | 727 | put_child(t, tn, 2*i+1, (struct rt_trie_node *) right); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | for (i = 0; i < olen; i++) { | 731 | for (i = 0; i < olen; i++) { |
732 | struct tnode *inode; | 732 | struct tnode *inode; |
733 | struct node *node = tnode_get_child(oldtnode, i); | 733 | struct rt_trie_node *node = tnode_get_child(oldtnode, i); |
734 | struct tnode *left, *right; | 734 | struct tnode *left, *right; |
735 | int size, j; | 735 | int size, j; |
736 | 736 | ||
@@ -825,7 +825,7 @@ nomem: | |||
825 | static struct tnode *halve(struct trie *t, struct tnode *tn) | 825 | static struct tnode *halve(struct trie *t, struct tnode *tn) |
826 | { | 826 | { |
827 | struct tnode *oldtnode = tn; | 827 | struct tnode *oldtnode = tn; |
828 | struct node *left, *right; | 828 | struct rt_trie_node *left, *right; |
829 | int i; | 829 | int i; |
830 | int olen = tnode_child_length(tn); | 830 | int olen = tnode_child_length(tn); |
831 | 831 | ||
@@ -856,7 +856,7 @@ static struct tnode *halve(struct trie *t, struct tnode *tn) | |||
856 | if (!newn) | 856 | if (!newn) |
857 | goto nomem; | 857 | goto nomem; |
858 | 858 | ||
859 | put_child(t, tn, i/2, (struct node *)newn); | 859 | put_child(t, tn, i/2, (struct rt_trie_node *)newn); |
860 | } | 860 | } |
861 | 861 | ||
862 | } | 862 | } |
@@ -958,7 +958,7 @@ fib_find_node(struct trie *t, u32 key) | |||
958 | { | 958 | { |
959 | int pos; | 959 | int pos; |
960 | struct tnode *tn; | 960 | struct tnode *tn; |
961 | struct node *n; | 961 | struct rt_trie_node *n; |
962 | 962 | ||
963 | pos = 0; | 963 | pos = 0; |
964 | n = rcu_dereference_rtnl(t->trie); | 964 | n = rcu_dereference_rtnl(t->trie); |
@@ -993,17 +993,17 @@ static void trie_rebalance(struct trie *t, struct tnode *tn) | |||
993 | 993 | ||
994 | key = tn->key; | 994 | key = tn->key; |
995 | 995 | ||
996 | while (tn != NULL && (tp = node_parent((struct node *)tn)) != NULL) { | 996 | while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { |
997 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 997 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
998 | wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); | 998 | wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); |
999 | tn = (struct tnode *) resize(t, (struct tnode *)tn); | 999 | tn = (struct tnode *) resize(t, (struct tnode *)tn); |
1000 | 1000 | ||
1001 | tnode_put_child_reorg((struct tnode *)tp, cindex, | 1001 | tnode_put_child_reorg((struct tnode *)tp, cindex, |
1002 | (struct node *)tn, wasfull); | 1002 | (struct rt_trie_node *)tn, wasfull); |
1003 | 1003 | ||
1004 | tp = node_parent((struct node *) tn); | 1004 | tp = node_parent((struct rt_trie_node *) tn); |
1005 | if (!tp) | 1005 | if (!tp) |
1006 | rcu_assign_pointer(t->trie, (struct node *)tn); | 1006 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); |
1007 | 1007 | ||
1008 | tnode_free_flush(); | 1008 | tnode_free_flush(); |
1009 | if (!tp) | 1009 | if (!tp) |
@@ -1015,7 +1015,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn) | |||
1015 | if (IS_TNODE(tn)) | 1015 | if (IS_TNODE(tn)) |
1016 | tn = (struct tnode *)resize(t, (struct tnode *)tn); | 1016 | tn = (struct tnode *)resize(t, (struct tnode *)tn); |
1017 | 1017 | ||
1018 | rcu_assign_pointer(t->trie, (struct node *)tn); | 1018 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); |
1019 | tnode_free_flush(); | 1019 | tnode_free_flush(); |
1020 | } | 1020 | } |
1021 | 1021 | ||
@@ -1025,7 +1025,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) | |||
1025 | { | 1025 | { |
1026 | int pos, newpos; | 1026 | int pos, newpos; |
1027 | struct tnode *tp = NULL, *tn = NULL; | 1027 | struct tnode *tp = NULL, *tn = NULL; |
1028 | struct node *n; | 1028 | struct rt_trie_node *n; |
1029 | struct leaf *l; | 1029 | struct leaf *l; |
1030 | int missbit; | 1030 | int missbit; |
1031 | struct list_head *fa_head = NULL; | 1031 | struct list_head *fa_head = NULL; |
@@ -1111,10 +1111,10 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) | |||
1111 | if (t->trie && n == NULL) { | 1111 | if (t->trie && n == NULL) { |
1112 | /* Case 2: n is NULL, and will just insert a new leaf */ | 1112 | /* Case 2: n is NULL, and will just insert a new leaf */ |
1113 | 1113 | ||
1114 | node_set_parent((struct node *)l, tp); | 1114 | node_set_parent((struct rt_trie_node *)l, tp); |
1115 | 1115 | ||
1116 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 1116 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
1117 | put_child(t, (struct tnode *)tp, cindex, (struct node *)l); | 1117 | put_child(t, (struct tnode *)tp, cindex, (struct rt_trie_node *)l); |
1118 | } else { | 1118 | } else { |
1119 | /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ | 1119 | /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ |
1120 | /* | 1120 | /* |
@@ -1141,18 +1141,18 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) | |||
1141 | return NULL; | 1141 | return NULL; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | node_set_parent((struct node *)tn, tp); | 1144 | node_set_parent((struct rt_trie_node *)tn, tp); |
1145 | 1145 | ||
1146 | missbit = tkey_extract_bits(key, newpos, 1); | 1146 | missbit = tkey_extract_bits(key, newpos, 1); |
1147 | put_child(t, tn, missbit, (struct node *)l); | 1147 | put_child(t, tn, missbit, (struct rt_trie_node *)l); |
1148 | put_child(t, tn, 1-missbit, n); | 1148 | put_child(t, tn, 1-missbit, n); |
1149 | 1149 | ||
1150 | if (tp) { | 1150 | if (tp) { |
1151 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 1151 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
1152 | put_child(t, (struct tnode *)tp, cindex, | 1152 | put_child(t, (struct tnode *)tp, cindex, |
1153 | (struct node *)tn); | 1153 | (struct rt_trie_node *)tn); |
1154 | } else { | 1154 | } else { |
1155 | rcu_assign_pointer(t->trie, (struct node *)tn); | 1155 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); |
1156 | tp = tn; | 1156 | tp = tn; |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
@@ -1376,7 +1376,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | |||
1376 | { | 1376 | { |
1377 | struct trie *t = (struct trie *) tb->tb_data; | 1377 | struct trie *t = (struct trie *) tb->tb_data; |
1378 | int ret; | 1378 | int ret; |
1379 | struct node *n; | 1379 | struct rt_trie_node *n; |
1380 | struct tnode *pn; | 1380 | struct tnode *pn; |
1381 | int pos, bits; | 1381 | int pos, bits; |
1382 | t_key key = ntohl(flp->fl4_dst); | 1382 | t_key key = ntohl(flp->fl4_dst); |
@@ -1541,7 +1541,7 @@ backtrace: | |||
1541 | if (chopped_off <= pn->bits) { | 1541 | if (chopped_off <= pn->bits) { |
1542 | cindex &= ~(1 << (chopped_off-1)); | 1542 | cindex &= ~(1 << (chopped_off-1)); |
1543 | } else { | 1543 | } else { |
1544 | struct tnode *parent = node_parent_rcu((struct node *) pn); | 1544 | struct tnode *parent = node_parent_rcu((struct rt_trie_node *) pn); |
1545 | if (!parent) | 1545 | if (!parent) |
1546 | goto failed; | 1546 | goto failed; |
1547 | 1547 | ||
@@ -1568,7 +1568,7 @@ found: | |||
1568 | */ | 1568 | */ |
1569 | static void trie_leaf_remove(struct trie *t, struct leaf *l) | 1569 | static void trie_leaf_remove(struct trie *t, struct leaf *l) |
1570 | { | 1570 | { |
1571 | struct tnode *tp = node_parent((struct node *) l); | 1571 | struct tnode *tp = node_parent((struct rt_trie_node *) l); |
1572 | 1572 | ||
1573 | pr_debug("entering trie_leaf_remove(%p)\n", l); | 1573 | pr_debug("entering trie_leaf_remove(%p)\n", l); |
1574 | 1574 | ||
@@ -1706,7 +1706,7 @@ static int trie_flush_leaf(struct leaf *l) | |||
1706 | * Scan for the next right leaf starting at node p->child[idx] | 1706 | * Scan for the next right leaf starting at node p->child[idx] |
1707 | * Since we have back pointer, no recursion necessary. | 1707 | * Since we have back pointer, no recursion necessary. |
1708 | */ | 1708 | */ |
1709 | static struct leaf *leaf_walk_rcu(struct tnode *p, struct node *c) | 1709 | static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) |
1710 | { | 1710 | { |
1711 | do { | 1711 | do { |
1712 | t_key idx; | 1712 | t_key idx; |
@@ -1732,7 +1732,7 @@ static struct leaf *leaf_walk_rcu(struct tnode *p, struct node *c) | |||
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | /* Node empty, walk back up to parent */ | 1734 | /* Node empty, walk back up to parent */ |
1735 | c = (struct node *) p; | 1735 | c = (struct rt_trie_node *) p; |
1736 | } while ((p = node_parent_rcu(c)) != NULL); | 1736 | } while ((p = node_parent_rcu(c)) != NULL); |
1737 | 1737 | ||
1738 | return NULL; /* Root of trie */ | 1738 | return NULL; /* Root of trie */ |
@@ -1753,7 +1753,7 @@ static struct leaf *trie_firstleaf(struct trie *t) | |||
1753 | 1753 | ||
1754 | static struct leaf *trie_nextleaf(struct leaf *l) | 1754 | static struct leaf *trie_nextleaf(struct leaf *l) |
1755 | { | 1755 | { |
1756 | struct node *c = (struct node *) l; | 1756 | struct rt_trie_node *c = (struct rt_trie_node *) l; |
1757 | struct tnode *p = node_parent_rcu(c); | 1757 | struct tnode *p = node_parent_rcu(c); |
1758 | 1758 | ||
1759 | if (!p) | 1759 | if (!p) |
@@ -1961,7 +1961,7 @@ struct fib_trie_iter { | |||
1961 | unsigned int depth; | 1961 | unsigned int depth; |
1962 | }; | 1962 | }; |
1963 | 1963 | ||
1964 | static struct node *fib_trie_get_next(struct fib_trie_iter *iter) | 1964 | static struct rt_trie_node *fib_trie_get_next(struct fib_trie_iter *iter) |
1965 | { | 1965 | { |
1966 | struct tnode *tn = iter->tnode; | 1966 | struct tnode *tn = iter->tnode; |
1967 | unsigned int cindex = iter->index; | 1967 | unsigned int cindex = iter->index; |
@@ -1975,7 +1975,7 @@ static struct node *fib_trie_get_next(struct fib_trie_iter *iter) | |||
1975 | iter->tnode, iter->index, iter->depth); | 1975 | iter->tnode, iter->index, iter->depth); |
1976 | rescan: | 1976 | rescan: |
1977 | while (cindex < (1<<tn->bits)) { | 1977 | while (cindex < (1<<tn->bits)) { |
1978 | struct node *n = tnode_get_child_rcu(tn, cindex); | 1978 | struct rt_trie_node *n = tnode_get_child_rcu(tn, cindex); |
1979 | 1979 | ||
1980 | if (n) { | 1980 | if (n) { |
1981 | if (IS_LEAF(n)) { | 1981 | if (IS_LEAF(n)) { |
@@ -1994,7 +1994,7 @@ rescan: | |||
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | /* Current node exhausted, pop back up */ | 1996 | /* Current node exhausted, pop back up */ |
1997 | p = node_parent_rcu((struct node *)tn); | 1997 | p = node_parent_rcu((struct rt_trie_node *)tn); |
1998 | if (p) { | 1998 | if (p) { |
1999 | cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; | 1999 | cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; |
2000 | tn = p; | 2000 | tn = p; |
@@ -2006,10 +2006,10 @@ rescan: | |||
2006 | return NULL; | 2006 | return NULL; |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | static struct node *fib_trie_get_first(struct fib_trie_iter *iter, | 2009 | static struct rt_trie_node *fib_trie_get_first(struct fib_trie_iter *iter, |
2010 | struct trie *t) | 2010 | struct trie *t) |
2011 | { | 2011 | { |
2012 | struct node *n; | 2012 | struct rt_trie_node *n; |
2013 | 2013 | ||
2014 | if (!t) | 2014 | if (!t) |
2015 | return NULL; | 2015 | return NULL; |
@@ -2033,7 +2033,7 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter, | |||
2033 | 2033 | ||
2034 | static void trie_collect_stats(struct trie *t, struct trie_stat *s) | 2034 | static void trie_collect_stats(struct trie *t, struct trie_stat *s) |
2035 | { | 2035 | { |
2036 | struct node *n; | 2036 | struct rt_trie_node *n; |
2037 | struct fib_trie_iter iter; | 2037 | struct fib_trie_iter iter; |
2038 | 2038 | ||
2039 | memset(s, 0, sizeof(*s)); | 2039 | memset(s, 0, sizeof(*s)); |
@@ -2106,7 +2106,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat) | |||
2106 | seq_putc(seq, '\n'); | 2106 | seq_putc(seq, '\n'); |
2107 | seq_printf(seq, "\tPointers: %u\n", pointers); | 2107 | seq_printf(seq, "\tPointers: %u\n", pointers); |
2108 | 2108 | ||
2109 | bytes += sizeof(struct node *) * pointers; | 2109 | bytes += sizeof(struct rt_trie_node *) * pointers; |
2110 | seq_printf(seq, "Null ptrs: %u\n", stat->nullpointers); | 2110 | seq_printf(seq, "Null ptrs: %u\n", stat->nullpointers); |
2111 | seq_printf(seq, "Total size: %u kB\n", (bytes + 1023) / 1024); | 2111 | seq_printf(seq, "Total size: %u kB\n", (bytes + 1023) / 1024); |
2112 | } | 2112 | } |
@@ -2187,7 +2187,7 @@ static const struct file_operations fib_triestat_fops = { | |||
2187 | .release = single_release_net, | 2187 | .release = single_release_net, |
2188 | }; | 2188 | }; |
2189 | 2189 | ||
2190 | static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) | 2190 | static struct rt_trie_node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) |
2191 | { | 2191 | { |
2192 | struct fib_trie_iter *iter = seq->private; | 2192 | struct fib_trie_iter *iter = seq->private; |
2193 | struct net *net = seq_file_net(seq); | 2193 | struct net *net = seq_file_net(seq); |
@@ -2200,7 +2200,7 @@ static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) | |||
2200 | struct fib_table *tb; | 2200 | struct fib_table *tb; |
2201 | 2201 | ||
2202 | hlist_for_each_entry_rcu(tb, node, head, tb_hlist) { | 2202 | hlist_for_each_entry_rcu(tb, node, head, tb_hlist) { |
2203 | struct node *n; | 2203 | struct rt_trie_node *n; |
2204 | 2204 | ||
2205 | for (n = fib_trie_get_first(iter, | 2205 | for (n = fib_trie_get_first(iter, |
2206 | (struct trie *) tb->tb_data); | 2206 | (struct trie *) tb->tb_data); |
@@ -2229,7 +2229,7 @@ static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2229 | struct fib_table *tb = iter->tb; | 2229 | struct fib_table *tb = iter->tb; |
2230 | struct hlist_node *tb_node; | 2230 | struct hlist_node *tb_node; |
2231 | unsigned int h; | 2231 | unsigned int h; |
2232 | struct node *n; | 2232 | struct rt_trie_node *n; |
2233 | 2233 | ||
2234 | ++*pos; | 2234 | ++*pos; |
2235 | /* next node in same table */ | 2235 | /* next node in same table */ |
@@ -2315,7 +2315,7 @@ static inline const char *rtn_type(char *buf, size_t len, unsigned int t) | |||
2315 | static int fib_trie_seq_show(struct seq_file *seq, void *v) | 2315 | static int fib_trie_seq_show(struct seq_file *seq, void *v) |
2316 | { | 2316 | { |
2317 | const struct fib_trie_iter *iter = seq->private; | 2317 | const struct fib_trie_iter *iter = seq->private; |
2318 | struct node *n = v; | 2318 | struct rt_trie_node *n = v; |
2319 | 2319 | ||
2320 | if (!node_parent_rcu(n)) | 2320 | if (!node_parent_rcu(n)) |
2321 | fib_table_print(seq, iter->tb); | 2321 | fib_table_print(seq, iter->tb); |