]> git.proxmox.com Git - qemu.git/blame - notify.c
Merge remote-tracking branch 'bonzini/nbd-for-anthony' into staging
[qemu.git] / notify.c
CommitLineData
d1e70c5e
AL
1/*
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 *
6b620ca3
PB
12 * Contributions after 2012-01-13 are licensed under the terms of the
13 * GNU GPL, version 2 or (at your option) any later version.
d1e70c5e
AL
14 */
15
16#include "qemu-common.h"
17#include "notify.h"
18
19void notifier_list_init(NotifierList *list)
20{
21 QTAILQ_INIT(&list->notifiers);
22}
23
24void notifier_list_add(NotifierList *list, Notifier *notifier)
25{
26 QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node);
27}
28
29void notifier_list_remove(NotifierList *list, Notifier *notifier)
30{
31 QTAILQ_REMOVE(&list->notifiers, notifier, node);
32}
33
9e8dd451 34void notifier_list_notify(NotifierList *list, void *data)
d1e70c5e
AL
35{
36 Notifier *notifier, *next;
37
38 QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
9e8dd451 39 notifier->notify(notifier, data);
d1e70c5e
AL
40 }
41}