[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] block: Drop blk_new_with_bs()
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 5/8] block: Drop blk_new_with_bs() |
Date: |
Tue, 10 Nov 2015 04:44:20 +0100 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH 0/8] blockdev: (Nearly) free clean-up work, Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 1/8] qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 2/8] block: Drop useless bdrv_new() calls, Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 3/8] block: Let bdrv_open_inherit() return the snapshot, Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 5/8] block: Drop blk_new_with_bs(),
Max Reitz <=
- [Qemu-devel] [PATCH 4/8] block: Drop BB name from bad option error, Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 6/8] block: Drop bdrv_new_root(), Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 8/8] block: Assert !bs->refcnt in bdrv_close(), Max Reitz, 2015/11/09
- [Qemu-devel] [PATCH 7/8] block: Make bdrv_open() return a BDS, Max Reitz, 2015/11/09