projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vlist: add a special node version -1 for nodes that should not be flushed on updates
[project/netifd.git]
/
utils.c
diff --git
a/utils.c
b/utils.c
index
629cdb2
..
e5f3d89
100644
(file)
--- a/
utils.c
+++ b/
utils.c
@@
-57,7
+57,8
@@
vlist_flush(struct vlist_tree *tree)
struct vlist_node *node, *tmp;
avl_for_each_element_safe(&tree->avl, node, avl, tmp) {
struct vlist_node *node, *tmp;
avl_for_each_element_safe(&tree->avl, node, avl, tmp) {
- if (node->version == tree->version)
+ if ((node->version == tree->version || node->version == -1) &&
+ tree->version != -1)
continue;
vlist_delete(tree, node);
continue;
vlist_delete(tree, node);
@@
-67,7
+68,7
@@
vlist_flush(struct vlist_tree *tree)
void
vlist_flush_all(struct vlist_tree *tree)
{
void
vlist_flush_all(struct vlist_tree *tree)
{
- tree->version
++
;
+ tree->version
= -1
;
vlist_flush(tree);
}
vlist_flush(tree);
}
@@
-96,7
+97,8
@@
vlist_simple_flush(struct vlist_simple_tree *tree)
struct vlist_simple_node *n, *tmp;
list_for_each_entry_safe(n, tmp, &tree->list, list) {
struct vlist_simple_node *n, *tmp;
list_for_each_entry_safe(n, tmp, &tree->list, list) {
- if (n->version == tree->version)
+ if ((n->version == tree->version || n->version == -1) &&
+ tree->version != -1)
continue;
vlist_simple_delete(tree, n);
continue;
vlist_simple_delete(tree, n);
@@
-106,6
+108,6
@@
vlist_simple_flush(struct vlist_simple_tree *tree)
void
vlist_simple_flush_all(struct vlist_simple_tree *tree)
{
void
vlist_simple_flush_all(struct vlist_simple_tree *tree)
{
- tree->version
++
;
+ tree->version
= -1
;
vlist_simple_flush(tree);
}
vlist_simple_flush(tree);
}