blkdebug_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,

                   QEMUIOVector *qiov, int flags)

{

    BDRVBlkdebugState *s = bs->opaque;

    BlkdebugRule *rule = NULL;



    /* Sanity check block layer guarantees */

    assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment));

    assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment));

    if (bs->bl.max_transfer) {

        assert(bytes <= bs->bl.max_transfer);

    }



    QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {

        uint64_t inject_offset = rule->options.inject.offset;



        if (inject_offset == -1 ||

            (inject_offset >= offset && inject_offset < offset + bytes))

        {

            break;

        }

    }



    if (rule && rule->options.inject.error) {

        return inject_error(bs, rule);

    }



    return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags);

}

blkdebug_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,

                   QEMUIOVector *qiov, int flags)

{

    BDRVBlkdebugState *s = bs->opaque;

    BlkdebugRule *rule = NULL;



    

    assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment));

    assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment));

    if (bs->bl.max_transfer) {

        assert(bytes <= bs->bl.max_transfer);

    }



    QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {

        uint64_t inject_offset = rule->options.inject.offset;



        if (inject_offset == -1 ||

            (inject_offset >= offset && inject_offset < offset + bytes))

        {

            break;

        }

    }



    if (rule && rule->options.inject.error) {

        return inject_error(bs, rule);

    }



    return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags);

}

FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,

                   QEMUIOVector *VAR_3, int VAR_4)

{

    BDRVBlkdebugState *s = VAR_0->opaque;

    BlkdebugRule *rule = NULL;



    

    assert(QEMU_IS_ALIGNED(VAR_1, VAR_0->bl.request_alignment));

    assert(QEMU_IS_ALIGNED(VAR_2, VAR_0->bl.request_alignment));

    if (VAR_0->bl.max_transfer) {

        assert(VAR_2 <= VAR_0->bl.max_transfer);

    }



    QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {

        uint64_t inject_offset = rule->options.inject.VAR_1;



        if (inject_offset == -1 ||

            (inject_offset >= VAR_1 && inject_offset < VAR_1 + VAR_2))

        {

            break;

        }

    }



    if (rule && rule->options.inject.error) {

        return inject_error(VAR_0, rule);

    }



    return bdrv_co_preadv(VAR_0->file, VAR_1, VAR_2, VAR_3, VAR_4);

}

FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,
QEMUIOVector *VAR_3, int VAR_4)
{ BDRVBlkdebugState *s = VAR_0->opaque; BlkdebugRule *rule = NULL; assert(QEMU_IS_ALIGNED(VAR_1, VAR_0->bl.request_alignment)); assert(QEMU_IS_ALIGNED(VAR_2, VAR_0->bl.request_alignment)); if (VAR_0->bl.max_transfer) { assert(VAR_2 <= VAR_0->bl.max_transfer); } QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) { uint64_t inject_offset = rule->options.inject.VAR_1; if (inject_offset == -1 ||
(inject_offset >= VAR_1 && inject_offset < VAR_1 + VAR_2))
{ break; } } if (rule && rule->options.inject.error) { return inject_error(VAR_0, rule); } return bdrv_co_preadv(VAR_0->file, VAR_1, VAR_2, VAR_3, VAR_4); }