blob: a6bac1f7837f93adad787f1c06f586c2e35d31d2 [file] [log] [blame]
Anthony Liguorid1e70c52010-03-09 13:16:14 -06001/*
2 * Notifier lists
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
14#include "qemu-common.h"
15#include "notify.h"
16
17void notifier_list_init(NotifierList *list)
18{
19 QTAILQ_INIT(&list->notifiers);
20}
21
22void notifier_list_add(NotifierList *list, Notifier *notifier)
23{
24 QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node);
25}
26
27void notifier_list_remove(NotifierList *list, Notifier *notifier)
28{
29 QTAILQ_REMOVE(&list->notifiers, notifier, node);
30}
31
Jan Kiszka9e8dd452011-06-20 14:06:26 +020032void notifier_list_notify(NotifierList *list, void *data)
Anthony Liguorid1e70c52010-03-09 13:16:14 -060033{
34 Notifier *notifier, *next;
35
36 QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
Jan Kiszka9e8dd452011-06-20 14:06:26 +020037 notifier->notify(notifier, data);
Anthony Liguorid1e70c52010-03-09 13:16:14 -060038 }
39}