projects
/
project
/
qosify.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
map: make a helper function for freeing entries
[project/qosify.git]
/
map.c
diff --git
a/map.c
b/map.c
index 636a46be2816ea35806b193a6e68deec40ed6e5f..2eacfcdc40b67ac391913aef7bd798b4da3bcfb1 100644
(file)
--- a/
map.c
+++ b/
map.c
@@
-506,12
+506,20
@@
void qosify_map_reload(void)
qosify_map_gc();
}
qosify_map_gc();
}
+static void qosify_map_free_entry(struct qosify_map_entry *e)
+{
+ int fd = qosify_map_fds[e->data.id];
+
+ avl_delete(&map_data, &e->avl);
+ bpf_map_delete_elem(fd, &e->data.addr);
+ free(e);
+}
+
void qosify_map_gc(void)
{
struct qosify_map_entry *e, *tmp;
int32_t timeout = 0;
uint32_t cur_time = qosify_gettime();
void qosify_map_gc(void)
{
struct qosify_map_entry *e, *tmp;
int32_t timeout = 0;
uint32_t cur_time = qosify_gettime();
- int fd;
next_timeout = 0;
avl_for_each_element_safe(&map_data, e, avl, tmp) {
next_timeout = 0;
avl_for_each_element_safe(&map_data, e, avl, tmp) {
@@
-531,10
+539,7
@@
void qosify_map_gc(void)
if (e->data.file || e->data.user)
continue;
if (e->data.file || e->data.user)
continue;
- avl_delete(&map_data, &e->avl);
- fd = qosify_map_fds[e->data.id];
- bpf_map_delete_elem(fd, &e->data.addr);
- free(e);
+ qosify_map_free_entry(e);
}
if (!timeout)
}
if (!timeout)