void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,

                                  VirtIOBlockDataPlane **dataplane,

                                  Error **errp)

{

    VirtIOBlockDataPlane *s;

    Error *local_err = NULL;

    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);



    *dataplane = NULL;



    if (!conf->data_plane && !conf->iothread) {

        return;

    }



    /* Don't try if transport does not support notifiers. */

    if (!k->set_guest_notifiers || !k->set_host_notifier) {

        error_setg(errp,

                   "device is incompatible with x-data-plane "

                   "(transport does not support notifiers)");

        return;

    }



    /* If dataplane is (re-)enabled while the guest is running there could be

     * block jobs that can conflict.

     */

    if (bdrv_op_is_blocked(conf->conf.bs, BLOCK_OP_TYPE_DATAPLANE,

                           &local_err)) {

        error_setg(errp, "cannot start dataplane thread: %s",

                   error_get_pretty(local_err));

        error_free(local_err);

        return;

    }



    s = g_new0(VirtIOBlockDataPlane, 1);

    s->vdev = vdev;

    s->conf = conf;



    if (conf->iothread) {

        s->iothread = conf->iothread;

        object_ref(OBJECT(s->iothread));

    } else {

        /* Create per-device IOThread if none specified.  This is for

         * x-data-plane option compatibility.  If x-data-plane is removed we

         * can drop this.

         */

        object_initialize(&s->internal_iothread_obj,

                          sizeof(s->internal_iothread_obj),

                          TYPE_IOTHREAD);

        user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);

        s->iothread = &s->internal_iothread_obj;

    }

    s->ctx = iothread_get_aio_context(s->iothread);

    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);



    error_setg(&s->blocker, "block device is in use by data plane");

    bdrv_op_block_all(conf->conf.bs, s->blocker);

    bdrv_op_unblock(conf->conf.bs, BLOCK_OP_TYPE_RESIZE, s->blocker);

    bdrv_op_unblock(conf->conf.bs, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);



    *dataplane = s;

}

void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,

                                  VirtIOBlockDataPlane **dataplane,

                                  Error **errp)

{

    VirtIOBlockDataPlane *s;

    Error *local_err = NULL;

    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);



    *dataplane = NULL;



    if (!conf->data_plane && !conf->iothread) {

        return;

    }



    

    if (!k->set_guest_notifiers || !k->set_host_notifier) {

        error_setg(errp,

                   "device is incompatible with x-data-plane "

                   "(transport does not support notifiers)");

        return;

    }



    





    if (bdrv_op_is_blocked(conf->conf.bs, BLOCK_OP_TYPE_DATAPLANE,

                           &local_err)) {

        error_setg(errp, "cannot start dataplane thread: %s",

                   error_get_pretty(local_err));

        error_free(local_err);

        return;

    }



    s = g_new0(VirtIOBlockDataPlane, 1);

    s->vdev = vdev;

    s->conf = conf;



    if (conf->iothread) {

        s->iothread = conf->iothread;

        object_ref(OBJECT(s->iothread));

    } else {

        







        object_initialize(&s->internal_iothread_obj,

                          sizeof(s->internal_iothread_obj),

                          TYPE_IOTHREAD);

        user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);

        s->iothread = &s->internal_iothread_obj;

    }

    s->ctx = iothread_get_aio_context(s->iothread);

    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);



    error_setg(&s->blocker, "block device is in use by data plane");

    bdrv_op_block_all(conf->conf.bs, s->blocker);

    bdrv_op_unblock(conf->conf.bs, BLOCK_OP_TYPE_RESIZE, s->blocker);

    bdrv_op_unblock(conf->conf.bs, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);



    *dataplane = s;

}

void FUNC_0(VirtIODevice *VAR_0, VirtIOBlkConf *VAR_1,

                                  VirtIOBlockDataPlane **VAR_2,

                                  Error **VAR_3)

{

    VirtIOBlockDataPlane *s;

    Error *local_err = NULL;

    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0)));

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);



    *VAR_2 = NULL;



    if (!VAR_1->data_plane && !VAR_1->iothread) {

        return;

    }



    

    if (!k->set_guest_notifiers || !k->set_host_notifier) {

        error_setg(VAR_3,

                   "device is incompatible with x-data-plane "

                   "(transport does not support notifiers)");

        return;

    }



    





    if (bdrv_op_is_blocked(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_DATAPLANE,

                           &local_err)) {

        error_setg(VAR_3, "cannot start VAR_2 thread: %s",

                   error_get_pretty(local_err));

        error_free(local_err);

        return;

    }



    s = g_new0(VirtIOBlockDataPlane, 1);

    s->VAR_0 = VAR_0;

    s->VAR_1 = VAR_1;



    if (VAR_1->iothread) {

        s->iothread = VAR_1->iothread;

        object_ref(OBJECT(s->iothread));

    } else {

        







        object_initialize(&s->internal_iothread_obj,

                          sizeof(s->internal_iothread_obj),

                          TYPE_IOTHREAD);

        user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);

        s->iothread = &s->internal_iothread_obj;

    }

    s->ctx = iothread_get_aio_context(s->iothread);

    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);



    error_setg(&s->blocker, "block device is in use by data plane");

    bdrv_op_block_all(VAR_1->VAR_1.bs, s->blocker);

    bdrv_op_unblock(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_RESIZE, s->blocker);

    bdrv_op_unblock(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);



    *VAR_2 = s;

}

void FUNC_0(VirtIODevice *VAR_0, VirtIOBlkConf *VAR_1,
VirtIOBlockDataPlane **VAR_2,
Error **VAR_3)
{ VirtIOBlockDataPlane *s; Error *local_err = NULL; BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); *VAR_2 = NULL; if (!VAR_1->data_plane && !VAR_1->iothread) { return; } if (!k->set_guest_notifiers || !k->set_host_notifier) { error_setg(VAR_3,
"device is incompatible with x-data-plane "
"(transport does not support notifiers)"); return; } if (bdrv_op_is_blocked(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_DATAPLANE,
&local_err)) { error_setg(VAR_3, "cannot start VAR_2 thread: %s",
error_get_pretty(local_err)); error_free(local_err); return; } s = g_new0(VirtIOBlockDataPlane, 1); s->VAR_0 = VAR_0; s->VAR_1 = VAR_1; if (VAR_1->iothread) { s->iothread = VAR_1->iothread; object_ref(OBJECT(s->iothread)); } else { object_initialize(&s->internal_iothread_obj,
sizeof(s->internal_iothread_obj),
TYPE_IOTHREAD); user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort); s->iothread = &s->internal_iothread_obj; } s->ctx = iothread_get_aio_context(s->iothread); s->bh = aio_bh_new(s->ctx, notify_guest_bh, s); error_setg(&s->blocker, "block device is in use by data plane"); bdrv_op_block_all(VAR_1->VAR_1.bs, s->blocker); bdrv_op_unblock(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_RESIZE, s->blocker); bdrv_op_unblock(VAR_1->VAR_1.bs, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); *VAR_2 = s; }