static int vfio_set_resample_eventfd(VFIOINTp *intp)

{

    VFIODevice *vbasedev = &intp->vdev->vbasedev;

    struct vfio_irq_set *irq_set;

    int argsz, ret;

    int32_t *pfd;



    argsz = sizeof(*irq_set) + sizeof(*pfd);

    irq_set = g_malloc0(argsz);

    irq_set->argsz = argsz;

    irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_UNMASK;

    irq_set->index = intp->pin;

    irq_set->start = 0;

    irq_set->count = 1;

    pfd = (int32_t *)&irq_set->data;

    *pfd = event_notifier_get_fd(&intp->unmask);

    qemu_set_fd_handler(*pfd, NULL, NULL, NULL);

    ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set);

    g_free(irq_set);

    if (ret < 0) {

        error_report("vfio: Failed to set resample eventfd: %m");

    }

    return ret;

}

static int vfio_set_resample_eventfd(VFIOINTp *intp)

{

    VFIODevice *vbasedev = &intp->vdev->vbasedev;

    struct vfio_irq_set *irq_set;

    int argsz, ret;

    int32_t *pfd;



    argsz = sizeof(*irq_set) + sizeof(*pfd);

    irq_set = g_malloc0(argsz);

    irq_set->argsz = argsz;

    irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_UNMASK;

    irq_set->index = intp->pin;

    irq_set->start = 0;

    irq_set->count = 1;

    pfd = (int32_t *)&irq_set->data;

    *pfd = event_notifier_get_fd(&intp->unmask);

    qemu_set_fd_handler(*pfd, NULL, NULL, NULL);

    ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set);

    g_free(irq_set);

    if (ret < 0) {

        error_report("vfio: Failed to set resample eventfd: %m");

    }

    return ret;

}

static int FUNC_0(VFIOINTp *VAR_0)

{

    VFIODevice *vbasedev = &VAR_0->vdev->vbasedev;

    struct vfio_irq_set *VAR_1;

    int VAR_2, VAR_3;

    int32_t *pfd;



    VAR_2 = sizeof(*VAR_1) + sizeof(*pfd);

    VAR_1 = g_malloc0(VAR_2);

    VAR_1->VAR_2 = VAR_2;

    VAR_1->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_UNMASK;

    VAR_1->index = VAR_0->pin;

    VAR_1->start = 0;

    VAR_1->count = 1;

    pfd = (int32_t *)&VAR_1->data;

    *pfd = event_notifier_get_fd(&VAR_0->unmask);

    qemu_set_fd_handler(*pfd, NULL, NULL, NULL);

    VAR_3 = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, VAR_1);

    g_free(VAR_1);

    if (VAR_3 < 0) {

        error_report("vfio: Failed to set resample eventfd: %m");

    }

    return VAR_3;

}

static int FUNC_0(VFIOINTp *VAR_0)
{ VFIODevice *vbasedev = &VAR_0->vdev->vbasedev; struct vfio_irq_set *VAR_1; int VAR_2, VAR_3; int32_t *pfd; VAR_2 = sizeof(*VAR_1) + sizeof(*pfd); VAR_1 = g_malloc0(VAR_2); VAR_1->VAR_2 = VAR_2; VAR_1->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_UNMASK; VAR_1->index = VAR_0->pin; VAR_1->start = 0; VAR_1->count = 1; pfd = (int32_t *)&VAR_1->data; *pfd = event_notifier_get_fd(&VAR_0->unmask); qemu_set_fd_handler(*pfd, NULL, NULL, NULL); VAR_3 = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, VAR_1); g_free(VAR_1); if (VAR_3 < 0) { error_report("vfio: Failed to set resample eventfd: %m"); } return VAR_3; }