[virt-tools-list] [vhostmd virtio PATCH v3 3/6] Extend vu_buffer struct

Michael Trapp Michael.Trapp at sap.com
Tue Nov 27 14:06:30 UTC 2018


With the virtio implementation vu_buffer is used for socket IO
and therefore information about the current position after a
write is required.
---
 include/util.h | 1 +
 vhostmd/util.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/util.h b/include/util.h
index 3a21e09..c0bd19a 100644
--- a/include/util.h
+++ b/include/util.h
@@ -42,6 +42,7 @@ typedef enum {
 typedef struct _vu_buffer {
     unsigned int size;
     unsigned int use;
+    unsigned int pos;
     char *content;
 }vu_buffer;
 
diff --git a/vhostmd/util.c b/vhostmd/util.c
index 804c483..5747f16 100644
--- a/vhostmd/util.c
+++ b/vhostmd/util.c
@@ -233,6 +233,7 @@ void vu_buffer_erase(vu_buffer *buf)
    if (buf) {
       memset(buf->content, '\0', buf->size);
       buf->use = 0;
+      buf->pos = 0;
    }
 }
 
-- 
2.17.2 (Apple Git-113)




More information about the virt-tools-list mailing list