mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
network: move mdb_entry_free() and friends
This commit is contained in:
parent
ee446d57b8
commit
8c06da1cd1
@ -10,6 +10,27 @@
|
||||
|
||||
#define STATIC_MDB_ENTRIES_PER_NETWORK_MAX 1024U
|
||||
|
||||
/* remove MDB entry. */
|
||||
MdbEntry *mdb_entry_free(MdbEntry *mdb_entry) {
|
||||
if (!mdb_entry)
|
||||
return NULL;
|
||||
|
||||
if (mdb_entry->network) {
|
||||
LIST_REMOVE(static_mdb_entries, mdb_entry->network->static_mdb_entries, mdb_entry);
|
||||
assert(mdb_entry->network->n_static_mdb_entries > 0);
|
||||
mdb_entry->network->n_static_mdb_entries--;
|
||||
|
||||
if (mdb_entry->section)
|
||||
hashmap_remove(mdb_entry->network->mdb_entries_by_section, mdb_entry->section);
|
||||
}
|
||||
|
||||
network_config_section_free(mdb_entry->section);
|
||||
|
||||
return mfree(mdb_entry);
|
||||
}
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(MdbEntry, mdb_entry_free);
|
||||
|
||||
/* create a new MDB entry or get an existing one. */
|
||||
static int mdb_entry_new_static(
|
||||
Network *network,
|
||||
@ -72,25 +93,6 @@ static int mdb_entry_new_static(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* remove and MDB entry. */
|
||||
MdbEntry *mdb_entry_free(MdbEntry *mdb_entry) {
|
||||
if (!mdb_entry)
|
||||
return NULL;
|
||||
|
||||
if (mdb_entry->network) {
|
||||
LIST_REMOVE(static_mdb_entries, mdb_entry->network->static_mdb_entries, mdb_entry);
|
||||
assert(mdb_entry->network->n_static_mdb_entries > 0);
|
||||
mdb_entry->network->n_static_mdb_entries--;
|
||||
|
||||
if (mdb_entry->section)
|
||||
hashmap_remove(mdb_entry->network->mdb_entries_by_section, mdb_entry->section);
|
||||
}
|
||||
|
||||
network_config_section_free(mdb_entry->section);
|
||||
|
||||
return mfree(mdb_entry);
|
||||
}
|
||||
|
||||
static int set_mdb_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
|
@ -26,7 +26,5 @@ int mdb_entry_verify(MdbEntry *mdb_entry);
|
||||
MdbEntry *mdb_entry_free(MdbEntry *mdb_entry);
|
||||
int link_set_bridge_mdb(Link *link);
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(MdbEntry, mdb_entry_free);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_mdb_group_address);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_mdb_vlan_id);
|
||||
|
Loading…
Reference in New Issue
Block a user