From 6858eba09ed69e64c8d05d4f4b8167b42a011b7f Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 29 Jun 2017 19:32:21 +0200 Subject: block: Introduce BdrvChildRole.update_filename There is no good reason for bdrv_drop_intermediate() to know the active layer above the subchain it is operating on - even more so, because the assumption that there is a single active layer above it is not generally true. In order to prepare removal of the active parameter, use a BdrvChildRole callback to update the backing file string in the overlay image instead of directly calling bdrv_change_backing_file(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- include/block/block_int.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/block') diff --git a/include/block/block_int.h b/include/block/block_int.h index 79366b94b5..7e8a206239 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -544,6 +544,12 @@ struct BdrvChildRole { void (*attach)(BdrvChild *child); void (*detach)(BdrvChild *child); + + /* Notifies the parent that the filename of its child has changed (e.g. + * because the direct child was removed from the backing chain), so that it + * can update its reference. */ + int (*update_filename)(BdrvChild *child, BlockDriverState *new_base, + const char *filename, Error **errp); }; extern const BdrvChildRole child_file; -- cgit v1.2.3-55-g7522