static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(dev);

    VirtIOBalloon *s = VIRTIO_BALLOON(dev);

    int ret;



    virtio_init(vdev, "virtio-balloon", VIRTIO_ID_BALLOON,

                sizeof(struct virtio_balloon_config));



    ret = qemu_add_balloon_handler(virtio_balloon_to_target,

                                   virtio_balloon_stat, s);



    if (ret < 0) {

        error_setg(errp, "Adding balloon handler failed");

        virtio_cleanup(vdev);

        return;

    }



    s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->dvq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->svq = virtio_add_queue(vdev, 128, virtio_balloon_receive_stats);



    reset_stats(s);



    register_savevm(dev, "virtio-balloon", -1, 1,

                    virtio_balloon_save, virtio_balloon_load, s);



    object_property_add(OBJECT(dev), "guest-stats", "guest statistics",

                        balloon_stats_get_all, NULL, NULL, s, NULL);



    object_property_add(OBJECT(dev), "guest-stats-polling-interval", "int",

                        balloon_stats_get_poll_interval,

                        balloon_stats_set_poll_interval,

                        NULL, s, NULL);

}

static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(dev);

    VirtIOBalloon *s = VIRTIO_BALLOON(dev);

    int ret;



    virtio_init(vdev, "virtio-balloon", VIRTIO_ID_BALLOON,

                sizeof(struct virtio_balloon_config));



    ret = qemu_add_balloon_handler(virtio_balloon_to_target,

                                   virtio_balloon_stat, s);



    if (ret < 0) {

        error_setg(errp, "Adding balloon handler failed");

        virtio_cleanup(vdev);

        return;

    }



    s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->dvq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->svq = virtio_add_queue(vdev, 128, virtio_balloon_receive_stats);



    reset_stats(s);



    register_savevm(dev, "virtio-balloon", -1, 1,

                    virtio_balloon_save, virtio_balloon_load, s);



    object_property_add(OBJECT(dev), "guest-stats", "guest statistics",

                        balloon_stats_get_all, NULL, NULL, s, NULL);



    object_property_add(OBJECT(dev), "guest-stats-polling-interval", "int",

                        balloon_stats_get_poll_interval,

                        balloon_stats_set_poll_interval,

                        NULL, s, NULL);

}

        error_setg(errp, "Adding balloon handler failed");
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);

    VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0);

    int VAR_2;



    virtio_init(vdev, "virtio-balloon", VIRTIO_ID_BALLOON,

                sizeof(struct virtio_balloon_config));



    VAR_2 = qemu_add_balloon_handler(virtio_balloon_to_target,

                                   virtio_balloon_stat, s);



    if (VAR_2 < 0) {

        error_setg(VAR_1, "Adding balloon handler failed");

        virtio_cleanup(vdev);

        return;

    }



    s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->dvq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);

    s->svq = virtio_add_queue(vdev, 128, virtio_balloon_receive_stats);



    reset_stats(s);



    register_savevm(VAR_0, "virtio-balloon", -1, 1,

                    virtio_balloon_save, virtio_balloon_load, s);



    object_property_add(OBJECT(VAR_0), "guest-stats", "guest statistics",

                        balloon_stats_get_all, NULL, NULL, s, NULL);



    object_property_add(OBJECT(VAR_0), "guest-stats-polling-interval", "int",

                        balloon_stats_get_poll_interval,

                        balloon_stats_set_poll_interval,

                        NULL, s, NULL);

}

static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{ VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0); int VAR_2; virtio_init(vdev, "virtio-balloon", VIRTIO_ID_BALLOON,
sizeof(struct virtio_balloon_config)); VAR_2 = qemu_add_balloon_handler(virtio_balloon_to_target,
virtio_balloon_stat, s); if (VAR_2 < 0) { error_setg(VAR_1, "Adding balloon handler failed"); virtio_cleanup(vdev); return; } s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output); s->dvq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output); s->svq = virtio_add_queue(vdev, 128, virtio_balloon_receive_stats); reset_stats(s); register_savevm(VAR_0, "virtio-balloon", -1, 1,
virtio_balloon_save, virtio_balloon_load, s); object_property_add(OBJECT(VAR_0), "guest-stats", "guest statistics",
balloon_stats_get_all, NULL, NULL, s, NULL); object_property_add(OBJECT(VAR_0), "guest-stats-polling-interval", "int",
balloon_stats_get_poll_interval,
balloon_stats_set_poll_interval,
NULL, s, NULL); }