From patchwork Wed Jul 18 17:49:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 171768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3CC292C0084 for ; Thu, 19 Jul 2012 03:49:32 +1000 (EST) Received: from localhost ([::1]:56559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrYNO-0005wy-C8 for incoming@patchwork.ozlabs.org; Wed, 18 Jul 2012 13:49:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrYNA-0005o1-Ui for qemu-devel@nongnu.org; Wed, 18 Jul 2012 13:49:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrYN4-00071o-Nt for qemu-devel@nongnu.org; Wed, 18 Jul 2012 13:49:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrYN4-00071i-Fo for qemu-devel@nongnu.org; Wed, 18 Jul 2012 13:49:10 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6IHn95d018800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Jul 2012 13:49:09 -0400 Received: from localhost (ovpn-113-90.phx2.redhat.com [10.3.113.90]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6IHn2QL008970; Wed, 18 Jul 2012 13:49:03 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 18 Jul 2012 14:49:12 -0300 Message-Id: <1342633760-351-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1342633760-351-1-git-send-email-lcapitulino@redhat.com> References: <1342633760-351-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 1/9] qerror: rename QERR_SOCKET_* macros X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The socket error classes call a socket 'Sock', like in SockConnectFailed, but the error macros call a socket SOCKET, like in QERR_SOCKET_CONNECT_FAILED. This will cause problems when the error macros creation get automated, because the macro name will be derived from the error class name. Avoid that by renaming all QERR_SOCKET_* macros to QERR_SOCK_*. Signed-off-by: Luiz Capitulino --- migration-tcp.c | 6 +++--- qemu-sockets.c | 22 +++++++++++----------- qerror.c | 10 +++++----- qerror.h | 10 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/migration-tcp.c b/migration-tcp.c index 440804d..587fc70 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -90,13 +90,13 @@ int tcp_start_outgoing_migration(MigrationState *s, const char *host_port, if (!error_is_set(errp)) { migrate_fd_connect(s); - } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) { + } else if (error_is_type(*errp, QERR_SOCK_CONNECT_IN_PROGRESS)) { DPRINTF("connect in progress\n"); qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s); - } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) { + } else if (error_is_type(*errp, QERR_SOCK_CREATE_FAILED)) { DPRINTF("connect failed\n"); return -1; - } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) { + } else if (error_is_type(*errp, QERR_SOCK_CONNECT_FAILED)) { DPRINTF("connect failed\n"); migrate_fd_error(s); return -1; diff --git a/qemu-sockets.c b/qemu-sockets.c index 2ae715d..1357ec0 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -120,7 +120,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) if ((qemu_opt_get(opts, "host") == NULL) || (qemu_opt_get(opts, "port") == NULL)) { fprintf(stderr, "%s: host and/or port not specified\n", __FUNCTION__); - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); return -1; } pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port")); @@ -139,7 +139,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) if (rc != 0) { fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, gai_strerror(rc)); - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); return -1; } @@ -153,7 +153,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) fprintf(stderr,"%s: socket(%s): %s\n", __FUNCTION__, inet_strfamily(e->ai_family), strerror(errno)); if (!e->ai_next) { - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); } continue; } @@ -179,7 +179,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) inet_strfamily(e->ai_family), uaddr, inet_getport(e), strerror(errno)); if (!e->ai_next) { - error_set(errp, QERR_SOCKET_BIND_FAILED); + error_set(errp, QERR_SOCK_BIND_FAILED); } } } @@ -191,7 +191,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) listen: if (listen(slisten,1) != 0) { - error_set(errp, QERR_SOCKET_LISTEN_FAILED); + error_set(errp, QERR_SOCK_LISTEN_FAILED); perror("listen"); closesocket(slisten); freeaddrinfo(res); @@ -226,7 +226,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) block = qemu_opt_get_bool(opts, "block", 0); if (addr == NULL || port == NULL) { fprintf(stderr, "inet_connect: host and/or port not specified\n"); - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); return -1; } @@ -239,7 +239,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) if (0 != (rc = getaddrinfo(addr, port, &ai, &res))) { fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, gai_strerror(rc)); - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); return -1; } @@ -274,7 +274,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) #else if (!block && (rc == -EINPROGRESS)) { #endif - error_set(errp, QERR_SOCKET_CONNECT_IN_PROGRESS); + error_set(errp, QERR_SOCK_CONNECT_IN_PROGRESS); } else if (rc < 0) { if (NULL == e->ai_next) fprintf(stderr, "%s: connect(%s,%s,%s,%s): %s\n", __FUNCTION__, @@ -287,7 +287,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) freeaddrinfo(res); return sock; } - error_set(errp, QERR_SOCKET_CONNECT_FAILED); + error_set(errp, QERR_SOCK_CONNECT_FAILED); freeaddrinfo(res); return -1; } @@ -479,7 +479,7 @@ int inet_listen(const char *str, char *ostr, int olen, } } } else { - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); } qemu_opts_del(opts); return sock; @@ -497,7 +497,7 @@ int inet_connect(const char *str, bool block, Error **errp) } sock = inet_connect_opts(opts, errp); } else { - error_set(errp, QERR_SOCKET_CREATE_FAILED); + error_set(errp, QERR_SOCK_CREATE_FAILED); } qemu_opts_del(opts); return sock; diff --git a/qerror.c b/qerror.c index 92c4eff..e988e36 100644 --- a/qerror.c +++ b/qerror.c @@ -309,23 +309,23 @@ static const QErrorStringTable qerror_table[] = { .desc = "Could not start VNC server on %(target)", }, { - .error_fmt = QERR_SOCKET_CONNECT_IN_PROGRESS, + .error_fmt = QERR_SOCK_CONNECT_IN_PROGRESS, .desc = "Connection can not be completed immediately", }, { - .error_fmt = QERR_SOCKET_CONNECT_FAILED, + .error_fmt = QERR_SOCK_CONNECT_FAILED, .desc = "Failed to connect to socket", }, { - .error_fmt = QERR_SOCKET_LISTEN_FAILED, + .error_fmt = QERR_SOCK_LISTEN_FAILED, .desc = "Failed to set socket to listening mode", }, { - .error_fmt = QERR_SOCKET_BIND_FAILED, + .error_fmt = QERR_SOCK_BIND_FAILED, .desc = "Failed to bind socket", }, { - .error_fmt = QERR_SOCKET_CREATE_FAILED, + .error_fmt = QERR_SOCK_CREATE_FAILED, .desc = "Failed to create socket", }, {} diff --git a/qerror.h b/qerror.h index b4c8758..71b0496 100644 --- a/qerror.h +++ b/qerror.h @@ -251,19 +251,19 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_VNC_SERVER_FAILED \ "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }" -#define QERR_SOCKET_CONNECT_IN_PROGRESS \ +#define QERR_SOCK_CONNECT_IN_PROGRESS \ "{ 'class': 'SockConnectInprogress', 'data': {} }" -#define QERR_SOCKET_CONNECT_FAILED \ +#define QERR_SOCK_CONNECT_FAILED \ "{ 'class': 'SockConnectFailed', 'data': {} }" -#define QERR_SOCKET_LISTEN_FAILED \ +#define QERR_SOCK_LISTEN_FAILED \ "{ 'class': 'SockListenFailed', 'data': {} }" -#define QERR_SOCKET_BIND_FAILED \ +#define QERR_SOCK_BIND_FAILED \ "{ 'class': 'SockBindFailed', 'data': {} }" -#define QERR_SOCKET_CREATE_FAILED \ +#define QERR_SOCK_CREATE_FAILED \ "{ 'class': 'SockCreateFailed', 'data': {} }" #endif /* QERROR_H */