* [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup
@ 2010-01-20 13:42 Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Luiz Capitulino @ 2010-01-20 13:42 UTC (permalink / raw)
To: qemu-devel
This series makes VNC events code use inet_strfamily() from qemu-socket
instead of duplicating code, as suggested by Gerd.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public
2010-01-20 13:42 [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup Luiz Capitulino
@ 2010-01-20 13:42 ` Luiz Capitulino
2010-01-20 14:56 ` Anthony Liguori
2010-01-20 13:42 ` [Qemu-devel] [PATCH 2/3] net: inet_strfamily(): Better unknown family report Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 3/3] vnc: Use inet_strfamily() Luiz Capitulino
2 siblings, 1 reply; 5+ messages in thread
From: Luiz Capitulino @ 2010-01-20 13:42 UTC (permalink / raw)
To: qemu-devel
So that it can be used by other subsystems.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
qemu-sockets.c | 2 +-
qemu_socket.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 8850516..720de22 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -91,7 +91,7 @@ static void inet_setport(struct addrinfo *e, int port)
}
}
-static const char *inet_strfamily(int family)
+const char *inet_strfamily(int family)
{
switch (family) {
case PF_INET6: return "ipv6";
diff --git a/qemu_socket.h b/qemu_socket.h
index 86bdbf5..7ee46ac 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
@@ -44,6 +44,7 @@ int inet_listen(const char *str, char *ostr, int olen,
int inet_connect_opts(QemuOpts *opts);
int inet_connect(const char *str, int socktype);
int inet_dgram_opts(QemuOpts *opts);
+const char *inet_strfamily(int family);
int unix_listen_opts(QemuOpts *opts);
int unix_listen(const char *path, char *ostr, int olen);
--
1.6.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/3] net: inet_strfamily(): Better unknown family report
2010-01-20 13:42 [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
@ 2010-01-20 13:42 ` Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 3/3] vnc: Use inet_strfamily() Luiz Capitulino
2 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2010-01-20 13:42 UTC (permalink / raw)
To: qemu-devel
Returning "????" is a bit meaningless, let's call it "unknown".
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
qemu-sockets.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 720de22..d912fed 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -98,7 +98,7 @@ const char *inet_strfamily(int family)
case PF_INET: return "ipv4";
case PF_UNIX: return "unix";
}
- return "????";
+ return "unknown";
}
static void inet_print_addrinfo(const char *tag, struct addrinfo *res)
--
1.6.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 3/3] vnc: Use inet_strfamily()
2010-01-20 13:42 [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 2/3] net: inet_strfamily(): Better unknown family report Luiz Capitulino
@ 2010-01-20 13:42 ` Luiz Capitulino
2 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2010-01-20 13:42 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
vnc.c | 22 +---------------------
1 files changed, 1 insertions(+), 21 deletions(-)
diff --git a/vnc.c b/vnc.c
index c7d6652..cc2a26e 100644
--- a/vnc.c
+++ b/vnc.c
@@ -100,26 +100,6 @@ char *vnc_socket_remote_addr(const char *format, int fd) {
return addr_to_string(format, &sa, salen);
}
-static QString *get_sock_family(const struct sockaddr_storage *sa)
-{
- const char *name;
-
- switch (sa->ss_family)
- {
- case AF_INET:
- name = "ipv4";
- break;
- case AF_INET6:
- name = "ipv6";
- break;
- default:
- name = "unknown";
- break;
- }
-
- return qstring_from_str(name);
-}
-
static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
socklen_t salen)
{
@@ -138,7 +118,7 @@ static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
qdict_put(qdict, "host", qstring_from_str(host));
qdict_put(qdict, "service", qstring_from_str(serv));
- qdict_put(qdict, "family", get_sock_family(sa));
+ qdict_put(qdict, "family",qstring_from_str(inet_strfamily(sa->ss_family)));
return 0;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
@ 2010-01-20 14:56 ` Anthony Liguori
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2010-01-20 14:56 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
On 01/20/2010 07:42 AM, Luiz Capitulino wrote:
> So that it can be used by other subsystems.
>
> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> qemu-sockets.c | 2 +-
> qemu_socket.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index 8850516..720de22 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -91,7 +91,7 @@ static void inet_setport(struct addrinfo *e, int port)
> }
> }
>
> -static const char *inet_strfamily(int family)
> +const char *inet_strfamily(int family)
> {
> switch (family) {
> case PF_INET6: return "ipv6";
> diff --git a/qemu_socket.h b/qemu_socket.h
> index 86bdbf5..7ee46ac 100644
> --- a/qemu_socket.h
> +++ b/qemu_socket.h
> @@ -44,6 +44,7 @@ int inet_listen(const char *str, char *ostr, int olen,
> int inet_connect_opts(QemuOpts *opts);
> int inet_connect(const char *str, int socktype);
> int inet_dgram_opts(QemuOpts *opts);
> +const char *inet_strfamily(int family);
>
> int unix_listen_opts(QemuOpts *opts);
> int unix_listen(const char *path, char *ostr, int olen);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-20 14:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 13:42 [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
2010-01-20 14:56 ` Anthony Liguori
2010-01-20 13:42 ` [Qemu-devel] [PATCH 2/3] net: inet_strfamily(): Better unknown family report Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 3/3] vnc: Use inet_strfamily() Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).