From d6e9098e10e82feeddb824d7c3d0cf61aff96c29 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 31 Mar 2010 14:40:27 +0200 Subject: 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 --- block.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'block.c') 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 */ -- cgit v1.2.3