From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvzrU-0001Ib-FN for qemu-devel@nongnu.org; Mon, 09 Nov 2015 22:44:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvzrT-0001Rf-Iz for qemu-devel@nongnu.org; Mon, 09 Nov 2015 22:44:48 -0500 From: Max Reitz Date: Tue, 10 Nov 2015 04:44:20 +0100 Message-Id: <1447127063-4662-6-git-send-email-mreitz@redhat.com> In-Reply-To: <1447127063-4662-1-git-send-email-mreitz@redhat.com> References: <1447127063-4662-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 5/8] block: Drop blk_new_with_bs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Its only caller is blk_new_open(), so we can just inline it there. Since bdrv_new_root() is only a wrapper around bdrv_new(), we can just use bdrv_new() instead. Signed-off-by: Max Reitz --- block/block-backend.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index b0bf3b2..13f5fef 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -114,26 +114,6 @@ BlockBackend *blk_new(const char *name, Error **errp) } /* - * Create a new BlockBackend with a new BlockDriverState attached. - * Otherwise just like blk_new(), which see. - */ -BlockBackend *blk_new_with_bs(const char *name, Error **errp) -{ - BlockBackend *blk; - BlockDriverState *bs; - - blk = blk_new(name, errp); - if (!blk) { - return NULL; - } - - bs = bdrv_new_root(); - blk->bs = bs; - bs->blk = blk; - return blk; -} - -/* * Calls blk_new_with_bs() and then calls bdrv_open() on the BlockDriverState. * * Just as with bdrv_open(), after having called this function the reference to @@ -150,20 +130,25 @@ BlockBackend *blk_new_open(const char *name, const char *filename, Error **errp) { BlockBackend *blk; + BlockDriverState *bs; int ret; - blk = blk_new_with_bs(name, errp); + blk = blk_new(name, errp); if (!blk) { QDECREF(options); return NULL; } - ret = bdrv_open(&blk->bs, filename, reference, options, flags, errp); + bs = NULL; + ret = bdrv_open(&bs, filename, reference, options, flags, errp); if (ret < 0) { blk_unref(blk); return NULL; } + blk->bs = bs; + bs->blk = blk; + return blk; } -- 2.6.2