On Fri, 2015-01-30 at 10:33 +0100, Paolo Bonzini wrote:
> 
> On 30/01/2015 09:12, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <n...@linux-iscsi.org>
> > 
> > This patch adds a new memcpy_fromiovec_out() library function which modifies
> > the passed *iov following memcpy_fromiovec(), but also returns the next 
> > current
> > iovec pointer via **iov_out.
> > 
> > This is useful for vhost ANY_LAYOUT support when guests are allowed to 
> > generate
> > incoming virtio request headers combined with subsequent SGL payloads into a
> > single iovec.
> > 
> > Cc: Michael S. Tsirkin <m...@redhat.com>
> > Cc: Paolo Bonzini <pbonz...@redhat.com>
> > Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org>
> > ---
> >  include/linux/uio.h |  2 ++
> >  lib/iovec.c         | 27 +++++++++++++++++++++++++++
> >  2 files changed, 29 insertions(+)
> > 

<SNIP>

> > --- a/lib/iovec.c
> > +++ b/lib/iovec.c
> > @@ -28,6 +28,33 @@ int memcpy_fromiovec(unsigned char *kdata, struct iovec 
> > *iov, int len)
> >  EXPORT_SYMBOL(memcpy_fromiovec);
> >  
> >  /*
> > + * Copy iovec to kernel, saving the current iov to *iov_out.
> > + * Returns -EFAULT on error.
> 
> Perhaps document that iov is modified, zeroing everything in [iov,
> *iov_out) and possibly removing the front of *iov_out?
> 

Sure, updated the read the following:

 *      Copy iovec to kernel, modifying the passed *iov entries.
 *
 *      Save **iov_out for the caller to use upon return, that may either
 *      contain the current entry with a re-calculated iov_base + iov_len
 *      or next unmodified entry.
 *
 *      Also note that any iovec entries preceding the final *iov_out are
 *      zeroed by copy_from_user().

Thank you,

--nab

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to