static void test_blk_write(BlockBackend *blk, long pattern, int64_t offset,

                           int64_t count, bool expect_failed)

{

    void *pattern_buf = NULL;

    QEMUIOVector qiov;

    int async_ret = NOT_DONE;



    pattern_buf = g_malloc(count);

    if (pattern) {

        memset(pattern_buf, pattern, count);

    } else {

        memset(pattern_buf, 0x00, count);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, pattern_buf, count);



    blk_aio_pwritev(blk, offset, &qiov, 0, blk_rw_done, &async_ret);

    while (async_ret == NOT_DONE) {

        main_loop_wait(false);

    }



    if (expect_failed) {

        g_assert(async_ret != 0);

    } else {

        g_assert(async_ret == 0);

    }



    g_free(pattern_buf);


}
static void test_blk_write(BlockBackend *blk, long pattern, int64_t offset,

                           int64_t count, bool expect_failed)

{

    void *pattern_buf = NULL;

    QEMUIOVector qiov;

    int async_ret = NOT_DONE;



    pattern_buf = g_malloc(count);

    if (pattern) {

        memset(pattern_buf, pattern, count);

    } else {

        memset(pattern_buf, 0x00, count);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, pattern_buf, count);



    blk_aio_pwritev(blk, offset, &qiov, 0, blk_rw_done, &async_ret);

    while (async_ret == NOT_DONE) {

        main_loop_wait(false);

    }



    if (expect_failed) {

        g_assert(async_ret != 0);

    } else {

        g_assert(async_ret == 0);

    }



    g_free(pattern_buf);


}
static void FUNC_0(BlockBackend *VAR_0, long VAR_1, int64_t VAR_2,

                           int64_t VAR_3, bool VAR_4)

{

    void *VAR_5 = NULL;

    QEMUIOVector qiov;

    int VAR_6 = NOT_DONE;



    VAR_5 = g_malloc(VAR_3);

    if (VAR_1) {

        memset(VAR_5, VAR_1, VAR_3);

    } else {

        memset(VAR_5, 0x00, VAR_3);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, VAR_5, VAR_3);



    blk_aio_pwritev(VAR_0, VAR_2, &qiov, 0, blk_rw_done, &VAR_6);

    while (VAR_6 == NOT_DONE) {

        main_loop_wait(false);

    }



    if (VAR_4) {

        g_assert(VAR_6 != 0);

    } else {

        g_assert(VAR_6 == 0);

    }



    g_free(VAR_5);


}
static void FUNC_0(BlockBackend *VAR_0, long VAR_1, int64_t VAR_2,
int64_t VAR_3, bool VAR_4)
{ void *VAR_5 = NULL; QEMUIOVector qiov; int VAR_6 = NOT_DONE; VAR_5 = g_malloc(VAR_3); if (VAR_1) { memset(VAR_5, VAR_1, VAR_3); } else { memset(VAR_5, 0x00, VAR_3); } qemu_iovec_init(&qiov, 1); qemu_iovec_add(&qiov, VAR_5, VAR_3); blk_aio_pwritev(VAR_0, VAR_2, &qiov, 0, blk_rw_done, &VAR_6); while (VAR_6 == NOT_DONE) { main_loop_wait(false); } if (VAR_4) { g_assert(VAR_6 != 0); } else { g_assert(VAR_6 == 0); } g_free(VAR_5); }