From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCHv2 3/7] consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
Date: Sun, 11 Mar 2012 15:59:31 +0100 [thread overview]
Message-ID: <4F5CBDD3.1010101@redhat.com> (raw)
In-Reply-To: <1331430564-32745-4-git-send-email-mjt@msgid.tls.msk.ru>
Il 11/03/2012 02:49, Michael Tokarev ha scritto:
> qemu_iovec_concat() is currently a wrapper for qemu_iovec_copy(),
> use the former (with extra "0" arg) in a few places where it is used.
>
> Change skip argument of qemu_iovec_copy() from uint64_t to size_t,
> since size of qiov itself is size_t, so there's no way to skip larger
> sizes. Rename it to soffset, to make it clear that the offset
> is applied to src.
>
> Also change the only usage of uint64_t in hw/9pfs/virtio-9p.c, in
> v9fs_init_qiov_from_pdu() - all callers of it actually uses size_t
> too, not uint64_t.
>
> Semantic change in the meaning of `count' (now renamed to `sbytes')
> argument. Initial comment said that src is copied to dst until
> _total_ size is less than specified, so it might be interpreted
> as maximum size of the _dst_ vector. Actual meaning of if was
> that total amount of skipped and copied bytes should not exceed
> `count'. Make it just the amount of bytes to _copy_, without
> counting skipped bytes. This makes it consistent with other
> iovec functions, and also matches actual _usage_ of this function.
>
> Order of argumens is already good:
> qemu_iovec_memset(QEMUIOVector *qiov, size_t offset, int c, size_t bytes)
> vs:
> qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t soffset, size_t sbytes)
> (note soffset is after _src_ not dst, since it applies to src;
> for memset it applies to qiov).
>
> Note that in many places where this function is used, the previous
> call is qemu_iovec_reset(), which means many callers actually want
> copy (replacing dst content), not concat. So we may want to add a
> paramere to allow resetting dst in one go.
Yes, this initially left me a bit confused.
Let's add a new function qemu_iovec_copy that does reset+concat.
Paolo
next prev parent reply other threads:[~2012-03-11 14:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-11 1:49 [Qemu-devel] [PATCHv2 0/7] cleanup/consolidate some iovec functions Michael Tokarev
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 1/7] Consolidate qemu_iovec_memset{, _skip}() into single, simplified function Michael Tokarev
2012-03-12 13:55 ` Kevin Wolf
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 2/7] allow qemu_iovec_from_buffer() to specify offset from which to start copying Michael Tokarev
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 3/7] consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent Michael Tokarev
2012-03-11 14:59 ` Paolo Bonzini [this message]
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 4/7] change prototypes of qemu_sendv() and qemu_recvv() Michael Tokarev
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 5/7] Export qemu_sendv_recvv() and use it in " Michael Tokarev
2012-03-11 15:00 ` Paolo Bonzini
2012-03-11 15:22 ` Michael Tokarev
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 6/7] cleanup qemu_co_sendv(), qemu_co_recvv() and friends Michael Tokarev
2012-03-11 15:01 ` Paolo Bonzini
2012-03-11 15:26 ` Michael Tokarev
2012-03-12 13:30 ` Paolo Bonzini
2012-03-12 16:29 ` Michael Tokarev
2012-03-12 16:50 ` Paolo Bonzini
2012-03-11 1:49 ` [Qemu-devel] [PATCHv2 7/7] rewrite and comment qemu_sendv_recvv() Michael Tokarev
2012-03-11 2:11 ` [Qemu-devel] [PATCHv2 0/7] cleanup/consolidate some iovec functions Michael Tokarev
2012-03-11 15:06 ` Paolo Bonzini
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=4F5CBDD3.1010101@redhat.com \
--to=pbonzini@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.