summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-03-31 14:40:27 +0200
committerKevin Wolf <kwolf@redhat.com>2010-04-23 16:08:46 +0200
commitd6e9098e10e82feeddb824d7c3d0cf61aff96c29 (patch)
tree29a16b6152876e8ea74703052c94675bfdeb51ea /block.c
parent4768fa902c3860f2fe34403e6e1c83bfca6da034 (diff)
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remaining callers of the old function are converted to the new one. In some places they even know the right format, so they should have used bdrv_open2 from the beginning. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/block.c b/block.c
index 9351aa3062..e74264d80b 100644
--- a/block.c
+++ b/block.c
@@ -338,7 +338,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags)
int ret;
bs = bdrv_new("");
- ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL);
+ ret = bdrv_open(bs, filename, flags | BDRV_O_FILE, NULL);
if (ret < 0) {
bdrv_delete(bs);
return ret;
@@ -348,13 +348,8 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags)
return 0;
}
-int bdrv_open(BlockDriverState *bs, const char *filename, int flags)
-{
- return bdrv_open2(bs, filename, flags, NULL);
-}
-
-int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
- BlockDriver *drv)
+int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
+ BlockDriver *drv)
{
int ret, open_flags;
char tmp_filename[PATH_MAX];
@@ -379,7 +374,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
/* if there is a backing file, use it */
bs1 = bdrv_new("");
- ret = bdrv_open2(bs1, filename, 0, drv);
+ ret = bdrv_open(bs1, filename, 0, drv);
if (ret < 0) {
bdrv_delete(bs1);
return ret;
@@ -491,9 +486,8 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
/* backing files always opened read-only */
open_flags &= ~BDRV_O_RDWR;
-
- ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags,
- back_drv);
+
+ ret = bdrv_open(bs->backing_hd, backing_filename, open_flags, back_drv);
if (ret < 0) {
bdrv_close(bs);
return ret;
@@ -605,12 +599,12 @@ int bdrv_commit(BlockDriverState *bs)
bdrv_delete(bs->backing_hd);
bs->backing_hd = NULL;
bs_rw = bdrv_new("");
- rw_ret = bdrv_open2(bs_rw, filename, open_flags | BDRV_O_RDWR, NULL);
+ rw_ret = bdrv_open(bs_rw, filename, open_flags | BDRV_O_RDWR, NULL);
if (rw_ret < 0) {
bdrv_delete(bs_rw);
/* try to re-open read-only */
bs_ro = bdrv_new("");
- ret = bdrv_open2(bs_ro, filename, open_flags & ~BDRV_O_RDWR, NULL);
+ ret = bdrv_open(bs_ro, filename, open_flags & ~BDRV_O_RDWR, NULL);
if (ret < 0) {
bdrv_delete(bs_ro);
/* drive not functional anymore */
@@ -662,7 +656,7 @@ ro_cleanup:
bdrv_delete(bs->backing_hd);
bs->backing_hd = NULL;
bs_ro = bdrv_new("");
- ret = bdrv_open2(bs_ro, filename, open_flags & ~BDRV_O_RDWR, NULL);
+ ret = bdrv_open(bs_ro, filename, open_flags & ~BDRV_O_RDWR, NULL);
if (ret < 0) {
bdrv_delete(bs_ro);
/* drive not functional anymore */