Statistics
| Branch: | Revision:

root / notify.h @ a74cdab4

History | View | Annotate | Download (857 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 d1e70c5e Anthony Liguori
    void (*notify)(Notifier *notifier);
24 d1e70c5e Anthony Liguori
    QTAILQ_ENTRY(Notifier) node;
25 d1e70c5e Anthony Liguori
};
26 d1e70c5e Anthony Liguori
27 d1e70c5e Anthony Liguori
typedef struct NotifierList
28 d1e70c5e Anthony Liguori
{
29 d1e70c5e Anthony Liguori
    QTAILQ_HEAD(, Notifier) notifiers;
30 d1e70c5e Anthony Liguori
} NotifierList;
31 d1e70c5e Anthony Liguori
32 d1e70c5e Anthony Liguori
#define NOTIFIER_LIST_INITIALIZER(head) \
33 d1e70c5e Anthony Liguori
    { QTAILQ_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 d1e70c5e Anthony Liguori
void notifier_list_remove(NotifierList *list, Notifier *notifier);
40 d1e70c5e Anthony Liguori
41 d1e70c5e Anthony Liguori
void notifier_list_notify(NotifierList *list);
42 d1e70c5e Anthony Liguori
43 d1e70c5e Anthony Liguori
#endif