Statistics
| Branch: | Revision:

root / notify.c @ ef5b2344

History | View | Annotate | Download (916 Bytes)

1 d1e70c5e Anthony Liguori
/*
2 d1e70c5e Anthony Liguori
 * Notifier lists
3 d1e70c5e Anthony Liguori
 *
4 d1e70c5e Anthony Liguori
 * Copyright IBM, Corp. 2010
5 d1e70c5e Anthony Liguori
 *
6 d1e70c5e Anthony Liguori
 * Authors:
7 d1e70c5e Anthony Liguori
 *  Anthony Liguori   <aliguori@us.ibm.com>
8 d1e70c5e Anthony Liguori
 *
9 d1e70c5e Anthony Liguori
 * This work is licensed under the terms of the GNU GPL, version 2.  See
10 d1e70c5e Anthony Liguori
 * the COPYING file in the top-level directory.
11 d1e70c5e Anthony Liguori
 *
12 6b620ca3 Paolo Bonzini
 * Contributions after 2012-01-13 are licensed under the terms of the
13 6b620ca3 Paolo Bonzini
 * GNU GPL, version 2 or (at your option) any later version.
14 d1e70c5e Anthony Liguori
 */
15 d1e70c5e Anthony Liguori
16 d1e70c5e Anthony Liguori
#include "qemu-common.h"
17 d1e70c5e Anthony Liguori
#include "notify.h"
18 d1e70c5e Anthony Liguori
19 d1e70c5e Anthony Liguori
void notifier_list_init(NotifierList *list)
20 d1e70c5e Anthony Liguori
{
21 31552529 Paolo Bonzini
    QLIST_INIT(&list->notifiers);
22 d1e70c5e Anthony Liguori
}
23 d1e70c5e Anthony Liguori
24 d1e70c5e Anthony Liguori
void notifier_list_add(NotifierList *list, Notifier *notifier)
25 d1e70c5e Anthony Liguori
{
26 31552529 Paolo Bonzini
    QLIST_INSERT_HEAD(&list->notifiers, notifier, node);
27 d1e70c5e Anthony Liguori
}
28 d1e70c5e Anthony Liguori
29 31552529 Paolo Bonzini
void notifier_remove(Notifier *notifier)
30 d1e70c5e Anthony Liguori
{
31 31552529 Paolo Bonzini
    QLIST_REMOVE(notifier, node);
32 d1e70c5e Anthony Liguori
}
33 d1e70c5e Anthony Liguori
34 9e8dd451 Jan Kiszka
void notifier_list_notify(NotifierList *list, void *data)
35 d1e70c5e Anthony Liguori
{
36 d1e70c5e Anthony Liguori
    Notifier *notifier, *next;
37 d1e70c5e Anthony Liguori
38 31552529 Paolo Bonzini
    QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
39 9e8dd451 Jan Kiszka
        notifier->notify(notifier, data);
40 d1e70c5e Anthony Liguori
    }
41 d1e70c5e Anthony Liguori
}