qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 15/16] scsi: Implement get_req_iov callback


From: Christoph Hellwig
Subject: Re: [Qemu-devel] [PATCH 15/16] scsi: Implement get_req_iov callback
Date: Mon, 22 Nov 2010 12:26:01 +0100
User-agent: Mutt/1.3.28i

> @@ -95,14 +95,30 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, 
> uint32_t tag,
>      return req;
>  }
>  
> +static SCSIRequest *scsi_new_request_iovec(SCSIDevice *d, uint32_t tag,
> +        uint32_t lun, struct iovec *iov, int iov_num)
> +{
> +    SCSIRequest *req;
> +    SCSIDiskReq *r;
> +
> +    req = scsi_req_alloc(sizeof(SCSIDiskReq), d, tag, lun);
> +    r = DO_UPCAST(SCSIDiskReq, req, req);
> +    r->iov = iov;
> +    r->iov_num = iov_num;
> +    r->iov_buf = NULL;
> +    return req;
> +}

While the amount of duplicated code here is rather small I still hate
the duplication.

The simplest step is to implement scsi_new_request on top of
scsi_new_request_iovec by just allocation the iovec in scsi_new_request
and passing it to scsi_new_request_iovec.  The next patch on top would
be to move the iovec allocation to the HBA driver and only stick to
one interface.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]