[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] Add qemu_iovec_reset()
From: |
Avi Kivity |
Subject: |
[Qemu-devel] [PATCH 2/4] Add qemu_iovec_reset() |
Date: |
Thu, 5 Feb 2009 11:33:57 +0200 |
Add a helper to zero out an existing iovec. Removes the need to deallocate
and reallocate it.
Signed-off-by: Avi Kivity <address@hidden>
---
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
- [Qemu-devel] [PATCH 0/4] Block DMA helpers (v2), Avi Kivity, 2009/02/05
- [Qemu-devel] [PATCH 1/4] Add a scatter-gather list type and accessors, Avi Kivity, 2009/02/05
- [Qemu-devel] [PATCH 4/4] Convert IDE to use new dma helpers, Avi Kivity, 2009/02/05
- [Qemu-devel] [PATCH 2/4] Add qemu_iovec_reset(),
Avi Kivity <=
- [Qemu-devel] [PATCH 3/4] Introduce block dma helpers, Avi Kivity, 2009/02/05
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Anthony Liguori, 2009/02/05
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Avi Kivity, 2009/02/06
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Anthony Liguori, 2009/02/06
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Avi Kivity, 2009/02/07
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Anthony Liguori, 2009/02/07
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Avi Kivity, 2009/02/08
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Anthony Liguori, 2009/02/08
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Avi Kivity, 2009/02/08
- [Qemu-devel] Re: [PATCH 0/4] Block DMA helpers (v2), Anthony Liguori, 2009/02/08