static void bmds_set_aio_inflight(BlkMigDevState *bmds, int64_t sector_num,

                             int nb_sectors, int set)

{

    int64_t start, end;

    unsigned long val, idx, bit;



    start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;

    end = (sector_num + nb_sectors - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK;



    for (; start <= end; start++) {

        idx = start / (sizeof(unsigned long) * 8);

        bit = start % (sizeof(unsigned long) * 8);

        val = bmds->aio_bitmap[idx];

        if (set) {

            val |= 1UL << bit;

        } else {

            val &= ~(1UL << bit);

        }

        bmds->aio_bitmap[idx] = val;

    }

}

static void bmds_set_aio_inflight(BlkMigDevState *bmds, int64_t sector_num,

                             int nb_sectors, int set)

{

    int64_t start, end;

    unsigned long val, idx, bit;



    start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;

    end = (sector_num + nb_sectors - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK;



    for (; start <= end; start++) {

        idx = start / (sizeof(unsigned long) * 8);

        bit = start % (sizeof(unsigned long) * 8);

        val = bmds->aio_bitmap[idx];

        if (set) {

            val |= 1UL << bit;

        } else {

            val &= ~(1UL << bit);

        }

        bmds->aio_bitmap[idx] = val;

    }

}

static void FUNC_0(BlkMigDevState *VAR_0, int64_t VAR_1,

                             int VAR_2, int VAR_3)

{

    int64_t start, end;

    unsigned long VAR_4, VAR_5, VAR_6;



    start = VAR_1 / BDRV_SECTORS_PER_DIRTY_CHUNK;

    end = (VAR_1 + VAR_2 - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK;



    for (; start <= end; start++) {

        VAR_5 = start / (sizeof(unsigned long) * 8);

        VAR_6 = start % (sizeof(unsigned long) * 8);

        VAR_4 = VAR_0->aio_bitmap[VAR_5];

        if (VAR_3) {

            VAR_4 |= 1UL << VAR_6;

        } else {

            VAR_4 &= ~(1UL << VAR_6);

        }

        VAR_0->aio_bitmap[VAR_5] = VAR_4;

    }

}

static void FUNC_0(BlkMigDevState *VAR_0, int64_t VAR_1,
int VAR_2, int VAR_3)
{ int64_t start, end; unsigned long VAR_4, VAR_5, VAR_6; start = VAR_1 / BDRV_SECTORS_PER_DIRTY_CHUNK; end = (VAR_1 + VAR_2 - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK; for (; start <= end; start++) { VAR_5 = start / (sizeof(unsigned long) * 8); VAR_6 = start % (sizeof(unsigned long) * 8); VAR_4 = VAR_0->aio_bitmap[VAR_5]; if (VAR_3) { VAR_4 |= 1UL << VAR_6; } else { VAR_4 &= ~(1UL << VAR_6); } VAR_0->aio_bitmap[VAR_5] = VAR_4; } }