void qmp_block_dirty_bitmap_add(const char *node, const char *name,

                                bool has_granularity, uint32_t granularity,

                                Error **errp)

{

    AioContext *aio_context;

    BlockDriverState *bs;



    if (!name || name[0] == '\0') {

        error_setg(errp, "Bitmap name cannot be empty");

        return;

    }



    bs = bdrv_lookup_bs(node, node, errp);

    if (!bs) {

        return;

    }



    aio_context = bdrv_get_aio_context(bs);

    aio_context_acquire(aio_context);



    if (has_granularity) {

        if (granularity < 512 || !is_power_of_2(granularity)) {

            error_setg(errp, "Granularity must be power of 2 "

                             "and at least 512");

            goto out;

        }

    } else {

        /* Default to cluster size, if available: */

        granularity = bdrv_get_default_bitmap_granularity(bs);

    }



    bdrv_create_dirty_bitmap(bs, granularity, name, errp);



 out:

    aio_context_release(aio_context);

}

void qmp_block_dirty_bitmap_add(const char *node, const char *name,

                                bool has_granularity, uint32_t granularity,

                                Error **errp)

{

    AioContext *aio_context;

    BlockDriverState *bs;



    if (!name || name[0] == '\0') {

        error_setg(errp, "Bitmap name cannot be empty");

        return;

    }



    bs = bdrv_lookup_bs(node, node, errp);

    if (!bs) {

        return;

    }



    aio_context = bdrv_get_aio_context(bs);

    aio_context_acquire(aio_context);



    if (has_granularity) {

        if (granularity < 512 || !is_power_of_2(granularity)) {

            error_setg(errp, "Granularity must be power of 2 "

                             "and at least 512");

            goto out;

        }

    } else {

        

        granularity = bdrv_get_default_bitmap_granularity(bs);

    }



    bdrv_create_dirty_bitmap(bs, granularity, name, errp);



 out:

    aio_context_release(aio_context);

}

void FUNC_0(const char *VAR_0, const char *VAR_1,

                                bool VAR_2, uint32_t VAR_3,

                                Error **VAR_4)

{

    AioContext *aio_context;

    BlockDriverState *bs;



    if (!VAR_1 || VAR_1[0] == '\0') {

        error_setg(VAR_4, "Bitmap VAR_1 cannot be empty");

        return;

    }



    bs = bdrv_lookup_bs(VAR_0, VAR_0, VAR_4);

    if (!bs) {

        return;

    }



    aio_context = bdrv_get_aio_context(bs);

    aio_context_acquire(aio_context);



    if (VAR_2) {

        if (VAR_3 < 512 || !is_power_of_2(VAR_3)) {

            error_setg(VAR_4, "Granularity must be power of 2 "

                             "and at least 512");

            goto out;

        }

    } else {

        

        VAR_3 = bdrv_get_default_bitmap_granularity(bs);

    }



    bdrv_create_dirty_bitmap(bs, VAR_3, VAR_1, VAR_4);



 out:

    aio_context_release(aio_context);

}

void FUNC_0(const char *VAR_0, const char *VAR_1,
bool VAR_2, uint32_t VAR_3,
Error **VAR_4)
{ AioContext *aio_context; BlockDriverState *bs; if (!VAR_1 || VAR_1[0] == '\0') { error_setg(VAR_4, "Bitmap VAR_1 cannot be empty"); return; } bs = bdrv_lookup_bs(VAR_0, VAR_0, VAR_4); if (!bs) { return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (VAR_2) { if (VAR_3 < 512 || !is_power_of_2(VAR_3)) { error_setg(VAR_4, "Granularity must be power of 2 "
"and at least 512"); goto out; } } else { VAR_3 = bdrv_get_default_bitmap_granularity(bs); } bdrv_create_dirty_bitmap(bs, VAR_3, VAR_1, VAR_4); out:
aio_context_release(aio_context); }