mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-14 21:44:41 +08:00
ll_map: Add function to remove link cache entry by index
Add ll_drop_by_index to remove an entry from the link cache. Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
9f78e995a8
commit
25c6339b22
@ -9,6 +9,7 @@ unsigned ll_name_to_index(const char *name);
|
||||
const char *ll_index_to_name(unsigned idx);
|
||||
int ll_index_to_type(unsigned idx);
|
||||
int ll_index_to_flags(unsigned idx);
|
||||
void ll_drop_by_index(unsigned index);
|
||||
unsigned namehash(const char *str);
|
||||
|
||||
const char *ll_idx_n2a(unsigned int idx);
|
||||
|
14
lib/ll_map.c
14
lib/ll_map.c
@ -210,6 +210,20 @@ unsigned ll_name_to_index(const char *name)
|
||||
return idx;
|
||||
}
|
||||
|
||||
void ll_drop_by_index(unsigned index)
|
||||
{
|
||||
struct ll_cache *im;
|
||||
|
||||
im = ll_get_by_index(index);
|
||||
if (!im)
|
||||
return;
|
||||
|
||||
hlist_del(&im->idx_hash);
|
||||
hlist_del(&im->name_hash);
|
||||
|
||||
free(im);
|
||||
}
|
||||
|
||||
void ll_init_map(struct rtnl_handle *rth)
|
||||
{
|
||||
static int initialized;
|
||||
|
Loading…
Reference in New Issue
Block a user