git: net/radix: Implement rn_flush() and rn_freehead()
Aaron LI
aly at crater.dragonflybsd.org
Wed Nov 15 17:42:20 PST 2023
commit 101038a20761af9cc74868304bd20b09d48e8bb1
Author: Aaron LI <aly at aaronly.me>
Date: Tue Nov 14 16:58:09 2023 +0800
net/radix: Implement rn_flush() and rn_freehead()
rn_flush() flushes all nodes in the given radix tree and thus makes the
tree empty; rn_freehead() can then free the emptied tree.
The separation of flushing and freeing is required to support the use
case in ipfw2, which needs to flush a table without destroying it.
A mask tree is somewhat special, because its nodes are allocated inside
this radix code, so the rn_freemask() callback function is provided to
be used in rn_flush() to flush a mask tree and reclaim its memory.
These APIs can help the radix users to easily flush and free the radix
trees without rolling their own versions.
Summary of changes:
sys/net/radix.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sys/net/radix.h | 5 ++++
2 files changed, 79 insertions(+)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/101038a20761af9cc74868304bd20b09d48e8bb1
--
DragonFly BSD source repository
More information about the Commits
mailing list