Revision d1e70c5e
b/Makefile.objs | ||
---|---|---|
104 | 104 |
common-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o |
105 | 105 |
common-obj-$(CONFIG_COCOA) += cocoa.o |
106 | 106 |
common-obj-$(CONFIG_IOTHREAD) += qemu-thread.o |
107 |
common-obj-y += notify.o |
|
107 | 108 |
|
108 | 109 |
slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o |
109 | 110 |
slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o |
b/notify.c | ||
---|---|---|
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 |
* |
|
12 |
*/ |
|
13 |
|
|
14 |
#include "qemu-common.h" |
|
15 |
#include "notify.h" |
|
16 |
|
|
17 |
void notifier_list_init(NotifierList *list) |
|
18 |
{ |
|
19 |
QTAILQ_INIT(&list->notifiers); |
|
20 |
} |
|
21 |
|
|
22 |
void notifier_list_add(NotifierList *list, Notifier *notifier) |
|
23 |
{ |
|
24 |
QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node); |
|
25 |
} |
|
26 |
|
|
27 |
void notifier_list_remove(NotifierList *list, Notifier *notifier) |
|
28 |
{ |
|
29 |
QTAILQ_REMOVE(&list->notifiers, notifier, node); |
|
30 |
} |
|
31 |
|
|
32 |
void notifier_list_notify(NotifierList *list) |
|
33 |
{ |
|
34 |
Notifier *notifier, *next; |
|
35 |
|
|
36 |
QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) { |
|
37 |
notifier->notify(notifier); |
|
38 |
} |
|
39 |
} |
b/notify.h | ||
---|---|---|
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 |
* |
|
12 |
*/ |
|
13 |
|
|
14 |
#ifndef QEMU_NOTIFY_H |
|
15 |
#define QEMU_NOTIFY_H |
|
16 |
|
|
17 |
#include "qemu-queue.h" |
|
18 |
|
|
19 |
typedef struct Notifier Notifier; |
|
20 |
|
|
21 |
struct Notifier |
|
22 |
{ |
|
23 |
void (*notify)(Notifier *notifier); |
|
24 |
QTAILQ_ENTRY(Notifier) node; |
|
25 |
}; |
|
26 |
|
|
27 |
typedef struct NotifierList |
|
28 |
{ |
|
29 |
QTAILQ_HEAD(, Notifier) notifiers; |
|
30 |
} NotifierList; |
|
31 |
|
|
32 |
#define NOTIFIER_LIST_INITIALIZER(head) \ |
|
33 |
{ QTAILQ_HEAD_INITIALIZER((head).notifiers) } |
|
34 |
|
|
35 |
void notifier_list_init(NotifierList *list); |
|
36 |
|
|
37 |
void notifier_list_add(NotifierList *list, Notifier *notifier); |
|
38 |
|
|
39 |
void notifier_list_remove(NotifierList *list, Notifier *notifier); |
|
40 |
|
|
41 |
void notifier_list_notify(NotifierList *list); |
|
42 |
|
|
43 |
#endif |
Also available in: Unified diff