static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)

{

    BlockDriverState *old_bs = child->bs;



    if (old_bs) {

        if (old_bs->quiesce_counter && child->role->drained_end) {

            child->role->drained_end(child);

        }

        QLIST_REMOVE(child, next_parent);

    }



    child->bs = new_bs;



    if (new_bs) {

        QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);

        if (new_bs->quiesce_counter && child->role->drained_begin) {

            child->role->drained_begin(child);

        }

    }

}

static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)

{

    BlockDriverState *old_bs = child->bs;



    if (old_bs) {

        if (old_bs->quiesce_counter && child->role->drained_end) {

            child->role->drained_end(child);

        }

        QLIST_REMOVE(child, next_parent);

    }



    child->bs = new_bs;



    if (new_bs) {

        QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);

        if (new_bs->quiesce_counter && child->role->drained_begin) {

            child->role->drained_begin(child);

        }

    }

}

static void FUNC_0(BdrvChild *VAR_0, BlockDriverState *VAR_1)

{

    BlockDriverState *old_bs = VAR_0->bs;



    if (old_bs) {

        if (old_bs->quiesce_counter && VAR_0->role->drained_end) {

            VAR_0->role->drained_end(VAR_0);

        }

        QLIST_REMOVE(VAR_0, next_parent);

    }



    VAR_0->bs = VAR_1;



    if (VAR_1) {

        QLIST_INSERT_HEAD(&VAR_1->parents, VAR_0, next_parent);

        if (VAR_1->quiesce_counter && VAR_0->role->drained_begin) {

            VAR_0->role->drained_begin(VAR_0);

        }

    }

}

static void FUNC_0(BdrvChild *VAR_0, BlockDriverState *VAR_1)
{ BlockDriverState *old_bs = VAR_0->bs; if (old_bs) { if (old_bs->quiesce_counter && VAR_0->role->drained_end) { VAR_0->role->drained_end(VAR_0); } QLIST_REMOVE(VAR_0, next_parent); } VAR_0->bs = VAR_1; if (VAR_1) { QLIST_INSERT_HEAD(&VAR_1->parents, VAR_0, next_parent); if (VAR_1->quiesce_counter && VAR_0->role->drained_begin) { VAR_0->role->drained_begin(VAR_0); } } }