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 <[email protected]> --- 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
