static ssize_t block_crypto_init_func(QCryptoBlock *block,

                                      void *opaque,

                                      size_t headerlen,

                                      Error **errp)

{

    struct BlockCryptoCreateData *data = opaque;

    int ret;



    /* User provided size should reflect amount of space made

     * available to the guest, so we must take account of that

     * which will be used by the crypto header

     */

    data->size += headerlen;



    qemu_opt_set_number(data->opts, BLOCK_OPT_SIZE, data->size, &error_abort);

    ret = bdrv_create_file(data->filename, data->opts, errp);

    if (ret < 0) {

        return -1;

    }



    data->blk = blk_new_open(data->filename, NULL, NULL,

                             BDRV_O_RDWR | BDRV_O_PROTOCOL, errp);

    if (!data->blk) {

        return -1;

    }



    return 0;

}

static ssize_t block_crypto_init_func(QCryptoBlock *block,

                                      void *opaque,

                                      size_t headerlen,

                                      Error **errp)

{

    struct BlockCryptoCreateData *data = opaque;

    int ret;



    







    data->size += headerlen;



    qemu_opt_set_number(data->opts, BLOCK_OPT_SIZE, data->size, &error_abort);

    ret = bdrv_create_file(data->filename, data->opts, errp);

    if (ret < 0) {

        return -1;

    }



    data->blk = blk_new_open(data->filename, NULL, NULL,

                             BDRV_O_RDWR | BDRV_O_PROTOCOL, errp);

    if (!data->blk) {

        return -1;

    }



    return 0;

}

static ssize_t FUNC_0(QCryptoBlock *block,

                                      void *opaque,

                                      size_t headerlen,

                                      Error **errp)

{

    struct BlockCryptoCreateData *VAR_0 = opaque;

    int VAR_1;



    







    VAR_0->size += headerlen;



    qemu_opt_set_number(VAR_0->opts, BLOCK_OPT_SIZE, VAR_0->size, &error_abort);

    VAR_1 = bdrv_create_file(VAR_0->filename, VAR_0->opts, errp);

    if (VAR_1 < 0) {

        return -1;

    }



    VAR_0->blk = blk_new_open(VAR_0->filename, NULL, NULL,

                             BDRV_O_RDWR | BDRV_O_PROTOCOL, errp);

    if (!VAR_0->blk) {

        return -1;

    }



    return 0;

}

static ssize_t FUNC_0(QCryptoBlock *block,
void *opaque,
size_t headerlen,
Error **errp)
{ struct BlockCryptoCreateData *VAR_0 = opaque; int VAR_1; VAR_0->size += headerlen; qemu_opt_set_number(VAR_0->opts, BLOCK_OPT_SIZE, VAR_0->size, &error_abort); VAR_1 = bdrv_create_file(VAR_0->filename, VAR_0->opts, errp); if (VAR_1 < 0) { return -1; } VAR_0->blk = blk_new_open(VAR_0->filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, errp); if (!VAR_0->blk) { return -1; } return 0; }