From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 1/5] notifier: switch to QLIST
Date: Fri, 13 Jan 2012 17:34:01 +0100 [thread overview]
Message-ID: <1326472445-25966-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1326472445-25966-1-git-send-email-pbonzini@redhat.com>
Notifiers do not need to access both ends of the list, and using
a QLIST also simplifies the API.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
input.c | 2 +-
migration.c | 2 +-
notify.c | 10 +++++-----
notify.h | 8 ++++----
qemu-timer.c | 2 +-
vl.c | 2 +-
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/input.c b/input.c
index 9ade63f..b618ea4 100644
--- a/input.c
+++ b/input.c
@@ -268,5 +268,5 @@ void qemu_add_mouse_mode_change_notifier(Notifier *notify)
void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
{
- notifier_list_remove(&mouse_mode_notifiers, notify);
+ notifier_remove(notify);
}
diff --git a/migration.c b/migration.c
index 412fdfe..0de907c 100644
--- a/migration.c
+++ b/migration.c
@@ -333,7 +333,7 @@ void add_migration_state_change_notifier(Notifier *notify)
void remove_migration_state_change_notifier(Notifier *notify)
{
- notifier_list_remove(&migration_state_notifiers, notify);
+ notifier_remove(notify);
}
bool migration_is_active(MigrationState *s)
diff --git a/notify.c b/notify.c
index a6bac1f..ac05f91 100644
--- a/notify.c
+++ b/notify.c
@@ -16,24 +16,24 @@
void notifier_list_init(NotifierList *list)
{
- QTAILQ_INIT(&list->notifiers);
+ QLIST_INIT(&list->notifiers);
}
void notifier_list_add(NotifierList *list, Notifier *notifier)
{
- QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node);
+ QLIST_INSERT_HEAD(&list->notifiers, notifier, node);
}
-void notifier_list_remove(NotifierList *list, Notifier *notifier)
+void notifier_remove(Notifier *notifier)
{
- QTAILQ_REMOVE(&list->notifiers, notifier, node);
+ QLIST_REMOVE(notifier, node);
}
void notifier_list_notify(NotifierList *list, void *data)
{
Notifier *notifier, *next;
- QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
+ QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
notifier->notify(notifier, data);
}
}
diff --git a/notify.h b/notify.h
index 54fc57c..03cf26c 100644
--- a/notify.h
+++ b/notify.h
@@ -21,22 +21,22 @@ typedef struct Notifier Notifier;
struct Notifier
{
void (*notify)(Notifier *notifier, void *data);
- QTAILQ_ENTRY(Notifier) node;
+ QLIST_ENTRY(Notifier) node;
};
typedef struct NotifierList
{
- QTAILQ_HEAD(, Notifier) notifiers;
+ QLIST_HEAD(, Notifier) notifiers;
} NotifierList;
#define NOTIFIER_LIST_INITIALIZER(head) \
- { QTAILQ_HEAD_INITIALIZER((head).notifiers) }
+ { QLIST_HEAD_INITIALIZER((head).notifiers) }
void notifier_list_init(NotifierList *list);
void notifier_list_add(NotifierList *list, Notifier *notifier);
-void notifier_list_remove(NotifierList *list, Notifier *notifier);
+void notifier_remove(Notifier *notifier);
void notifier_list_notify(NotifierList *list, void *data);
diff --git a/qemu-timer.c b/qemu-timer.c
index cd026c6..2eda9b9 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -453,7 +453,7 @@ void qemu_register_clock_reset_notifier(QEMUClock *clock, Notifier *notifier)
void qemu_unregister_clock_reset_notifier(QEMUClock *clock, Notifier *notifier)
{
- notifier_list_remove(&clock->reset_notifiers, notifier);
+ notifier_remove(notifier);
}
void init_clocks(void)
diff --git a/vl.c b/vl.c
index ba55b35..4373f2a 100644
--- a/vl.c
+++ b/vl.c
@@ -2058,7 +2058,7 @@ void qemu_add_exit_notifier(Notifier *notify)
void qemu_remove_exit_notifier(Notifier *notify)
{
- notifier_list_remove(&exit_notifiers, notify);
+ notifier_remove(notify);
}
static void qemu_run_exit_notifiers(void)
--
1.7.7.1
next prev parent reply other threads:[~2012-01-13 16:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 16:34 [Qemu-devel] [PATCH v2 0/5] qemu-queue cleanups Paolo Bonzini
2012-01-13 16:34 ` Paolo Bonzini [this message]
2012-01-13 16:34 ` [Qemu-devel] [PATCH v2 2/5] qemu-queue: add QSLIST Paolo Bonzini
2012-01-13 16:34 ` [Qemu-devel] [PATCH v2 3/5] qemu-queue: drop QCIRCLEQ Paolo Bonzini
2012-01-13 16:44 ` Peter Maydell
2012-01-13 17:05 ` Paolo Bonzini
2012-01-13 19:11 ` Paolo Bonzini
2012-01-13 16:34 ` [Qemu-devel] [PATCH v2 4/5] coroutine: switch to QSLIST Paolo Bonzini
2012-01-13 16:34 ` [Qemu-devel] [PATCH v2 5/5] block: use QSLIST for the AIO free list Paolo Bonzini
2012-02-17 16:03 ` Anthony Liguori
2012-02-15 9:05 ` [Qemu-devel] [PATCH v2 0/5] qemu-queue cleanups Paolo Bonzini
2012-02-17 18:15 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326472445-25966-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).