]> git.proxmox.com Git - mirror_qemu.git/blobdiff - io/channel-buffer.c
QIOChannel: Add flags on io_writev and introduce io_flush callback
[mirror_qemu.git] / io / channel-buffer.c
index daebc92bd8a17355828766cf5df8c2c89d6981f3..bf52011be2d75019eb686f31735856c55ec8b1a4 100644 (file)
@@ -6,7 +6,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *
  */
 
+#include "qemu/osdep.h"
 #include "io/channel-buffer.h"
 #include "io/channel-watch.h"
+#include "qemu/module.h"
 #include "qemu/sockets.h"
 #include "trace.h"
 
@@ -31,7 +33,7 @@ qio_channel_buffer_new(size_t capacity)
     ioc = QIO_CHANNEL_BUFFER(object_new(TYPE_QIO_CHANNEL_BUFFER));
 
     if (capacity) {
-        ioc->data = g_new0(char, capacity);
+        ioc->data = g_new0(uint8_t, capacity);
         ioc->capacity = capacity;
     }
 
@@ -79,6 +81,7 @@ static ssize_t qio_channel_buffer_writev(QIOChannel *ioc,
                                          size_t niov,
                                          int *fds,
                                          size_t nfds,
+                                         int flags,
                                          Error **errp)
 {
     QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc);
@@ -139,6 +142,7 @@ static int qio_channel_buffer_close(QIOChannel *ioc,
     QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc);
 
     g_free(bioc->data);
+    bioc->data = NULL;
     bioc->capacity = bioc->usage = bioc->offset = 0;
 
     return 0;