65109d7b262ef82837dbfb2912922c4f036a3956
2 * netifd - network interface daemon
3 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
19 __vlist_simple_init(struct vlist_simple_tree
*tree
, int offset
)
21 INIT_LIST_HEAD(&tree
->list
);
23 tree
->head_offset
= offset
;
27 vlist_simple_delete(struct vlist_simple_tree
*tree
, struct vlist_simple_node
*node
)
31 list_del(&node
->list
);
32 ptr
= (char *) node
- tree
->head_offset
;
37 vlist_simple_flush(struct vlist_simple_tree
*tree
)
39 struct vlist_simple_node
*n
, *tmp
;
41 list_for_each_entry_safe(n
, tmp
, &tree
->list
, list
) {
42 if ((n
->version
== tree
->version
|| n
->version
== -1) &&
46 vlist_simple_delete(tree
, n
);
51 vlist_simple_replace(struct vlist_simple_tree
*dest
, struct vlist_simple_tree
*old
)
53 struct vlist_simple_node
*n
, *tmp
;
55 vlist_simple_update(dest
);
56 list_for_each_entry_safe(n
, tmp
, &old
->list
, list
) {
58 vlist_simple_add(dest
, n
);
60 vlist_simple_flush(dest
);
64 vlist_simple_flush_all(struct vlist_simple_tree
*tree
)
67 vlist_simple_flush(tree
);