# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1178806640 -3600
# Node ID a6308744caae3e70fa7225a940f1593de3f41cc7
# Parent 5040a3ff50eea251486f454823b9ad588db71351
[qemu] Remove -vnclisten option since the same functionality is now
available using the -vnc option.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
tools/ioemu/vl.c | 40 ++++++++++++----------------------------
tools/ioemu/vl.h | 4 +---
tools/ioemu/vnc.c | 15 ++++++++-------
3 files changed, 21 insertions(+), 38 deletions(-)
diff -r 5040a3ff50ee -r a6308744caae tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Thu May 10 15:10:16 2007 +0100
+++ b/tools/ioemu/vl.c Thu May 10 15:17:20 2007 +0100
@@ -133,7 +133,6 @@ int nographic;
int nographic;
int vncviewer;
int vncunused;
-struct sockaddr_in vnclisten_addr;
const char* keyboard_layout = NULL;
int64_t ticks_per_sec;
char *boot_device = NULL;
@@ -3020,22 +3019,10 @@ fail:
return -1;
}
-int parse_host(struct sockaddr_in *saddr, const char *buf)
-{
+int parse_host_port(struct sockaddr_in *saddr, const char *str)
+{
+ char buf[512];
struct hostent *he;
-
- if ((he = gethostbyname(buf)) != NULL) {
- saddr->sin_addr = *(struct in_addr *)he->h_addr;
- } else {
- if (!inet_aton(buf, &saddr->sin_addr))
- return -1;
- }
- return 0;
-}
-
-int parse_host_port(struct sockaddr_in *saddr, const char *str)
-{
- char buf[512];
const char *p, *r;
int port;
@@ -3046,8 +3033,14 @@ int parse_host_port(struct sockaddr_in *
if (buf[0] == '\0') {
saddr->sin_addr.s_addr = 0;
} else {
- if (parse_host(saddr, buf) == -1)
- return -1;
+ if (isdigit(buf[0])) {
+ if (!inet_aton(buf, &saddr->sin_addr))
+ return -1;
+ } else {
+ if ((he = gethostbyname(buf)) == NULL)
+ return - 1;
+ saddr->sin_addr = *(struct in_addr *)he->h_addr;
+ }
}
port = strtol(p, (char **)&r, 0);
if (r == p)
@@ -6333,7 +6326,6 @@ void help(void)
"-vnc display start a VNC server on display\n"
"-vncviewer start a vncviewer process for this domain\n"
"-vncunused bind the VNC server to an unused port\n"
- "-vnclisten bind the VNC server to this address\n"
"-timeoffset time offset (in seconds) from local time\n"
#ifndef _WIN32
"-daemonize daemonize QEMU after initializing\n"
@@ -6435,7 +6427,6 @@ enum {
QEMU_OPTION_acpi,
QEMU_OPTION_vncviewer,
QEMU_OPTION_vncunused,
- QEMU_OPTION_vnclisten,
};
typedef struct QEMUOption {
@@ -6518,7 +6509,6 @@ const QEMUOption qemu_options[] = {
{ "vnc", HAS_ARG, QEMU_OPTION_vnc },
{ "vncviewer", 0, QEMU_OPTION_vncviewer },
{ "vncunused", 0, QEMU_OPTION_vncunused },
- { "vnclisten", HAS_ARG, QEMU_OPTION_vnclisten },
/* temporary options */
{ "usb", 0, QEMU_OPTION_usb },
@@ -7086,8 +7076,6 @@ int main(int argc, char **argv)
nb_nics = 0;
/* default mac address of the first network interface */
-
- memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
/* init debug */
sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log",
(long)getpid());
@@ -7492,9 +7480,6 @@ int main(int argc, char **argv)
case QEMU_OPTION_vncunused:
vncunused++;
break;
- case QEMU_OPTION_vnclisten:
- parse_host(&vnclisten_addr, optarg);
- break;
}
}
}
@@ -7794,8 +7779,7 @@ int main(int argc, char **argv)
dumb_display_init(ds);
} else if (vnc_display != NULL || vncunused != 0) {
int vnc_display_port;
- vnc_display_port = vnc_display_init(ds, vnc_display, vncunused,
- &vnclisten_addr);
+ vnc_display_port = vnc_display_init(ds, vnc_display, vncunused);
if (vncviewer)
vnc_start_viewer(vnc_display_port);
xenstore_write_vncport(vnc_display_port);
diff -r 5040a3ff50ee -r a6308744caae tools/ioemu/vl.h
--- a/tools/ioemu/vl.h Thu May 10 15:10:16 2007 +0100
+++ b/tools/ioemu/vl.h Thu May 10 15:17:20 2007 +0100
@@ -37,8 +37,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/types.h>
#include "xenctrl.h"
#include "xs.h"
#include <xen/hvm/e820.h>
@@ -956,7 +954,7 @@ void cocoa_display_init(DisplayState *ds
void cocoa_display_init(DisplayState *ds, int full_screen);
/* vnc.c */
-int vnc_display_init(DisplayState *ds, const char *display, int find_unused,
struct sockaddr_in *iaddr);
+int vnc_display_init(DisplayState *ds, const char *display, int find_unused);
void do_info_vnc(void);
int vnc_start_viewer(int port);
diff -r 5040a3ff50ee -r a6308744caae tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Thu May 10 15:10:16 2007 +0100
+++ b/tools/ioemu/vnc.c Thu May 10 15:17:20 2007 +0100
@@ -1393,9 +1393,10 @@ static void vnc_listen_read(void *opaque
extern int parse_host_port(struct sockaddr_in *saddr, const char *str);
-int vnc_display_init(DisplayState *ds, const char *arg, int find_unused,
struct sockaddr_in *iaddr)
+int vnc_display_init(DisplayState *ds, const char *arg, int find_unused)
{
struct sockaddr *addr;
+ struct sockaddr_in iaddr;
#ifndef _WIN32
struct sockaddr_un uaddr;
#endif
@@ -1456,8 +1457,8 @@ int vnc_display_init(DisplayState *ds, c
} else
#endif
{
- addr = (struct sockaddr *)iaddr;
- addrlen = sizeof(*iaddr);
+ addr = (struct sockaddr *)&iaddr;
+ addrlen = sizeof(iaddr);
vs->lsock = socket(PF_INET, SOCK_STREAM, 0);
if (vs->lsock == -1) {
@@ -1465,12 +1466,12 @@ int vnc_display_init(DisplayState *ds, c
exit(1);
}
- if (parse_host_port(iaddr, arg) < 0) {
+ if (parse_host_port(&iaddr, arg) < 0) {
fprintf(stderr, "Could not parse VNC address\n");
exit(1);
}
- iaddr->sin_port = htons(ntohs(iaddr->sin_port) + 5900);
+ iaddr.sin_port = htons(ntohs(iaddr.sin_port) + 5900);
reuse_addr = 1;
ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
@@ -1483,7 +1484,7 @@ int vnc_display_init(DisplayState *ds, c
while (bind(vs->lsock, addr, addrlen) == -1) {
if (find_unused && errno == EADDRINUSE) {
- iaddr->sin_port = htons(ntohs(iaddr->sin_port) + 1);
+ iaddr.sin_port = htons(ntohs(iaddr.sin_port) + 1);
continue;
}
fprintf(stderr, "bind() failed\n");
@@ -1500,7 +1501,7 @@ int vnc_display_init(DisplayState *ds, c
exit(1);
}
- return ntohs(iaddr->sin_port);
+ return ntohs(iaddr.sin_port);
}
int vnc_start_viewer(int port)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|