network/netdev: use hashmap_remove_value() on detaching NetDev from manager

Then, it is not necessary to free NetDev.ifname when a conflicting
.netdev file is already loaded.

This also split out netdev_detach_name() and netdev_detach_impl().

No functional change, just refactoring.
This commit is contained in:
Yu Watanabe
2024-09-10 19:29:05 +09:00
parent bc0d3f3842
commit 0dc71b9584
2 changed files with 28 additions and 11 deletions
+3
View File
@@ -195,6 +195,9 @@ extern const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX];
/* For casting the various netdev kinds into a netdev */
#define NETDEV(n) (&(n)->meta)
NetDev* netdev_detach_name(NetDev *netdev, const char *name);
void netdev_detach(NetDev *netdev);
int netdev_load(Manager *manager, bool reload);
int netdev_load_one(Manager *manager, const char *filename);
void netdev_drop(NetDev *netdev);