Statistics
| Branch: | Revision:

root / notify.h @ 1b902f7d

History | View | Annotate | Download (853 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 d1e70c5e Anthony Liguori
 */
13 d1e70c5e Anthony Liguori
14 d1e70c5e Anthony Liguori
#ifndef QEMU_NOTIFY_H
15 d1e70c5e Anthony Liguori
#define QEMU_NOTIFY_H
16 d1e70c5e Anthony Liguori
17 d1e70c5e Anthony Liguori
#include "qemu-queue.h"
18 d1e70c5e Anthony Liguori
19 d1e70c5e Anthony Liguori
typedef struct Notifier Notifier;
20 d1e70c5e Anthony Liguori
21 d1e70c5e Anthony Liguori
struct Notifier
22 d1e70c5e Anthony Liguori
{
23 9e8dd451 Jan Kiszka
    void (*notify)(Notifier *notifier, void *data);
24 31552529 Paolo Bonzini
    QLIST_ENTRY(Notifier) node;
25 d1e70c5e Anthony Liguori
};
26 d1e70c5e Anthony Liguori
27 d1e70c5e Anthony Liguori
typedef struct NotifierList
28 d1e70c5e Anthony Liguori
{
29 31552529 Paolo Bonzini
    QLIST_HEAD(, Notifier) notifiers;
30 d1e70c5e Anthony Liguori
} NotifierList;
31 d1e70c5e Anthony Liguori
32 d1e70c5e Anthony Liguori
#define NOTIFIER_LIST_INITIALIZER(head) \
33 31552529 Paolo Bonzini
    { QLIST_HEAD_INITIALIZER((head).notifiers) }
34 d1e70c5e Anthony Liguori
35 d1e70c5e Anthony Liguori
void notifier_list_init(NotifierList *list);
36 d1e70c5e Anthony Liguori
37 d1e70c5e Anthony Liguori
void notifier_list_add(NotifierList *list, Notifier *notifier);
38 d1e70c5e Anthony Liguori
39 31552529 Paolo Bonzini
void notifier_remove(Notifier *notifier);
40 d1e70c5e Anthony Liguori
41 9e8dd451 Jan Kiszka
void notifier_list_notify(NotifierList *list, void *data);
42 d1e70c5e Anthony Liguori
43 d1e70c5e Anthony Liguori
#endif