Commit eb9566d1 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Kevin Wolf
Browse files

vdi: change goto to loop



Finally reindent all code and change goto statements to a loop.

Acked-by: default avatarStefan Weil <sw@weilnetz.de>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 4eea78e6
Loading
Loading
Loading
Loading
+68 −73
Original line number Diff line number Diff line
@@ -474,11 +474,11 @@ static int vdi_co_read(BlockDriverState *bs,
    uint32_t block_index;
    uint32_t sector_in_block;
    uint32_t n_sectors;
    int ret;
    int ret = 0;

    logout("\n");

restart:
    while (ret >= 0 && nb_sectors > 0) {
        block_index = sector_num / s->block_sectors;
        sector_in_block = sector_num % s->block_sectors;
        n_sectors = s->block_sectors - sector_in_block;
@@ -506,9 +506,6 @@ restart:
        nb_sectors -= n_sectors;
        sector_num += n_sectors;
        buf += n_sectors * SECTOR_SIZE;

    if (ret >= 0 && nb_sectors > 0) {
        goto restart;
    }

    return ret;
@@ -525,11 +522,11 @@ static int vdi_co_write(BlockDriverState *bs,
    uint32_t bmap_first = VDI_UNALLOCATED;
    uint32_t bmap_last = VDI_UNALLOCATED;
    uint8_t *block = NULL;
    int ret;
    int ret = 0;

    logout("\n");

restart:
    while (ret >= 0 && nb_sectors > 0) {
        block_index = sector_num / s->block_sectors;
        sector_in_block = sector_num % s->block_sectors;
        n_sectors = s->block_sectors - sector_in_block;
@@ -574,8 +571,6 @@ restart:
        buf += n_sectors * SECTOR_SIZE;

        logout("%u sectors written\n", n_sectors);
    if (ret >= 0 && nb_sectors > 0) {
        goto restart;
    }

    logout("finished data write\n");