sockets: Rename SocketAddress to SocketAddressLegacy

The next commit will rename SocketAddressFlat to SocketAddress, and
the commit after that will replace most uses of SocketAddressLegacy by
SocketAddress, replacing most of this commit's renames right back.

Note that checkpatch emits a few "line over 80 characters" warnings.
The long lines are all temporary; the SocketAddressLegacy replacement
will shorten them again.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-5-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2017-04-26 09:36:39 +02:00
parent 4626a19c86
commit dfd100f242
23 changed files with 314 additions and 312 deletions

View file

@ -25,30 +25,30 @@
#include "trace.h"
static SocketAddress *tcp_build_address(const char *host_port, Error **errp)
static SocketAddressLegacy *tcp_build_address(const char *host_port, Error **errp)
{
InetSocketAddress *iaddr = g_new(InetSocketAddress, 1);
SocketAddress *saddr;
SocketAddressLegacy *saddr;
if (inet_parse(iaddr, host_port, errp)) {
qapi_free_InetSocketAddress(iaddr);
return NULL;
}
saddr = g_new0(SocketAddress, 1);
saddr->type = SOCKET_ADDRESS_KIND_INET;
saddr = g_new0(SocketAddressLegacy, 1);
saddr->type = SOCKET_ADDRESS_LEGACY_KIND_INET;
saddr->u.inet.data = iaddr;
return saddr;
}
static SocketAddress *unix_build_address(const char *path)
static SocketAddressLegacy *unix_build_address(const char *path)
{
SocketAddress *saddr;
SocketAddressLegacy *saddr;
saddr = g_new0(SocketAddress, 1);
saddr->type = SOCKET_ADDRESS_KIND_UNIX;
saddr = g_new0(SocketAddressLegacy, 1);
saddr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX;
saddr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
saddr->u.q_unix.data->path = g_strdup(path);
@ -90,14 +90,14 @@ static void socket_outgoing_migration(QIOTask *task,
}
static void socket_start_outgoing_migration(MigrationState *s,
SocketAddress *saddr,
SocketAddressLegacy *saddr,
Error **errp)
{
QIOChannelSocket *sioc = qio_channel_socket_new();
struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
data->s = s;
if (saddr->type == SOCKET_ADDRESS_KIND_INET) {
if (saddr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) {
data->hostname = g_strdup(saddr->u.inet.data->host);
}
@ -107,7 +107,7 @@ static void socket_start_outgoing_migration(MigrationState *s,
socket_outgoing_migration,
data,
socket_connect_data_free);
qapi_free_SocketAddress(saddr);
qapi_free_SocketAddressLegacy(saddr);
}
void tcp_start_outgoing_migration(MigrationState *s,
@ -115,7 +115,7 @@ void tcp_start_outgoing_migration(MigrationState *s,
Error **errp)
{
Error *err = NULL;
SocketAddress *saddr = tcp_build_address(host_port, &err);
SocketAddressLegacy *saddr = tcp_build_address(host_port, &err);
if (!err) {
socket_start_outgoing_migration(s, saddr, &err);
}
@ -126,7 +126,7 @@ void unix_start_outgoing_migration(MigrationState *s,
const char *path,
Error **errp)
{
SocketAddress *saddr = unix_build_address(path);
SocketAddressLegacy *saddr = unix_build_address(path);
socket_start_outgoing_migration(s, saddr, errp);
}
@ -160,7 +160,7 @@ out:
}
static void socket_start_incoming_migration(SocketAddress *saddr,
static void socket_start_incoming_migration(SocketAddressLegacy *saddr,
Error **errp)
{
QIOChannelSocket *listen_ioc = qio_channel_socket_new();
@ -170,7 +170,7 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
object_unref(OBJECT(listen_ioc));
qapi_free_SocketAddress(saddr);
qapi_free_SocketAddressLegacy(saddr);
return;
}
@ -179,13 +179,13 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
socket_accept_incoming_migration,
listen_ioc,
(GDestroyNotify)object_unref);
qapi_free_SocketAddress(saddr);
qapi_free_SocketAddressLegacy(saddr);
}
void tcp_start_incoming_migration(const char *host_port, Error **errp)
{
Error *err = NULL;
SocketAddress *saddr = tcp_build_address(host_port, &err);
SocketAddressLegacy *saddr = tcp_build_address(host_port, &err);
if (!err) {
socket_start_incoming_migration(saddr, &err);
}
@ -194,6 +194,6 @@ void tcp_start_incoming_migration(const char *host_port, Error **errp)
void unix_start_incoming_migration(const char *path, Error **errp)
{
SocketAddress *saddr = unix_build_address(path);
SocketAddressLegacy *saddr = unix_build_address(path);
socket_start_incoming_migration(saddr, errp);
}