static int usbredir_put_bufpq(QEMUFile *f, void *priv, size_t unused,
                              const VMStateField *field, JSONWriter *vmdesc)
{
    struct endp_data *endp = priv;
    USBRedirDevice *dev = endp->dev;
    struct buf_packet *bufp;
    int len, i = 0;

    qemu_put_be32(f, endp->bufpq_size);
    QTAILQ_FOREACH(bufp, &endp->bufpq, next) {
        len = bufp->len - bufp->offset;
        DPRINTF("put_bufpq %d/%d len %d status %d\n", i + 1, endp->bufpq_size,
                len, bufp->status);
        qemu_put_be32(f, len);
        qemu_put_be32(f, bufp->status);
        qemu_put_buffer(f, bufp->data + bufp->offset, len);
        i++;
    }
    assert(i == endp->bufpq_size);

    return 0;
}
static int usbredir_put_bufpq(QEMUFile *f, void *priv, size_t unused,
                              const VMStateField *field, JSONWriter *vmdesc)
{
    struct endp_data *endp = priv;
    USBRedirDevice *dev = endp->dev;
    struct buf_packet *bufp;
    int len, i = 0;

    qemu_put_be32(f, endp->bufpq_size);
    QTAILQ_FOREACH(bufp, &endp->bufpq, next) {
        len = bufp->len - bufp->offset;
        DPRINTF("put_bufpq %d/%d len %d status %d\n", i + 1, endp->bufpq_size,
                len, bufp->status);
        qemu_put_be32(f, len);
        qemu_put_be32(f, bufp->status);
        qemu_put_buffer(f, bufp->data + bufp->offset, len);
        i++;
    }
    assert(i == endp->bufpq_size);

    return 0;
}