qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] char: make io_channel_send be used unconditionally


From: Daniel P. Berrange
Subject: [Qemu-devel] [PATCH] char: make io_channel_send be used unconditionally
Date: Tue, 26 Jan 2016 16:06:49 +0000

The io_channel_send_full() method was used unconditionally, but
the io_channel_send() method was only used from !_WIN32 code
paths. Some versions of Mingw toolchain will complain about
the method being defined but not used as a result.

The io_channel_send() API doesn't really simplify life very
much, so get rid of it and rename io_channel_send_full() to
just be io_channel_send().

Signed-off-by: Daniel P. Berrange <address@hidden>
---
 qemu-char.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 7ded3c2..4c3daa6 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -887,9 +887,9 @@ static void remove_fd_in_watch(CharDriverState *chr)
 }
 
 
-static int io_channel_send_full(QIOChannel *ioc,
-                                const void *buf, size_t len,
-                                int *fds, size_t nfds)
+static int io_channel_send(QIOChannel *ioc,
+                           const void *buf, size_t len,
+                           int *fds, size_t nfds)
 {
     size_t offset = 0;
 
@@ -920,11 +920,6 @@ static int io_channel_send_full(QIOChannel *ioc,
 }
 
 
-static int io_channel_send(QIOChannel *ioc, const void *buf, size_t len)
-{
-    return io_channel_send_full(ioc, buf, len, NULL, 0);
-}
-
 #ifndef _WIN32
 
 typedef struct FDCharDriver {
@@ -938,7 +933,7 @@ static int fd_chr_write(CharDriverState *chr, const uint8_t 
*buf, int len)
 {
     FDCharDriver *s = chr->opaque;
     
-    return io_channel_send(s->ioc_out, buf, len);
+    return io_channel_send(s->ioc_out, buf, len, NULL, 0);
 }
 
 static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
@@ -1257,7 +1252,7 @@ static int pty_chr_write(CharDriverState *chr, const 
uint8_t *buf, int len)
             return 0;
         }
     }
-    return io_channel_send(s->ioc, buf, len);
+    return io_channel_send(s->ioc, buf, len, NULL, 0);
 }
 
 static GSource *pty_chr_add_watch(CharDriverState *chr, GIOCondition cond)
@@ -2589,9 +2584,9 @@ static int tcp_chr_write(CharDriverState *chr, const 
uint8_t *buf, int len)
 {
     TCPCharDriver *s = chr->opaque;
     if (s->connected) {
-        int ret =  io_channel_send_full(s->ioc, buf, len,
-                                        s->write_msgfds,
-                                        s->write_msgfds_num);
+        int ret =  io_channel_send(s->ioc, buf, len,
+                                   s->write_msgfds,
+                                   s->write_msgfds_num);
 
         /* free the written msgfds, no matter what */
         if (s->write_msgfds_num) {
-- 
2.5.0




reply via email to

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