gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gluster-devel] [PATCH BUG:393 06/10] libglusterfs: add iov_load functio


From: Corentin Chary
Subject: [Gluster-devel] [PATCH BUG:393 06/10] libglusterfs: add iov_load function
Date: Wed, 18 Nov 2009 12:13:58 +0100

iov_load will fill io vectors from a buffer.

Signed-off-by: Corentin Chary <address@hidden>
---
 libglusterfs/src/common-utils.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 48788d2..084679f 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -244,6 +244,17 @@ iov_unload (char *buf, const struct iovec *vector, int 
count)
        }
 }
 
+static inline void
+iov_load (struct iovec *vector, int count, char *buf)
+{
+       int i;
+       int copied = 0;
+
+       for (i = 0; i < count; i++) {
+               memcpy (vector[i].iov_base, buf + copied, vector[i].iov_len);
+               copied += vector[i].iov_len;
+       }
+}
 
 static inline int
 mem_0filled (const char *buf, size_t size)
-- 
1.6.4.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]