qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

migration: Export functions to create send channels

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

+34 -1
+27 -1
migration/socket.c
··· 28 28 #include "trace.h" 29 29 30 30 31 + struct SocketOutgoingArgs { 32 + SocketAddress *saddr; 33 + } outgoing_args; 34 + 35 + void socket_send_channel_create(QIOTaskFunc f, void *data) 36 + { 37 + QIOChannelSocket *sioc = qio_channel_socket_new(); 38 + qio_channel_socket_connect_async(sioc, outgoing_args.saddr, 39 + f, data, NULL, NULL); 40 + } 41 + 42 + int socket_send_channel_destroy(QIOChannel *send) 43 + { 44 + /* Remove channel */ 45 + object_unref(OBJECT(send)); 46 + if (outgoing_args.saddr) { 47 + qapi_free_SocketAddress(outgoing_args.saddr); 48 + outgoing_args.saddr = NULL; 49 + } 50 + return 0; 51 + } 52 + 31 53 static SocketAddress *tcp_build_address(const char *host_port, Error **errp) 32 54 { 33 55 SocketAddress *saddr; ··· 95 117 struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); 96 118 97 119 data->s = s; 120 + 121 + /* in case previous migration leaked it */ 122 + qapi_free_SocketAddress(outgoing_args.saddr); 123 + outgoing_args.saddr = saddr; 124 + 98 125 if (saddr->type == SOCKET_ADDRESS_TYPE_INET) { 99 126 data->hostname = g_strdup(saddr->u.inet.host); 100 127 } ··· 106 133 data, 107 134 socket_connect_data_free, 108 135 NULL); 109 - qapi_free_SocketAddress(saddr); 110 136 } 111 137 112 138 void tcp_start_outgoing_migration(MigrationState *s,
+7
migration/socket.h
··· 16 16 17 17 #ifndef QEMU_MIGRATION_SOCKET_H 18 18 #define QEMU_MIGRATION_SOCKET_H 19 + 20 + #include "io/channel.h" 21 + #include "io/task.h" 22 + 23 + void socket_send_channel_create(QIOTaskFunc f, void *data); 24 + int socket_send_channel_destroy(QIOChannel *send); 25 + 19 26 void tcp_start_incoming_migration(const char *host_port, Error **errp); 20 27 21 28 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,