提交 e25a5822 编写于 作者: T ths

Extend monitor 'change' command for VNC, by Daniel P. Berrange.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3134 c046a42c-6fe2-441c-8c8c-71466251a162
上级 71cab5ca
...@@ -386,7 +386,7 @@ static void do_eject(int force, const char *filename) ...@@ -386,7 +386,7 @@ static void do_eject(int force, const char *filename)
eject_device(bs, force); eject_device(bs, force);
} }
static void do_change(const char *device, const char *filename) static void do_change_block(const char *device, const char *filename)
{ {
BlockDriverState *bs; BlockDriverState *bs;
...@@ -401,6 +401,21 @@ static void do_change(const char *device, const char *filename) ...@@ -401,6 +401,21 @@ static void do_change(const char *device, const char *filename)
qemu_key_check(bs, filename); qemu_key_check(bs, filename);
} }
static void do_change_vnc(const char *target)
{
if (vnc_display_open(NULL, target) < 0)
term_printf("could not start VNC server on %s\n", target);
}
static void do_change(const char *device, const char *target)
{
if (strcmp(device, "vnc") == 0) {
do_change_vnc(target);
} else {
do_change_block(device, target);
}
}
static void do_screen_dump(const char *filename) static void do_screen_dump(const char *filename)
{ {
vga_hw_screen_dump(filename); vga_hw_screen_dump(filename);
......
...@@ -1208,7 +1208,7 @@ void vnc_display_init(DisplayState *ds) ...@@ -1208,7 +1208,7 @@ void vnc_display_init(DisplayState *ds)
void vnc_display_close(DisplayState *ds) void vnc_display_close(DisplayState *ds)
{ {
VncState *vs = (VncState *)ds->opaque; VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
if (vs->display) { if (vs->display) {
qemu_free(vs->display); qemu_free(vs->display);
...@@ -1239,7 +1239,7 @@ int vnc_display_open(DisplayState *ds, const char *arg) ...@@ -1239,7 +1239,7 @@ int vnc_display_open(DisplayState *ds, const char *arg)
int reuse_addr, ret; int reuse_addr, ret;
socklen_t addrlen; socklen_t addrlen;
const char *p; const char *p;
VncState *vs = (VncState *)ds->opaque; VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
vnc_display_close(ds); vnc_display_close(ds);
if (strcmp(arg, "none") == 0) if (strcmp(arg, "none") == 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册