aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-04-26 09:36:39 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-05-09 09:14:40 +0200
commitdfd100f242370886bb6732f70f1f7cbd8eb9fedc (patch)
tree3ad4f17ad74b5b420f556ccea55b391a39d5a2c5 /io
parent4626a19c86c30d96cedbac2bd44ef8103303cb37 (diff)
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>
Diffstat (limited to 'io')
-rw-r--r--io/channel-socket.c48
-rw-r--r--io/dns-resolver.c48
2 files changed, 48 insertions, 48 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 53386b7ba3..a21dab640e 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -27,7 +27,7 @@
#define SOCKET_MAX_FDS 16
-SocketAddress *
+SocketAddressLegacy *
qio_channel_socket_get_local_address(QIOChannelSocket *ioc,
Error **errp)
{
@@ -36,7 +36,7 @@ qio_channel_socket_get_local_address(QIOChannelSocket *ioc,
errp);
}
-SocketAddress *
+SocketAddressLegacy *
qio_channel_socket_get_remote_address(QIOChannelSocket *ioc,
Error **errp)
{
@@ -134,7 +134,7 @@ qio_channel_socket_new_fd(int fd,
int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
Error **errp)
{
int fd;
@@ -160,7 +160,7 @@ static void qio_channel_socket_connect_worker(QIOTask *task,
gpointer opaque)
{
QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));
- SocketAddress *addr = opaque;
+ SocketAddressLegacy *addr = opaque;
Error *err = NULL;
qio_channel_socket_connect_sync(ioc, addr, &err);
@@ -170,16 +170,16 @@ static void qio_channel_socket_connect_worker(QIOTask *task,
void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
QIOTaskFunc callback,
gpointer opaque,
GDestroyNotify destroy)
{
QIOTask *task = qio_task_new(
OBJECT(ioc), callback, opaque, destroy);
- SocketAddress *addrCopy;
+ SocketAddressLegacy *addrCopy;
- addrCopy = QAPI_CLONE(SocketAddress, addr);
+ addrCopy = QAPI_CLONE(SocketAddressLegacy, addr);
/* socket_connect() does a non-blocking connect(), but it
* still blocks in DNS lookups, so we must use a thread */
@@ -187,12 +187,12 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
qio_task_run_in_thread(task,
qio_channel_socket_connect_worker,
addrCopy,
- (GDestroyNotify)qapi_free_SocketAddress);
+ (GDestroyNotify)qapi_free_SocketAddressLegacy);
}
int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
Error **errp)
{
int fd;
@@ -219,7 +219,7 @@ static void qio_channel_socket_listen_worker(QIOTask *task,
gpointer opaque)
{
QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));
- SocketAddress *addr = opaque;
+ SocketAddressLegacy *addr = opaque;
Error *err = NULL;
qio_channel_socket_listen_sync(ioc, addr, &err);
@@ -229,29 +229,29 @@ static void qio_channel_socket_listen_worker(QIOTask *task,
void qio_channel_socket_listen_async(QIOChannelSocket *ioc,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
QIOTaskFunc callback,
gpointer opaque,
GDestroyNotify destroy)
{
QIOTask *task = qio_task_new(
OBJECT(ioc), callback, opaque, destroy);
- SocketAddress *addrCopy;
+ SocketAddressLegacy *addrCopy;
- addrCopy = QAPI_CLONE(SocketAddress, addr);
+ addrCopy = QAPI_CLONE(SocketAddressLegacy, addr);
/* socket_listen() blocks in DNS lookups, so we must use a thread */
trace_qio_channel_socket_listen_async(ioc, addr);
qio_task_run_in_thread(task,
qio_channel_socket_listen_worker,
addrCopy,
- (GDestroyNotify)qapi_free_SocketAddress);
+ (GDestroyNotify)qapi_free_SocketAddressLegacy);
}
int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
- SocketAddress *localAddr,
- SocketAddress *remoteAddr,
+ SocketAddressLegacy *localAddr,
+ SocketAddressLegacy *remoteAddr,
Error **errp)
{
int fd;
@@ -274,16 +274,16 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
struct QIOChannelSocketDGramWorkerData {
- SocketAddress *localAddr;
- SocketAddress *remoteAddr;
+ SocketAddressLegacy *localAddr;
+ SocketAddressLegacy *remoteAddr;
};
static void qio_channel_socket_dgram_worker_free(gpointer opaque)
{
struct QIOChannelSocketDGramWorkerData *data = opaque;
- qapi_free_SocketAddress(data->localAddr);
- qapi_free_SocketAddress(data->remoteAddr);
+ qapi_free_SocketAddressLegacy(data->localAddr);
+ qapi_free_SocketAddressLegacy(data->remoteAddr);
g_free(data);
}
@@ -303,8 +303,8 @@ static void qio_channel_socket_dgram_worker(QIOTask *task,
void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
- SocketAddress *localAddr,
- SocketAddress *remoteAddr,
+ SocketAddressLegacy *localAddr,
+ SocketAddressLegacy *remoteAddr,
QIOTaskFunc callback,
gpointer opaque,
GDestroyNotify destroy)
@@ -314,8 +314,8 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
struct QIOChannelSocketDGramWorkerData *data = g_new0(
struct QIOChannelSocketDGramWorkerData, 1);
- data->localAddr = QAPI_CLONE(SocketAddress, localAddr);
- data->remoteAddr = QAPI_CLONE(SocketAddress, remoteAddr);
+ data->localAddr = QAPI_CLONE(SocketAddressLegacy, localAddr);
+ data->remoteAddr = QAPI_CLONE(SocketAddressLegacy, remoteAddr);
trace_qio_channel_socket_dgram_async(ioc, localAddr, remoteAddr);
qio_task_run_in_thread(task,
diff --git a/io/dns-resolver.c b/io/dns-resolver.c
index 759d1b40d7..d3f0cbf319 100644
--- a/io/dns-resolver.c
+++ b/io/dns-resolver.c
@@ -45,9 +45,9 @@ QIODNSResolver *qio_dns_resolver_get_instance(void)
}
static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
size_t *naddrs,
- SocketAddress ***addrs,
+ SocketAddressLegacy ***addrs,
Error **errp)
{
struct addrinfo ai, *res, *e;
@@ -97,14 +97,14 @@ static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver,
(*naddrs)++;
}
- *addrs = g_new0(SocketAddress *, *naddrs);
+ *addrs = g_new0(SocketAddressLegacy *, *naddrs);
/* create socket + bind */
for (i = 0, e = res; e != NULL; i++, e = e->ai_next) {
- SocketAddress *newaddr = g_new0(SocketAddress, 1);
+ SocketAddressLegacy *newaddr = g_new0(SocketAddressLegacy, 1);
InetSocketAddress *newiaddr = g_new0(InetSocketAddress, 1);
newaddr->u.inet.data = newiaddr;
- newaddr->type = SOCKET_ADDRESS_KIND_INET;
+ newaddr->type = SOCKET_ADDRESS_LEGACY_KIND_INET;
getnameinfo((struct sockaddr *)e->ai_addr, e->ai_addrlen,
uaddr, INET6_ADDRSTRLEN, uport, 32,
@@ -129,36 +129,36 @@ static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver,
static int qio_dns_resolver_lookup_sync_nop(QIODNSResolver *resolver,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
size_t *naddrs,
- SocketAddress ***addrs,
+ SocketAddressLegacy ***addrs,
Error **errp)
{
*naddrs = 1;
- *addrs = g_new0(SocketAddress *, 1);
- (*addrs)[0] = QAPI_CLONE(SocketAddress, addr);
+ *addrs = g_new0(SocketAddressLegacy *, 1);
+ (*addrs)[0] = QAPI_CLONE(SocketAddressLegacy, addr);
return 0;
}
int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
size_t *naddrs,
- SocketAddress ***addrs,
+ SocketAddressLegacy ***addrs,
Error **errp)
{
switch (addr->type) {
- case SOCKET_ADDRESS_KIND_INET:
+ case SOCKET_ADDRESS_LEGACY_KIND_INET:
return qio_dns_resolver_lookup_sync_inet(resolver,
addr,
naddrs,
addrs,
errp);
- case SOCKET_ADDRESS_KIND_UNIX:
- case SOCKET_ADDRESS_KIND_VSOCK:
- case SOCKET_ADDRESS_KIND_FD:
+ case SOCKET_ADDRESS_LEGACY_KIND_UNIX:
+ case SOCKET_ADDRESS_LEGACY_KIND_VSOCK:
+ case SOCKET_ADDRESS_LEGACY_KIND_FD:
return qio_dns_resolver_lookup_sync_nop(resolver,
addr,
naddrs,
@@ -172,8 +172,8 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver,
struct QIODNSResolverLookupData {
- SocketAddress *addr;
- SocketAddress **addrs;
+ SocketAddressLegacy *addr;
+ SocketAddressLegacy **addrs;
size_t naddrs;
};
@@ -183,9 +183,9 @@ static void qio_dns_resolver_lookup_data_free(gpointer opaque)
struct QIODNSResolverLookupData *data = opaque;
size_t i;
- qapi_free_SocketAddress(data->addr);
+ qapi_free_SocketAddressLegacy(data->addr);
for (i = 0; i < data->naddrs; i++) {
- qapi_free_SocketAddress(data->addrs[i]);
+ qapi_free_SocketAddressLegacy(data->addrs[i]);
}
g_free(data->addrs);
@@ -216,7 +216,7 @@ static void qio_dns_resolver_lookup_worker(QIOTask *task,
void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,
- SocketAddress *addr,
+ SocketAddressLegacy *addr,
QIOTaskFunc func,
gpointer opaque,
GDestroyNotify notify)
@@ -225,7 +225,7 @@ void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,
struct QIODNSResolverLookupData *data =
g_new0(struct QIODNSResolverLookupData, 1);
- data->addr = QAPI_CLONE(SocketAddress, addr);
+ data->addr = QAPI_CLONE(SocketAddressLegacy, addr);
task = qio_task_new(OBJECT(resolver), func, opaque, notify);
@@ -239,7 +239,7 @@ void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,
void qio_dns_resolver_lookup_result(QIODNSResolver *resolver,
QIOTask *task,
size_t *naddrs,
- SocketAddress ***addrs)
+ SocketAddressLegacy ***addrs)
{
struct QIODNSResolverLookupData *data =
qio_task_get_result_pointer(task);
@@ -252,9 +252,9 @@ void qio_dns_resolver_lookup_result(QIODNSResolver *resolver,
}
*naddrs = data->naddrs;
- *addrs = g_new0(SocketAddress *, data->naddrs);
+ *addrs = g_new0(SocketAddressLegacy *, data->naddrs);
for (i = 0; i < data->naddrs; i++) {
- (*addrs)[i] = QAPI_CLONE(SocketAddress, data->addrs[i]);
+ (*addrs)[i] = QAPI_CLONE(SocketAddressLegacy, data->addrs[i]);
}
}