static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)

{

    int8_t id = pdu->id + 1; /* Response */



    if (len < 0) {

        int err = -len;

        len = 7;



        if (s->proto_version != V9FS_PROTO_2000L) {

            V9fsString str;



            str.data = strerror(err);

            str.size = strlen(str.data);



            len += pdu_marshal(pdu, len, "s", &str);

            id = P9_RERROR;

        }



        len += pdu_marshal(pdu, len, "d", err);



        if (s->proto_version == V9FS_PROTO_2000L) {

            id = P9_RLERROR;

        }


    }



    /* fill out the header */

    pdu_marshal(pdu, 0, "dbw", (int32_t)len, id, pdu->tag);



    /* keep these in sync */

    pdu->size = len;

    pdu->id = id;



    /* push onto queue and notify */

    virtqueue_push(s->vq, &pdu->elem, len);



    /* FIXME: we should batch these completions */

    virtio_notify(&s->vdev, s->vq);



    /* Now wakeup anybody waiting in flush for this request */

    qemu_co_queue_next(&pdu->complete);



    free_pdu(s, pdu);

}
static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)

{

    int8_t id = pdu->id + 1; 



    if (len < 0) {

        int err = -len;

        len = 7;



        if (s->proto_version != V9FS_PROTO_2000L) {

            V9fsString str;



            str.data = strerror(err);

            str.size = strlen(str.data);



            len += pdu_marshal(pdu, len, "s", &str);

            id = P9_RERROR;

        }



        len += pdu_marshal(pdu, len, "d", err);



        if (s->proto_version == V9FS_PROTO_2000L) {

            id = P9_RLERROR;

        }


    }



    

    pdu_marshal(pdu, 0, "dbw", (int32_t)len, id, pdu->tag);



    

    pdu->size = len;

    pdu->id = id;



    

    virtqueue_push(s->vq, &pdu->elem, len);



    

    virtio_notify(&s->vdev, s->vq);



    

    qemu_co_queue_next(&pdu->complete);



    free_pdu(s, pdu);

}
static void FUNC_0(V9fsState *VAR_0, V9fsPDU *VAR_1, ssize_t VAR_2)

{

    int8_t id = VAR_1->id + 1; 



    if (VAR_2 < 0) {

        int VAR_3 = -VAR_2;

        VAR_2 = 7;



        if (VAR_0->proto_version != V9FS_PROTO_2000L) {

            V9fsString str;



            str.data = strerror(VAR_3);

            str.size = strlen(str.data);



            VAR_2 += pdu_marshal(VAR_1, VAR_2, "VAR_0", &str);

            id = P9_RERROR;

        }



        VAR_2 += pdu_marshal(VAR_1, VAR_2, "d", VAR_3);



        if (VAR_0->proto_version == V9FS_PROTO_2000L) {

            id = P9_RLERROR;

        }


    }



    

    pdu_marshal(VAR_1, 0, "dbw", (int32_t)VAR_2, id, VAR_1->tag);



    

    VAR_1->size = VAR_2;

    VAR_1->id = id;



    

    virtqueue_push(VAR_0->vq, &VAR_1->elem, VAR_2);



    

    virtio_notify(&VAR_0->vdev, VAR_0->vq);



    

    qemu_co_queue_next(&VAR_1->complete);



    free_pdu(VAR_0, VAR_1);

}
static void FUNC_0(V9fsState *VAR_0, V9fsPDU *VAR_1, ssize_t VAR_2)
{ int8_t id = VAR_1->id + 1; if (VAR_2 < 0) { int VAR_3 = -VAR_2; VAR_2 = 7; if (VAR_0->proto_version != V9FS_PROTO_2000L) { V9fsString str; str.data = strerror(VAR_3); str.size = strlen(str.data); VAR_2 += pdu_marshal(VAR_1, VAR_2, "VAR_0", &str); id = P9_RERROR; } VAR_2 += pdu_marshal(VAR_1, VAR_2, "d", VAR_3); if (VAR_0->proto_version == V9FS_PROTO_2000L) { id = P9_RLERROR; } } pdu_marshal(VAR_1, 0, "dbw", (int32_t)VAR_2, id, VAR_1->tag); VAR_1->size = VAR_2; VAR_1->id = id; virtqueue_push(VAR_0->vq, &VAR_1->elem, VAR_2); virtio_notify(&VAR_0->vdev, VAR_0->vq); qemu_co_queue_next(&VAR_1->complete); free_pdu(VAR_0, VAR_1); }