qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: stefanha@gmail.com, qemu-devel@nongnu.org, nab@linux-iscsi.org,
	kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 15/16] scsi: Implement get_req_iov callback
Date: Mon, 22 Nov 2010 12:26:01 +0100	[thread overview]
Message-ID: <20101122112601.GC1579@lst.de> (raw)
In-Reply-To: <20101118144750.9A528F90AB@ochil.suse.de>

> @@ -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	other threads:[~2010-11-22 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 14:47 [Qemu-devel] [PATCH 15/16] scsi: Implement get_req_iov callback Hannes Reinecke
2010-11-22 11:26 ` Christoph Hellwig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101122112601.GC1579@lst.de \
    --to=hch@lst.de \
    --cc=hare@suse.de \
    --cc=kraxel@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).