* Juan Quintela (quint...@redhat.com) wrote: > Migration code needs that function in hmp.c (so we need to export it), > and it needs it on tests/migration-test.c, so we need to move it to a > place where it is compiled into the test framework. > > Signed-off-by: Juan Quintela <quint...@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > --- > chardev/char-socket.c | 29 ----------------------------- > include/qemu/sockets.h | 3 +++ > util/qemu-sockets.c | 29 +++++++++++++++++++++++++++++ > 3 files changed, 32 insertions(+), 29 deletions(-) > > diff --git a/chardev/char-socket.c b/chardev/char-socket.c > index 159e69c3b1..3bbf3a37a0 100644 > --- a/chardev/char-socket.c > +++ b/chardev/char-socket.c > @@ -382,35 +382,6 @@ static void tcp_chr_free_connection(Chardev *chr) > s->connected = 0; > } > > -static char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, > - bool is_listen, bool is_telnet) > -{ > - switch (addr->type) { > - case SOCKET_ADDRESS_TYPE_INET: > - return g_strdup_printf("%s%s:%s:%s%s", prefix, > - is_telnet ? "telnet" : "tcp", > - addr->u.inet.host, > - addr->u.inet.port, > - is_listen ? ",server" : ""); > - break; > - case SOCKET_ADDRESS_TYPE_UNIX: > - return g_strdup_printf("%sunix:%s%s", prefix, > - addr->u.q_unix.path, > - is_listen ? ",server" : ""); > - break; > - case SOCKET_ADDRESS_TYPE_FD: > - return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.str, > - is_listen ? ",server" : ""); > - break; > - case SOCKET_ADDRESS_TYPE_VSOCK: > - return g_strdup_printf("%svsock:%s:%s", prefix, > - addr->u.vsock.cid, > - addr->u.vsock.port); > - default: > - abort(); > - } > -} > - > static void update_disconnected_filename(SocketChardev *s) > { > Chardev *chr = CHARDEV(s); > diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h > index 8140fea685..efea0ea850 100644 > --- a/include/qemu/sockets.h > +++ b/include/qemu/sockets.h > @@ -110,4 +110,7 @@ SocketAddress *socket_remote_address(int fd, Error > **errp); > */ > SocketAddress *socket_address_flatten(SocketAddressLegacy *addr); > > +char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, > + bool is_listen, bool is_telnet); > + > #endif /* QEMU_SOCKETS_H */ > diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c > index 8bd8bb64eb..09f04bf76b 100644 > --- a/util/qemu-sockets.c > +++ b/util/qemu-sockets.c > @@ -1333,3 +1333,32 @@ SocketAddress > *socket_address_flatten(SocketAddressLegacy *addr_legacy) > > return addr; > } > + > +char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, > + bool is_listen, bool is_telnet) > +{ > + switch (addr->type) { > + case SOCKET_ADDRESS_TYPE_INET: > + return g_strdup_printf("%s%s:%s:%s%s", prefix, > + is_telnet ? "telnet" : "tcp", > + addr->u.inet.host, > + addr->u.inet.port, > + is_listen ? ",server" : ""); > + break; > + case SOCKET_ADDRESS_TYPE_UNIX: > + return g_strdup_printf("%sunix:%s%s", prefix, > + addr->u.q_unix.path, > + is_listen ? ",server" : ""); > + break; > + case SOCKET_ADDRESS_TYPE_FD: > + return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.str, > + is_listen ? ",server" : ""); > + break; > + case SOCKET_ADDRESS_TYPE_VSOCK: > + return g_strdup_printf("%svsock:%s:%s", prefix, > + addr->u.vsock.cid, > + addr->u.vsock.port); > + default: > + abort(); > + } > +} > -- > 2.17.0 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK