summary refs log tree commit diff stats
path: root/include/qemu/buffer.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2015-10-30 12:09:57 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-11-05 09:08:33 +0100
commit810082d15c244b8b29470d3bb1c6b11fc9a40c25 (patch)
treed8ef9bcb6797c108a9479fe08a84d8462ae9d07f /include/qemu/buffer.h
parent5c10dbb7b577370e86ff459973b06d530c3777cf (diff)
downloadfocaccia-qemu-810082d15c244b8b29470d3bb1c6b11fc9a40c25.tar.gz
focaccia-qemu-810082d15c244b8b29470d3bb1c6b11fc9a40c25.zip
buffer: add buffer_init
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1446203414-4013-3-git-send-email-kraxel@redhat.com
Diffstat (limited to 'include/qemu/buffer.h')
-rw-r--r--include/qemu/buffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qemu/buffer.h b/include/qemu/buffer.h
index b380cec6fa..0710e165f2 100644
--- a/include/qemu/buffer.h
+++ b/include/qemu/buffer.h
@@ -34,12 +34,24 @@ typedef struct Buffer Buffer;
  */
 
 struct Buffer {
+    char *name;
     size_t capacity;
     size_t offset;
     uint8_t *buffer;
 };
 
 /**
+ * buffer_init:
+ * @buffer: the buffer object
+ * @name: buffer name
+ *
+ * Optionally attach a name to the buffer, to make it easier
+ * to identify in debug traces.
+ */
+void buffer_init(Buffer *buffer, const char *name, ...)
+        GCC_FMT_ATTR(2, 3);
+
+/**
  * buffer_reserve:
  * @buffer: the buffer object
  * @len: the minimum required free space