static int scsi_write_data(SCSIRequest *req)

{

    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

    uint32_t n;



    /* No data transfer may already be in progress */

    assert(r->req.aiocb == NULL);



    n = r->iov.iov_len / 512;

    if (n) {

        qemu_iovec_init_external(&r->qiov, &r->iov, 1);

        r->req.aiocb = bdrv_aio_writev(s->bs, r->sector, &r->qiov, n,

                                   scsi_write_complete, r);

        if (r->req.aiocb == NULL) {

            scsi_write_complete(r, -EIO);

        }

    } else {

        /* Invoke completion routine to fetch data from host.  */

        scsi_write_complete(r, 0);

    }



    return 0;

}

static int scsi_write_data(SCSIRequest *req)

{

    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

    uint32_t n;



    

    assert(r->req.aiocb == NULL);



    n = r->iov.iov_len / 512;

    if (n) {

        qemu_iovec_init_external(&r->qiov, &r->iov, 1);

        r->req.aiocb = bdrv_aio_writev(s->bs, r->sector, &r->qiov, n,

                                   scsi_write_complete, r);

        if (r->req.aiocb == NULL) {

            scsi_write_complete(r, -EIO);

        }

    } else {

        

        scsi_write_complete(r, 0);

    }



    return 0;

}

            scsi_write_complete(r, -EIO);
static int FUNC_0(SCSIRequest *VAR_0)

{

    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, VAR_0, VAR_0);

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->VAR_0.dev);

    uint32_t n;



    

    assert(r->VAR_0.aiocb == NULL);



    n = r->iov.iov_len / 512;

    if (n) {

        qemu_iovec_init_external(&r->qiov, &r->iov, 1);

        r->VAR_0.aiocb = bdrv_aio_writev(s->bs, r->sector, &r->qiov, n,

                                   scsi_write_complete, r);

        if (r->VAR_0.aiocb == NULL) {

            scsi_write_complete(r, -EIO);

        }

    } else {

        

        scsi_write_complete(r, 0);

    }



    return 0;

}

static int FUNC_0(SCSIRequest *VAR_0)
{ SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, VAR_0, VAR_0); SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->VAR_0.dev); uint32_t n; assert(r->VAR_0.aiocb == NULL); n = r->iov.iov_len / 512; if (n) { qemu_iovec_init_external(&r->qiov, &r->iov, 1); r->VAR_0.aiocb = bdrv_aio_writev(s->bs, r->sector, &r->qiov, n,
scsi_write_complete, r); if (r->VAR_0.aiocb == NULL) { scsi_write_complete(r, -EIO); } } else { scsi_write_complete(r, 0); } return 0; }