int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset,

    const void *buf, int count)

{

    int ret;



    ret = bdrv_pwrite(bs, offset, buf, count);

    if (ret < 0) {

        return ret;

    }



    /* No flush needed for cache modes that already do it */

    if (bs->enable_write_cache) {

        bdrv_flush(bs);

    }



    return 0;

}

int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset,

    const void *buf, int count)

{

    int ret;



    ret = bdrv_pwrite(bs, offset, buf, count);

    if (ret < 0) {

        return ret;

    }



    

    if (bs->enable_write_cache) {

        bdrv_flush(bs);

    }



    return 0;

}

int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,

    const void *VAR_2, int VAR_3)

{

    int VAR_4;



    VAR_4 = bdrv_pwrite(VAR_0, VAR_1, VAR_2, VAR_3);

    if (VAR_4 < 0) {

        return VAR_4;

    }



    

    if (VAR_0->enable_write_cache) {

        bdrv_flush(VAR_0);

    }



    return 0;

}

int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
const void *VAR_2, int VAR_3)
{ int VAR_4; VAR_4 = bdrv_pwrite(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_4 < 0) { return VAR_4; } if (VAR_0->enable_write_cache) { bdrv_flush(VAR_0); } return 0; }