mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-21 09:30:39 +01:00
core: split nm_netns_watcher_remove_all()
The name suggests that the function always removes all the watchers with the given tag; instead it removes only "dirty" ones when the "all" parameter is FALSE. Split the function in two variants. (cherry picked from commitb6e67c6abc) (cherry picked from commita301c259f2)
This commit is contained in:
parent
8b39a79621
commit
30d31eea64
3 changed files with 22 additions and 11 deletions
|
|
@ -4764,7 +4764,7 @@ next:
|
|||
}
|
||||
|
||||
out:
|
||||
nm_netns_watcher_remove_all(self->priv.netns, TAG, FALSE);
|
||||
nm_netns_watcher_remove_dirty(self->priv.netns, TAG);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -5636,12 +5636,8 @@ finalize(GObject *object)
|
|||
gboolean changed;
|
||||
|
||||
if (self->priv.netns) {
|
||||
nm_netns_watcher_remove_all(self->priv.netns,
|
||||
_NETNS_WATCHER_IP_ADDR_TAG(self, AF_INET),
|
||||
TRUE);
|
||||
nm_netns_watcher_remove_all(self->priv.netns,
|
||||
_NETNS_WATCHER_IP_ADDR_TAG(self, AF_INET6),
|
||||
TRUE);
|
||||
nm_netns_watcher_remove_all(self->priv.netns, _NETNS_WATCHER_IP_ADDR_TAG(self, AF_INET));
|
||||
nm_netns_watcher_remove_all(self->priv.netns, _NETNS_WATCHER_IP_ADDR_TAG(self, AF_INET6));
|
||||
}
|
||||
|
||||
nm_prioq_destroy(&self->priv.p->failedobj_prioq);
|
||||
|
|
|
|||
|
|
@ -1369,8 +1369,8 @@ nm_netns_watcher_remove_handle(NMNetns *self, NMNetnsWatcherHandle *handle)
|
|||
g_object_unref(self);
|
||||
}
|
||||
|
||||
void
|
||||
nm_netns_watcher_remove_all(NMNetns *self, gconstpointer tag, gboolean all)
|
||||
static void
|
||||
watcher_remove(NMNetns *self, gconstpointer tag, gboolean all)
|
||||
{
|
||||
NMNetnsPrivate *priv;
|
||||
WatcherByTag *watcher_by_tag;
|
||||
|
|
@ -1420,6 +1420,21 @@ nm_netns_watcher_remove_all(NMNetns *self, gconstpointer tag, gboolean all)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_netns_watcher_remove_all(NMNetns *self, gconstpointer tag)
|
||||
{
|
||||
watcher_remove(self, tag, TRUE);
|
||||
}
|
||||
|
||||
/* Similar to nm_netns_watcher_remove_all(), but removes only watchers
|
||||
* that were marked as "dirty" in a previous call of this function and were
|
||||
* not added back via nm_netns_watcher_add() in the meantime. */
|
||||
void
|
||||
nm_netns_watcher_remove_dirty(NMNetns *self, gconstpointer tag)
|
||||
{
|
||||
watcher_remove(self, tag, FALSE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void nm_netns_watcher_add(NMNetns *self,
|
|||
NMNetnsWatcherCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
nm_netns_watcher_remove_all(NMNetns *self, gconstpointer tag, gboolean all /* or only dirty */);
|
||||
void nm_netns_watcher_remove_all(NMNetns *self, gconstpointer tag);
|
||||
void nm_netns_watcher_remove_dirty(NMNetns *self, gconstpointer tag);
|
||||
|
||||
#endif /* __NM_NETNS_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue