static int cow_write(BlockDriverState *bs, int64_t sector_num,

                     const uint8_t *buf, int nb_sectors)

{

    BDRVCowState *s = bs->opaque;

    int ret;



    ret = bdrv_pwrite(bs->file, s->cow_sectors_offset + sector_num * 512,

                      buf, nb_sectors * 512);

    if (ret < 0) {

        return ret;

    }



    return cow_update_bitmap(bs, sector_num, nb_sectors);

}

static int cow_write(BlockDriverState *bs, int64_t sector_num,

                     const uint8_t *buf, int nb_sectors)

{

    BDRVCowState *s = bs->opaque;

    int ret;



    ret = bdrv_pwrite(bs->file, s->cow_sectors_offset + sector_num * 512,

                      buf, nb_sectors * 512);

    if (ret < 0) {

        return ret;

    }



    return cow_update_bitmap(bs, sector_num, nb_sectors);

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,

                     const uint8_t *VAR_2, int VAR_3)

{

    BDRVCowState *s = VAR_0->opaque;

    int VAR_4;



    VAR_4 = bdrv_pwrite(VAR_0->file, s->cow_sectors_offset + VAR_1 * 512,

                      VAR_2, VAR_3 * 512);

    if (VAR_4 < 0) {

        return VAR_4;

    }



    return cow_update_bitmap(VAR_0, VAR_1, VAR_3);

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ BDRVCowState *s = VAR_0->opaque; int VAR_4; VAR_4 = bdrv_pwrite(VAR_0->file, s->cow_sectors_offset + VAR_1 * 512,
VAR_2, VAR_3 * 512); if (VAR_4 < 0) { return VAR_4; } return cow_update_bitmap(VAR_0, VAR_1, VAR_3); }