From a3aeeab557f08285c4fcf537fca575b069eb67ef Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 28 Apr 2020 14:26:46 -0500 Subject: block: Add blk_new_with_bs() helper There are several callers that need to create a new block backend from an existing BDS; make the task slightly easier with a common helper routine. Suggested-by: Max Reitz Signed-off-by: Eric Blake Message-Id: <20200424190903.522087-2-eblake@redhat.com> [mreitz: Set @ret only in error paths, see https://lists.nongnu.org/archive/html/qemu-block/2020-04/msg01216.html] Signed-off-by: Max Reitz Message-Id: <20200428192648.749066-2-eblake@redhat.com> Signed-off-by: Max Reitz --- include/sysemu/block-backend.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/sysemu') diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 34de7fa..0917663 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -77,6 +77,8 @@ typedef struct BlockBackendPublic { } BlockBackendPublic; BlockBackend *blk_new(AioContext *ctx, uint64_t perm, uint64_t shared_perm); +BlockBackend *blk_new_with_bs(BlockDriverState *bs, uint64_t perm, + uint64_t shared_perm, Error **errp); BlockBackend *blk_new_open(const char *filename, const char *reference, QDict *options, int flags, Error **errp); int blk_get_refcnt(BlockBackend *blk); -- cgit v1.1