diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-28 10:37:33 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-28 10:37:34 -0500 |
commit | 36125631e79d53ffb9365740f43f386e2171d116 (patch) | |
tree | 746f03c20af92d86fc3ad03c64dc136092c565d1 /util | |
parent | ec3f8c9913c1eeab78a02711be7c2a803dfb4d62 (diff) | |
parent | 721da65c6eba9c053d73744ecaa882b0f7cd634a (diff) |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Stefan Hajnoczi (11) and others
# Via Kevin Wolf
* kwolf/for-anthony:
cmd646: fix build when DEBUG_IDE is enabled.
block: change default of .has_zero_init to 0
vpc: Implement .bdrv_has_zero_init
vmdk: remove wrong calculation of relative path
gluster: Return bdrv_has_zero_init = 0
block/ssh: Set bdrv_has_zero_init according to the file type.
block: Make BlockJobTypes const
qemu-iotests: add 055 drive-backup test case
qemu-iotests: extract wait_until_completed() into iotests.py
blockdev: add Abort transaction
blockdev: add DriveBackup transaction
blockdev: allow BdrvActionOps->commit() to be NULL
blockdev: rename BlkTransactionStates to singular
block: add drive-backup QMP command
blockdev: use bdrv_getlength() in qmp_drive_mirror()
blockdev: drop redundant proto_drv check
block: add basic backup support to block driver
block: add bdrv_add_before_write_notifier()
notify: add NotiferWithReturn so notifier list can abort
raw-posix: Fix /dev/cdrom magic on OS X
Message-id: 1372429509-29642-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/notify.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/util/notify.c b/util/notify.c index 7b7692acb2..f215dfc214 100644 --- a/util/notify.c +++ b/util/notify.c @@ -39,3 +39,33 @@ void notifier_list_notify(NotifierList *list, void *data) notifier->notify(notifier, data); } } + +void notifier_with_return_list_init(NotifierWithReturnList *list) +{ + QLIST_INIT(&list->notifiers); +} + +void notifier_with_return_list_add(NotifierWithReturnList *list, + NotifierWithReturn *notifier) +{ + QLIST_INSERT_HEAD(&list->notifiers, notifier, node); +} + +void notifier_with_return_remove(NotifierWithReturn *notifier) +{ + QLIST_REMOVE(notifier, node); +} + +int notifier_with_return_list_notify(NotifierWithReturnList *list, void *data) +{ + NotifierWithReturn *notifier, *next; + int ret = 0; + + QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) { + ret = notifier->notify(notifier, data); + if (ret != 0) { + break; + } + } + return ret; +} |