[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/73] block: Add blk_add_close_notifier() for BB
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 24/73] block: Add blk_add_close_notifier() for BB |
Date: |
Wed, 10 Dec 2014 11:33:50 +0100 |
From: Max Reitz <address@hidden>
Adding something like a "delete notifier" to a BlockBackend would not
make much sense, because whoever is interested in registering there will
probably hold a reference to that BlockBackend; therefore, the notifier
will never be called (or only when the notifiee already relinquished its
reference and thus most probably is no longer interested in that
notification).
Therefore, this patch just passes through the close notifier interface
of the root BDS. This will be called when the device is ejected, for
instance, and therefore does make sense.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/block-backend.c | 5 +++++
include/sysemu/block-backend.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index 7a7f690..ef16d73 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -642,6 +642,11 @@ void blk_remove_aio_context_notifier(BlockBackend *blk,
detach_aio_context, opaque);
}
+void blk_add_close_notifier(BlockBackend *blk, Notifier *notify)
+{
+ bdrv_add_close_notifier(blk->bs, notify);
+}
+
void blk_io_plug(BlockBackend *blk)
{
bdrv_io_plug(blk->bs);
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index d9c1337..8871a02 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -143,6 +143,7 @@ void blk_remove_aio_context_notifier(BlockBackend *blk,
void *),
void (*detach_aio_context)(void *),
void *opaque);
+void blk_add_close_notifier(BlockBackend *blk, Notifier *notify);
void blk_io_plug(BlockBackend *blk);
void blk_io_unplug(BlockBackend *blk);
BlockAcctStats *blk_get_stats(BlockBackend *blk);
--
1.8.3.1
- [Qemu-devel] [PULL 13/73] block/qapi: Add cache information to query-block, (continued)
- [Qemu-devel] [PULL 13/73] block/qapi: Add cache information to query-block, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 10/73] blockdev: check for BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 14/73] block/hmp: Factor out print_block_info(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 16/73] block/hmp: Allow node-name in 'info block', Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 17/73] monitor: Fix HMP tab completion, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 21/73] ahci: replace SATA FIS type magic numbers with constants, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 23/73] block: Add AioContextNotifier functions to BB, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 19/73] iotests: Plain blkdebug filename generation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 20/73] ahci: avoid #ifdef DEBUG_AHCI bitrot, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 22/73] block: Lift more functions into BlockBackend, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 24/73] block: Add blk_add_close_notifier() for BB,
Kevin Wolf <=
- [Qemu-devel] [PULL 25/73] nbd: Change external interface to BlockBackend, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 26/73] nbd: Use BlockBackend internally, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 27/73] qemu-nbd: Use BlockBackend where reasonable, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 28/73] tests: Use "command -v" instead of which(1) in shell scripts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 30/73] qemu-iotests: Use qemu-io -f $IMGFMT, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 31/73] qemu-iotests: Add qemu-io format option in Python tests, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 29/73] qemu-io: Allow explicitly specifying format, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 32/73] qtests: Specify image format explicitly, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 34/73] block: Read only one sector for format probing, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 37/73] qemu-iotests: Test writing non-raw image headers to raw image, Kevin Wolf, 2014/12/10