qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 2/4] Add qemu_iovec_reset()
Date: Wed,  4 Feb 2009 14:25:12 +0200	[thread overview]
Message-ID: <1233750314-23301-3-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1233750314-23301-1-git-send-email-avi@redhat.com>

Add a helper to zero out an existing iovec.  Removes the need to deallocate
and reallocate it.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 cutils.c      |    6 ++++++
 qemu-common.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cutils.c b/cutils.c
index 1090aa4..658746b 100644
--- a/cutils.c
+++ b/cutils.c
@@ -129,6 +129,12 @@ void qemu_iovec_destroy(QEMUIOVector *qiov)
     qemu_free(qiov->iov);
 }
 
+void qemu_iovec_reset(QEMUIOVector *qiov)
+{
+    qiov->niov = 0;
+    qiov->size = 0;
+}
+
 void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf)
 {
     uint8_t *p = (uint8_t *)buf;
diff --git a/qemu-common.h b/qemu-common.h
index 8aef558..db33493 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -201,6 +201,7 @@ typedef struct QEMUIOVector {
 void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint);
 void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len);
 void qemu_iovec_destroy(QEMUIOVector *qiov);
+void qemu_iovec_reset(QEMUIOVector *qiov);
 void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf);
 void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);
 
-- 
1.6.1.1

  parent reply	other threads:[~2009-02-04 12:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04 12:25 [Qemu-devel] [PATCH 0/4] Block DMA helpers Avi Kivity
2009-02-04 12:25 ` [Qemu-devel] [PATCH 1/4] Add a scatter-gather list type and accessors Avi Kivity
2009-02-04 19:27   ` [Qemu-devel] " Anthony Liguori
2009-02-04 20:30     ` Avi Kivity
2009-02-04 20:36       ` Anthony Liguori
2009-02-04 20:46         ` Avi Kivity
2009-02-04 20:50           ` Anthony Liguori
2009-02-04 21:03             ` Avi Kivity
2009-02-04 23:58           ` Paul Brook
2009-02-05  7:25             ` Avi Kivity
2009-02-05  0:29         ` M. Warner Losh
2009-02-05  1:56           ` Anthony Liguori
2009-02-04 23:49     ` Paul Brook
2009-02-04 12:25 ` Avi Kivity [this message]
2009-02-04 12:25 ` [Qemu-devel] [PATCH 3/4] Introduce block dma helpers Avi Kivity
2009-02-04 19:29   ` [Qemu-devel] " Anthony Liguori
2009-02-04 12:25 ` [Qemu-devel] [PATCH 4/4] Convert IDE to use new " Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-02-05  9:33 [Qemu-devel] [PATCH 0/4] Block DMA helpers (v2) Avi Kivity
2009-02-05  9:33 ` [Qemu-devel] [PATCH 2/4] Add qemu_iovec_reset() Avi Kivity

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=1233750314-23301-3-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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 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).