summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-07-27 16:49:00 +0300
committerAvi Kivity <avi@redhat.com>2011-07-27 16:49:00 +0300
commit59fadccd3879e965cc6d2f62d8826b78c5ca4936 (patch)
tree16b5368255e7edf4070320b5ca128aa5a96cd3d4
parentMerge commit '6141dbfe0a595076310f690ec8db84ad5be2cde5' into upstream-merge (diff)
parentBump version to reflect v0.15.0-rc0 (diff)
downloadqemu-kvm-59fadccd3879e965cc6d2f62d8826b78c5ca4936.tar.gz
qemu-kvm-59fadccd3879e965cc6d2f62d8826b78c5ca4936.tar.bz2
qemu-kvm-59fadccd3879e965cc6d2f62d8826b78c5ca4936.zip
Merge commit 'v0.15.0-rc0' into upstream-merge
* commit 'v0.15.0-rc0': Bump version to reflect v0.15.0-rc0 Correct spelling of licensed Register Linux dyntick timer as per-thread signal mc146818rtc: Handle host clock resets qemu-timer: Introduce clock reset notifier notifier: Pass data argument to callback ide: Turn properties any IDE device must have into bus properties virtio-serial: Turn props any virtio-serial-bus device must have into bus props virtio-serial: Clean up virtser_bus_dev_print() output usb-ccid: Drop unused CCIDCardInfo callback print() Remove unused USES_X509_AUTH macro from VNC sasl code Introduce a 'client_add' monitor command accepting an open FD Store VNC auth scheme per-client as well as per-server do not reset no_shutdown after we shutdown the vm vl.c: Don't limit node count by smp count vga: Fix type of lfb/map_addr/end. qemu-char: Print strerror message on failure qemu-timer: change unix timer to dynticks iothread: replace fair_mutex with a condition variable multiboot: Support commas in module parameters Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--VERSION2
-rw-r--r--compatfd.c11
-rw-r--r--compatfd.h1
-rw-r--r--console.c8
-rw-r--r--console.h3
-rw-r--r--cpus.c24
-rw-r--r--hw/a9mpcore.c2
-rw-r--r--hw/acpi_piix4.c2
-rw-r--r--hw/an5206.c2
-rw-r--r--hw/arm-misc.h2
-rw-r--r--hw/arm11mpcore.c2
-rw-r--r--hw/arm_boot.c2
-rw-r--r--hw/arm_gic.c2
-rw-r--r--hw/arm_pic.c2
-rw-r--r--hw/arm_sysctl.c2
-rw-r--r--hw/arm_timer.c2
-rw-r--r--hw/armv7m_nvic.c2
-rw-r--r--hw/baum.c7
-rw-r--r--hw/bitbang_i2c.c2
-rw-r--r--hw/ccid-card-emulated.c2
-rw-r--r--hw/ccid.h3
-rw-r--r--hw/ds1338.c2
-rw-r--r--hw/dummy_m68k.c2
-rw-r--r--hw/fw_cfg.c2
-rw-r--r--hw/i2c.c2
-rw-r--r--hw/ide/qdev.c5
-rw-r--r--hw/integratorcp.c2
-rw-r--r--hw/lan9118.c2
-rw-r--r--hw/lsi53c895a.c2
-rw-r--r--hw/marvell_88w8618_audio.c2
-rw-r--r--hw/mc146818rtc.c20
-rw-r--r--hw/mcf5206.c2
-rw-r--r--hw/mcf5208.c2
-rw-r--r--hw/mcf_fec.c2
-rw-r--r--hw/mcf_intc.c2
-rw-r--r--hw/mcf_uart.c2
-rw-r--r--hw/mpcore.c2
-rw-r--r--hw/msmouse.c5
-rw-r--r--hw/msmouse.h2
-rw-r--r--hw/multiboot.c18
-rw-r--r--hw/musicpal.c2
-rw-r--r--hw/pl011.c2
-rw-r--r--hw/pl022.c2
-rw-r--r--hw/pl050.c2
-rw-r--r--hw/pl061.c2
-rw-r--r--hw/pl080.c2
-rw-r--r--hw/pl110.c2
-rw-r--r--hw/pl110_template.h2
-rw-r--r--hw/pl181.c2
-rw-r--r--hw/pl190.c2
-rw-r--r--hw/ptimer.c2
-rw-r--r--hw/pxa.h2
-rw-r--r--hw/pxa2xx.c2
-rw-r--r--hw/pxa2xx_dma.c2
-rw-r--r--hw/pxa2xx_pic.c2
-rw-r--r--hw/pxa2xx_timer.c2
-rw-r--r--hw/realview.c2
-rw-r--r--hw/realview_gic.c2
-rw-r--r--hw/scsi-disk.c2
-rw-r--r--hw/scsi-generic.c2
-rw-r--r--hw/sh_intc.c2
-rw-r--r--hw/sh_timer.c2
-rw-r--r--hw/smbus.c2
-rw-r--r--hw/smc91c111.c2
-rw-r--r--hw/ssd0303.c2
-rw-r--r--hw/ssd0323.c2
-rw-r--r--hw/ssi-sd.c2
-rw-r--r--hw/ssi.c2
-rw-r--r--hw/stellaris.c2
-rw-r--r--hw/stellaris_enet.c2
-rw-r--r--hw/stellaris_input.c2
-rw-r--r--hw/usb-ccid.c11
-rw-r--r--hw/usb-msd.c2
-rw-r--r--hw/usb-serial.c2
-rw-r--r--hw/versatile_pci.c2
-rw-r--r--hw/versatilepb.c2
-rw-r--r--hw/vga_int.h10
-rw-r--r--hw/virtio-console.c4
-rw-r--r--hw/virtio-serial-bus.c18
-rw-r--r--input.c2
-rw-r--r--migration.c12
-rw-r--r--monitor.c32
-rw-r--r--notify.c4
-rw-r--r--notify.h4
-rw-r--r--qemu-char.c195
-rw-r--r--qemu-char.h2
-rw-r--r--qemu-timer.c77
-rw-r--r--qemu-timer.h5
-rw-r--r--qerror.c4
-rw-r--r--qerror.h3
-rw-r--r--qmp-commands.hx27
-rw-r--r--softmmu-semi.h2
-rw-r--r--spice-qemu-char.c9
-rw-r--r--target-arm/neon_helper.c2
-rw-r--r--target-arm/op_addsub.h2
-rw-r--r--ui/qemu-spice.h2
-rw-r--r--ui/sdl.c2
-rw-r--r--ui/spice-core.c2
-rw-r--r--ui/spice-input.c4
-rw-r--r--ui/vnc-auth-sasl.c15
-rw-r--r--ui/vnc-auth-vencrypt.c18
-rw-r--r--ui/vnc.c50
-rw-r--r--ui/vnc.h2
-rw-r--r--usb-linux.c2
-rw-r--r--vl.c9
-rw-r--r--xen-all.c2
106 files changed, 486 insertions, 280 deletions
diff --git a/VERSION b/VERSION
index d07c6d0e0..fc6f2940a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.14.50
+0.14.90
diff --git a/compatfd.c b/compatfd.c
index 41586ceae..31654c62a 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -115,3 +115,14 @@ int qemu_signalfd(const sigset_t *mask)
return qemu_signalfd_compat(mask);
}
+
+bool qemu_signalfd_available(void)
+{
+#ifdef CONFIG_SIGNALFD
+ errno = 0;
+ syscall(SYS_signalfd, -1, NULL, _NSIG / 8);
+ return errno != ENOSYS;
+#else
+ return false;
+#endif
+}
diff --git a/compatfd.h b/compatfd.h
index fc3791520..6b04877b9 100644
--- a/compatfd.h
+++ b/compatfd.h
@@ -39,5 +39,6 @@ struct qemu_signalfd_siginfo {
};
int qemu_signalfd(const sigset_t *mask);
+bool qemu_signalfd_available(void);
#endif
diff --git a/console.c b/console.c
index acd8ca162..242086cf4 100644
--- a/console.c
+++ b/console.c
@@ -1514,7 +1514,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
chr->init(chr);
}
-CharDriverState *text_console_init(QemuOpts *opts)
+int text_console_init(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
TextConsole *s;
@@ -1546,7 +1546,7 @@ CharDriverState *text_console_init(QemuOpts *opts)
if (!s) {
free(chr);
- return NULL;
+ return -EBUSY;
}
s->chr = chr;
@@ -1554,7 +1554,9 @@ CharDriverState *text_console_init(QemuOpts *opts)
s->g_height = height;
chr->opaque = s;
chr->chr_set_echo = text_console_set_echo;
- return chr;
+
+ *_chr = chr;
+ return 0;
}
void text_consoles_set_display(DisplayState *ds)
diff --git a/console.h b/console.h
index 64d1f090e..67d137384 100644
--- a/console.h
+++ b/console.h
@@ -354,7 +354,7 @@ void vga_hw_text_update(console_ch_t *chardata);
int is_graphic_console(void);
int is_fixedsize_console(void);
-CharDriverState *text_console_init(QemuOpts *opts);
+int text_console_init(QemuOpts *opts, CharDriverState **_chr);
void text_consoles_set_display(DisplayState *ds);
void console_select(unsigned int index);
void console_color_init(DisplayState *ds);
@@ -372,6 +372,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
void vnc_display_init(DisplayState *ds);
void vnc_display_close(DisplayState *ds);
int vnc_display_open(DisplayState *ds, const char *display);
+void vnc_display_add_client(DisplayState *ds, int csock, int skipauth);
int vnc_display_disable_login(DisplayState *ds);
char *vnc_display_local_addr(DisplayState *ds);
#ifdef CONFIG_VNC
diff --git a/cpus.c b/cpus.c
index 007345ab3..fcbb9df47 100644
--- a/cpus.c
+++ b/cpus.c
@@ -636,7 +636,8 @@ void vm_stop(int reason)
#else /* CONFIG_IOTHREAD */
QemuMutex qemu_global_mutex;
-static QemuMutex qemu_fair_mutex;
+static QemuCond qemu_io_proceeded_cond;
+static bool iothread_requesting_mutex;
static QemuThread io_thread;
@@ -672,7 +673,7 @@ int qemu_init_main_loop(void)
qemu_cond_init(&qemu_system_cond);
qemu_cond_init(&qemu_pause_cond);
qemu_cond_init(&qemu_work_cond);
- qemu_mutex_init(&qemu_fair_mutex);
+ qemu_cond_init(&qemu_io_proceeded_cond);
qemu_mutex_init(&qemu_global_mutex);
qemu_mutex_lock(&qemu_global_mutex);
@@ -760,17 +761,9 @@ static void qemu_tcg_wait_io_event(void)
qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
}
- qemu_mutex_unlock(&qemu_global_mutex);
-
- /*
- * Users of qemu_global_mutex can be starved, having no chance
- * to acquire it since this path will get to it first.
- * So use another lock to provide fairness.
- */
- qemu_mutex_lock(&qemu_fair_mutex);
- qemu_mutex_unlock(&qemu_fair_mutex);
-
- qemu_mutex_lock(&qemu_global_mutex);
+ while (iothread_requesting_mutex) {
+ qemu_cond_wait(&qemu_io_proceeded_cond, &qemu_global_mutex);
+ }
for (env = first_cpu; env != NULL; env = env->next_cpu) {
qemu_wait_io_event_common(env);
@@ -913,12 +906,13 @@ void qemu_mutex_lock_iothread(void)
if (kvm_enabled()) {
qemu_mutex_lock(&qemu_global_mutex);
} else {
- qemu_mutex_lock(&qemu_fair_mutex);
+ iothread_requesting_mutex = true;
if (qemu_mutex_trylock(&qemu_global_mutex)) {
qemu_cpu_kick_thread(first_cpu);
qemu_mutex_lock(&qemu_global_mutex);
}
- qemu_mutex_unlock(&qemu_fair_mutex);
+ iothread_requesting_mutex = false;
+ qemu_cond_broadcast(&qemu_io_proceeded_cond);
}
}
diff --git a/hw/a9mpcore.c b/hw/a9mpcore.c
index b5e532839..6f108f4ce 100644
--- a/hw/a9mpcore.c
+++ b/hw/a9mpcore.c
@@ -4,7 +4,7 @@
* Copyright (c) 2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
/* 64 external IRQ lines. */
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c8ce09380..44eb8aee5 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -319,7 +319,7 @@ static void piix4_powerdown(void *opaque, int irq, int power_failing)
acpi_pm1_evt_power_down(pm1a, tmr);
}
-static void piix4_pm_machine_ready(struct Notifier* n)
+static void piix4_pm_machine_ready(Notifier *n, void *opaque)
{
PIIX4PMState *s = container_of(n, PIIX4PMState, machine_ready);
uint8_t *pci_conf;
diff --git a/hw/an5206.c b/hw/an5206.c
index 42a0163fb..04ca420a9 100644
--- a/hw/an5206.c
+++ b/hw/an5206.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 9aeeaea75..f8a747289 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*
*/
diff --git a/hw/arm11mpcore.c b/hw/arm11mpcore.c
index 3bbd8856c..b47707f7b 100644
--- a/hw/arm11mpcore.c
+++ b/hw/arm11mpcore.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index e0215768b..215d5dec6 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/arm_gic.c b/hw/arm_gic.c
index 0e934ecd6..fb07314d5 100644
--- a/hw/arm_gic.c
+++ b/hw/arm_gic.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
/* This file contains implementation code for the RealView EB interrupt
diff --git a/hw/arm_pic.c b/hw/arm_pic.c
index f44568ceb..985148a38 100644
--- a/hw/arm_pic.c
+++ b/hw/arm_pic.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL
+ * This code is licensed under the LGPL
*/
#include "hw.h"
diff --git a/hw/arm_sysctl.c b/hw/arm_sysctl.c
index 9225b588b..fd0c8bc3d 100644
--- a/hw/arm_sysctl.c
+++ b/hw/arm_sysctl.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index dac9e7075..fd9448f05 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c
index d06eec9b3..1df8d4db4 100644
--- a/hw/armv7m_nvic.c
+++ b/hw/armv7m_nvic.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*
* The ARMv7M System controller is fairly tightly tied in with the
* NVIC. Much of that is also implemented here.
diff --git a/hw/baum.c b/hw/baum.c
index 2aaf5ffe9..33a22a73d 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -576,7 +576,7 @@ static void baum_close(struct CharDriverState *chr)
qemu_free(baum);
}
-CharDriverState *chr_baum_init(QemuOpts *opts)
+int chr_baum_init(QemuOpts *opts, CharDriverState **_chr)
{
BaumDriverState *baum;
CharDriverState *chr;
@@ -629,7 +629,8 @@ CharDriverState *chr_baum_init(QemuOpts *opts)
qemu_chr_generic_open(chr);
- return chr;
+ *_chr = chr;
+ return 0;
fail:
qemu_free_timer(baum->cellCount_timer);
@@ -638,5 +639,5 @@ fail_handle:
qemu_free(handle);
qemu_free(chr);
qemu_free(baum);
- return NULL;
+ return -EIO;
}
diff --git a/hw/bitbang_i2c.c b/hw/bitbang_i2c.c
index 2937b5c4a..53e9c5c4c 100644
--- a/hw/bitbang_i2c.c
+++ b/hw/bitbang_i2c.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 2008 Jan Kiszka
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "hw.h"
#include "bitbang_i2c.h"
diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c
index 0b0718426..4762e8511 100644
--- a/hw/ccid-card-emulated.c
+++ b/hw/ccid-card-emulated.c
@@ -4,7 +4,7 @@
* Copyright (c) 2011 Red Hat.
* Written by Alon Levy.
*
- * This code is licenced under the GNU LGPL, version 2 or later.
+ * This code is licensed under the GNU LGPL, version 2 or later.
*/
/*
diff --git a/hw/ccid.h b/hw/ccid.h
index dbfc13c4f..9e3abe1b4 100644
--- a/hw/ccid.h
+++ b/hw/ccid.h
@@ -4,7 +4,7 @@
* Copyright (c) 2011 Red Hat.
* Written by Alon Levy.
*
- * This code is licenced under the GNU LGPL, version 2 or later.
+ * This code is licensed under the GNU LGPL, version 2 or later.
*/
#ifndef CCID_H
@@ -29,7 +29,6 @@ struct CCIDCardState {
*/
struct CCIDCardInfo {
DeviceInfo qdev;
- void (*print)(Monitor *mon, CCIDCardState *card, int indent);
const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
void (*apdu_from_guest)(CCIDCardState *card,
const uint8_t *apdu,
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 6f5ae5e6c..3522af5b5 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -4,7 +4,7 @@
* Copyright (c) 2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "i2c.h"
diff --git a/hw/dummy_m68k.c b/hw/dummy_m68k.c
index cec1cc8e8..eed9e3843 100644
--- a/hw/dummy_m68k.c
+++ b/hw/dummy_m68k.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 85c8c3c7b..34e7526d5 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -316,7 +316,7 @@ int fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data,
return 1;
}
-static void fw_cfg_machine_ready(struct Notifier* n)
+static void fw_cfg_machine_ready(struct Notifier *n, void *data)
{
uint32_t len;
FWCfgState *s = container_of(n, FWCfgState, machine_ready);
diff --git a/hw/i2c.c b/hw/i2c.c
index f80d12db4..49b9ecb8b 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
#include "i2c.h"
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index d9b8f24bb..6bd8d2027 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -31,6 +31,10 @@ static struct BusInfo ide_bus_info = {
.name = "IDE",
.size = sizeof(IDEBus),
.get_fw_dev_path = idebus_get_fw_dev_path,
+ .props = (Property[]) {
+ DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
+ DEFINE_PROP_END_OF_LIST(),
+ },
};
void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
@@ -174,7 +178,6 @@ static int ide_drive_initfn(IDEDevice *dev)
}
#define DEFINE_IDE_DEV_PROPERTIES() \
- DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1), \
DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \
DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \
DEFINE_PROP_STRING("serial", IDEDrive, dev.serial)
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index a6c27be82..281410899 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "sysbus.h"
diff --git a/hw/lan9118.c b/hw/lan9118.c
index 3f3c05df4..73a8661ca 100644
--- a/hw/lan9118.c
+++ b/hw/lan9118.c
@@ -4,7 +4,7 @@
* Copyright (c) 2009 CodeSourcery, LLC.
* Written by Paul Brook
*
- * This code is licenced under the GNU GPL v2
+ * This code is licensed under the GNU GPL v2
*/
#include "sysbus.h"
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 69eec1d2f..e9904c49d 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
/* ??? Need to check if the {read,write}[wl] routines work properly on
diff --git a/hw/marvell_88w8618_audio.c b/hw/marvell_88w8618_audio.c
index 3eff925b0..f8c524286 100644
--- a/hw/marvell_88w8618_audio.c
+++ b/hw/marvell_88w8618_audio.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 2008 Jan Kiszka
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "sysbus.h"
#include "hw.h"
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 1c9a706b1..feb3b25ac 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -99,6 +99,7 @@ typedef struct RTCState {
QEMUTimer *coalesced_timer;
QEMUTimer *second_timer;
QEMUTimer *second_timer2;
+ Notifier clock_reset_notifier;
} RTCState;
static void rtc_set_time(RTCState *s);
@@ -572,6 +573,22 @@ static const VMStateDescription vmstate_rtc = {
}
};
+static void rtc_notify_clock_reset(Notifier *notifier, void *data)
+{
+ RTCState *s = container_of(notifier, RTCState, clock_reset_notifier);
+ int64_t now = *(int64_t *)data;
+
+ rtc_set_date_from_host(&s->dev);
+ s->next_second_time = now + (get_ticks_per_sec() * 99) / 100;
+ qemu_mod_timer(s->second_timer2, s->next_second_time);
+ rtc_timer_update(s, now);
+#ifdef TARGET_I386
+ if (rtc_td_hack) {
+ rtc_coalesced_timer_update(s);
+ }
+#endif
+}
+
static void rtc_reset(void *opaque)
{
RTCState *s = opaque;
@@ -608,6 +625,9 @@ static int rtc_initfn(ISADevice *dev)
s->second_timer = qemu_new_timer_ns(rtc_clock, rtc_update_second, s);
s->second_timer2 = qemu_new_timer_ns(rtc_clock, rtc_update_second2, s);
+ s->clock_reset_notifier.notify = rtc_notify_clock_reset;
+ qemu_register_clock_reset_notifier(rtc_clock, &s->clock_reset_notifier);
+
s->next_second_time =
qemu_get_clock_ns(rtc_clock) + (get_ticks_per_sec() * 99) / 100;
qemu_mod_timer(s->second_timer2, s->next_second_time);
diff --git a/hw/mcf5206.c b/hw/mcf5206.c
index 2a618d444..fce282d98 100644
--- a/hw/mcf5206.c
+++ b/hw/mcf5206.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
#include "mcf.h"
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 17a692d4a..78fbc5f23 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
#include "mcf.h"
diff --git a/hw/mcf_fec.c b/hw/mcf_fec.c
index 5477e0e15..748eb5906 100644
--- a/hw/mcf_fec.c
+++ b/hw/mcf_fec.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
#include "net.h"
diff --git a/hw/mcf_intc.c b/hw/mcf_intc.c
index ac0429519..6cb0a09b7 100644
--- a/hw/mcf_intc.c
+++ b/hw/mcf_intc.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
#include "mcf.h"
diff --git a/hw/mcf_uart.c b/hw/mcf_uart.c
index db57096af..905e116de 100644
--- a/hw/mcf_uart.c
+++ b/hw/mcf_uart.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "hw.h"
#include "mcf.h"
diff --git a/hw/mpcore.c b/hw/mpcore.c
index 379065a3e..d77850751 100644
--- a/hw/mpcore.c
+++ b/hw/mpcore.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/msmouse.c b/hw/msmouse.c
index 05f893ca9..67c6cd43e 100644
--- a/hw/msmouse.c
+++ b/hw/msmouse.c
@@ -64,7 +64,7 @@ static void msmouse_chr_close (struct CharDriverState *chr)
qemu_free (chr);
}
-CharDriverState *qemu_chr_open_msmouse(QemuOpts *opts)
+int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
@@ -74,5 +74,6 @@ CharDriverState *qemu_chr_open_msmouse(QemuOpts *opts)
qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse");
- return chr;
+ *_chr = chr;
+ return 0;
}
diff --git a/hw/msmouse.h b/hw/msmouse.h
index 456cb2142..8b853b35b 100644
--- a/hw/msmouse.h
+++ b/hw/msmouse.h
@@ -1,2 +1,2 @@
/* msmouse.c */
-CharDriverState *qemu_chr_open_msmouse(QemuOpts *opts);
+int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr);
diff --git a/hw/multiboot.c b/hw/multiboot.c
index 6e6cfb953..2426e8483 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -97,11 +97,11 @@ typedef struct {
static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
{
- int len = strlen(cmdline) + 1;
target_phys_addr_t p = s->offset_cmdlines;
+ char *b = (char *)s->mb_buf + p;
- pstrcpy((char *)s->mb_buf + p, len, cmdline);
- s->offset_cmdlines += len;
+ get_opt_value(b, strlen(cmdline) + 1, cmdline);
+ s->offset_cmdlines += strlen(b) + 1;
return s->mb_buf_phys + p;
}
@@ -238,7 +238,7 @@ int load_multiboot(void *fw_cfg,
const char *r = initrd_filename;
mbs.mb_buf_size += strlen(r) + 1;
mbs.mb_mods_avail = 1;
- while ((r = strchr(r, ','))) {
+ while (*(r = get_opt_value(NULL, 0, r))) {
mbs.mb_mods_avail++;
r++;
}
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
if (initrd_filename) {
- char *next_initrd;
+ char *next_initrd, not_last;
mbs.offset_mods = mbs.mb_buf_size;
@@ -261,9 +261,9 @@ int load_multiboot(void *fw_cfg,
int mb_mod_length;
uint32_t offs = mbs.mb_buf_size;
- next_initrd = strchr(initrd_filename, ',');
- if (next_initrd)
- *next_initrd = '\0';
+ next_initrd = (char *)get_opt_value(NULL, 0, initrd_filename);
+ not_last = *next_initrd;
+ *next_initrd = '\0';
/* if a space comes after the module filename, treat everything
after that as parameters */
target_phys_addr_t c = mb_add_cmdline(&mbs, initrd_filename);
@@ -287,7 +287,7 @@ int load_multiboot(void *fw_cfg,
(char *)mbs.mb_buf + offs,
(char *)mbs.mb_buf + offs + mb_mod_length, c);
initrd_filename = next_initrd+1;
- } while (next_initrd);
+ } while (not_last);
}
/* Commandline support */
diff --git a/hw/musicpal.c b/hw/musicpal.c
index 52b2931d1..63dd39117 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2008 Jan Kiszka
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "sysbus.h"
diff --git a/hw/pl011.c b/hw/pl011.c
index 3b94b14cb..997ce848f 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pl022.c b/hw/pl022.c
index 00e494a0d..9a1cb710f 100644
--- a/hw/pl022.c
+++ b/hw/pl022.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pl050.c b/hw/pl050.c
index b155cc07b..f7fa2e253 100644
--- a/hw/pl050.c
+++ b/hw/pl050.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pl061.c b/hw/pl061.c
index 372dfc2da..79e5c53e8 100644
--- a/hw/pl061.c
+++ b/hw/pl061.c
@@ -5,7 +5,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pl080.c b/hw/pl080.c
index dd8139ba9..5ba3b0859 100644
--- a/hw/pl080.c
+++ b/hw/pl080.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pl110.c b/hw/pl110.c
index 06d2dfada..62aba17ad 100644
--- a/hw/pl110.c
+++ b/hw/pl110.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GNU LGPL
+ * This code is licensed under the GNU LGPL
*/
#include "sysbus.h"
diff --git a/hw/pl110_template.h b/hw/pl110_template.h
index b3c9077dc..d30333678 100644
--- a/hw/pl110_template.h
+++ b/hw/pl110_template.h
@@ -4,7 +4,7 @@
* Copyright (c) 2005 CodeSourcery, LLC.
* Written by Paul Brook
*
- * This code is licenced under the GNU LGPL
+ * This code is licensed under the GNU LGPL
*
* Framebuffer format conversion routines.
*/
diff --git a/hw/pl181.c b/hw/pl181.c
index 6bc79f5f7..0943c09ec 100644
--- a/hw/pl181.c
+++ b/hw/pl181.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "blockdev.h"
diff --git a/hw/pl190.c b/hw/pl190.c
index 75f2ba196..8dc7e4286 100644
--- a/hw/pl190.c
+++ b/hw/pl190.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/ptimer.c b/hw/ptimer.c
index 47964a67e..6f13ce92f 100644
--- a/hw/ptimer.c
+++ b/hw/ptimer.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GNU LGPL.
+ * This code is licensed under the GNU LGPL.
*/
#include "hw.h"
#include "qemu-timer.h"
diff --git a/hw/pxa.h b/hw/pxa.h
index d982f00c5..859fc676e 100644
--- a/hw/pxa.h
+++ b/hw/pxa.h
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Openedhand Ltd.
* Written by Andrzej Zaborowski <balrog@zabor.org>
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#ifndef PXA_H
# define PXA_H "pxa.h"
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index ac5d95d71..cf9311014 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Openedhand Ltd.
* Written by Andrzej Zaborowski <balrog@zabor.org>
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/pxa2xx_dma.c b/hw/pxa2xx_dma.c
index a67498b2b..599581e26 100644
--- a/hw/pxa2xx_dma.c
+++ b/hw/pxa2xx_dma.c
@@ -5,7 +5,7 @@
* Copyright (c) 2006 Thorsten Zitterell
* Written by Andrzej Zaborowski <balrog@zabor.org>
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/pxa2xx_pic.c b/hw/pxa2xx_pic.c
index e9a536102..bdd82e6bf 100644
--- a/hw/pxa2xx_pic.c
+++ b/hw/pxa2xx_pic.c
@@ -5,7 +5,7 @@
* Copyright (c) 2006 Thorsten Zitterell
* Written by Andrzej Zaborowski <balrog@zabor.org>
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/pxa2xx_timer.c b/hw/pxa2xx_timer.c
index f777a2122..4235e4263 100644
--- a/hw/pxa2xx_timer.c
+++ b/hw/pxa2xx_timer.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Openedhand Ltd.
* Copyright (c) 2006 Thorsten Zitterell
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/realview.c b/hw/realview.c
index 82f3d82d4..94ab90051 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/realview_gic.c b/hw/realview_gic.c
index db908b643..43a2a0d5e 100644
--- a/hw/realview_gic.c
+++ b/hw/realview_gic.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 05d14ab2f..f42a5d1f8 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -12,7 +12,7 @@
* 2009-Oct-13 Artyom Tarasenko : implemented the block descriptor in the
* MODE SENSE response.
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*
* Note that this file only handles the SCSI architecture model and device
* commands. Emulation of interface/link layer protocols is handled by
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 90345a714..63361b354 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -7,7 +7,7 @@
*
* Written by Laurent Vivier <Laurent.Vivier@bull.net>
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*
*/
diff --git a/hw/sh_intc.c b/hw/sh_intc.c
index 0734da90f..c43b99f81 100644
--- a/hw/sh_intc.c
+++ b/hw/sh_intc.c
@@ -5,7 +5,7 @@
* Based on sh_timer.c and arm_timer.c by Paul Brook
* Copyright (c) 2005-2006 CodeSourcery.
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sh_intc.h"
diff --git a/hw/sh_timer.c b/hw/sh_timer.c
index 5eec6b7c1..5df7fb64b 100644
--- a/hw/sh_timer.c
+++ b/hw/sh_timer.c
@@ -5,7 +5,7 @@
* Based on arm_timer.c by Paul Brook
* Copyright (c) 2005-2006 CodeSourcery.
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
diff --git a/hw/smbus.c b/hw/smbus.c
index e46453915..ff027c814 100644
--- a/hw/smbus.c
+++ b/hw/smbus.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
/* TODO: Implement PEC. */
diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index 701baafe6..3a8a85c1f 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005 CodeSourcery, LLC.
* Written by Paul Brook
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
#include "sysbus.h"
diff --git a/hw/ssd0303.c b/hw/ssd0303.c
index b39e2596f..401fdf592 100644
--- a/hw/ssd0303.c
+++ b/hw/ssd0303.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
/* The controller can support a variety of different displays, but we only
diff --git a/hw/ssd0323.c b/hw/ssd0323.c
index 864396114..1eb3823fe 100644
--- a/hw/ssd0323.c
+++ b/hw/ssd0323.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
/* The controller can support a variety of different displays, but we only
diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c
index fb4b64927..18dabd64a 100644
--- a/hw/ssi-sd.c
+++ b/hw/ssi-sd.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007-2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "blockdev.h"
diff --git a/hw/ssi.c b/hw/ssi.c
index cfe7c072f..3f4c5f9f0 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -4,7 +4,7 @@
* Copyright (c) 2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include "ssi.h"
diff --git a/hw/stellaris.c b/hw/stellaris.c
index b8a7cebd8..a28093043 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/stellaris_enet.c b/hw/stellaris_enet.c
index 6a0583a25..12919317e 100644
--- a/hw/stellaris_enet.c
+++ b/hw/stellaris_enet.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
#include "net.h"
diff --git a/hw/stellaris_input.c b/hw/stellaris_input.c
index 06c5f9d95..95604ecde 100644
--- a/hw/stellaris_input.c
+++ b/hw/stellaris_input.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "hw.h"
#include "devices.h"
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index d3922998c..4dda2c483 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -1104,20 +1104,9 @@ static Answer *ccid_peek_next_answer(USBCCIDState *s)
: &s->pending_answers[s->pending_answers_start % PENDING_ANSWERS_NUM];
}
-static void ccid_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
-{
- CCIDCardState *card = DO_UPCAST(CCIDCardState, qdev, qdev);
- CCIDCardInfo *info = DO_UPCAST(CCIDCardInfo, qdev, qdev->info);
-
- if (info->print) {
- info->print(mon, card, indent);
- }
-}
-
static struct BusInfo ccid_bus_info = {
.name = "ccid-bus",
.size = sizeof(CCIDBus),
- .print_dev = ccid_bus_dev_print,
.props = (Property[]) {
DEFINE_PROP_UINT32("slot", struct CCIDCardState, slot, 0),
DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index bfea09689..6391dad10 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
#include "qemu-common.h"
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 59cb0fb2f..c69c4374e 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -5,7 +5,7 @@
* Copyright (c) 2008 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Written by Paul Brook, reused for FTDI by Samuel Thibault
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
#include "qemu-common.h"
diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 8e75ffccf..290a9009b 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -4,7 +4,7 @@
* Copyright (c) 2006-2009 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
*/
#include "sysbus.h"
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 46b6a3f38..147fe29b6 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#include "sysbus.h"
diff --git a/hw/vga_int.h b/hw/vga_int.h
index ab9074672..957ad0cf2 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -106,13 +106,13 @@ typedef void (* vga_update_retrace_info_fn)(struct VGACommonState *s);
typedef struct VGACommonState {
uint8_t *vram_ptr;
ram_addr_t vram_offset;
+ target_phys_addr_t lfb_addr;
+ target_phys_addr_t lfb_end;
+ target_phys_addr_t map_addr;
+ target_phys_addr_t map_end;
uint32_t vram_size;
- uint32_t lfb_addr;
- uint32_t lfb_end;
- uint32_t map_addr;
- uint32_t map_end;
- uint32_t lfb_vram_mapped; /* whether 0xa0000 is mapped as ram */
uint32_t latch;
+ uint32_t lfb_vram_mapped; /* whether 0xa0000 is mapped as ram */
uint8_t sr_index;
uint8_t sr[256];
uint8_t gr_index;
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 7ebfa2651..fe5e188bf 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -139,9 +139,7 @@ static VirtIOSerialPortInfo virtconsole_info = {
.init = virtconsole_initfn,
.exit = virtconsole_exitfn,
.qdev.props = (Property[]) {
- DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
- DEFINE_PROP_STRING("name", VirtConsole, port.name),
DEFINE_PROP_END_OF_LIST(),
},
};
@@ -158,9 +156,7 @@ static VirtIOSerialPortInfo virtserialport_info = {
.init = virtconsole_initfn,
.exit = virtconsole_exitfn,
.qdev.props = (Property[]) {
- DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
- DEFINE_PROP_STRING("name", VirtConsole, port.name),
DEFINE_PROP_END_OF_LIST(),
},
};
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index bdc760c36..c5eb93109 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -668,20 +668,22 @@ static struct BusInfo virtser_bus_info = {
.name = "virtio-serial-bus",
.size = sizeof(VirtIOSerialBus),
.print_dev = virtser_bus_dev_print,
+ .props = (Property[]) {
+ DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID),
+ DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
+ DEFINE_PROP_END_OF_LIST()
+ }
};
static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
{
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
- monitor_printf(mon, "%*s dev-prop-int: id: %u\n",
- indent, "", port->id);
- monitor_printf(mon, "%*s dev-prop-int: guest_connected: %d\n",
- indent, "", port->guest_connected);
- monitor_printf(mon, "%*s dev-prop-int: host_connected: %d\n",
- indent, "", port->host_connected);
- monitor_printf(mon, "%*s dev-prop-int: throttled: %d\n",
- indent, "", port->throttled);
+ monitor_printf(mon, "%*sport %d, guest %s, host %s, throttle %s\n",
+ indent, "", port->id,
+ port->guest_connected ? "on" : "off",
+ port->host_connected ? "on" : "off",
+ port->throttled ? "on" : "off");
}
/* This function is only used if a port id is not provided by the user */
diff --git a/input.c b/input.c
index f0a02e783..310bad58f 100644
--- a/input.c
+++ b/input.c
@@ -59,7 +59,7 @@ static void check_mode_change(void)
if (is_absolute != current_is_absolute ||
has_absolute != current_has_absolute) {
- notifier_list_notify(&mouse_mode_notifiers);
+ notifier_list_notify(&mouse_mode_notifiers, NULL);
}
current_is_absolute = is_absolute;
diff --git a/migration.c b/migration.c
index af3a1f270..2a15b98db 100644
--- a/migration.c
+++ b/migration.c
@@ -124,7 +124,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
current_migration = s;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
return 0;
}
@@ -276,7 +276,7 @@ void migrate_fd_error(FdMigrationState *s)
{
DPRINTF("setting error state\n");
s->state = MIG_STATE_ERROR;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
migrate_fd_cleanup(s);
}
@@ -334,7 +334,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
monitor_resume(s->mon);
}
s->state = MIG_STATE_ERROR;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
}
return ret;
@@ -395,7 +395,7 @@ void migrate_fd_put_ready(void *opaque)
state = MIG_STATE_ERROR;
}
s->state = state;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
}
}
@@ -415,7 +415,7 @@ void migrate_fd_cancel(MigrationState *mig_state)
DPRINTF("cancelling migration\n");
s->state = MIG_STATE_CANCELLED;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
qemu_savevm_state_cancel(s->mon, s->file);
migrate_fd_cleanup(s);
@@ -429,7 +429,7 @@ void migrate_fd_release(MigrationState *mig_state)
if (s->state == MIG_STATE_ACTIVE) {
s->state = MIG_STATE_CANCELLED;
- notifier_list_notify(&migration_state_notifiers);
+ notifier_list_notify(&migration_state_notifiers, NULL);
migrate_fd_cleanup(s);
}
qemu_free(s);
diff --git a/monitor.c b/monitor.c
index a6388a95f..a1686768f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1206,6 +1206,38 @@ static int expire_password(Monitor *mon, const QDict *qdict, QObject **ret_data)
return -1;
}
+static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ const char *protocol = qdict_get_str(qdict, "protocol");
+ const char *fdname = qdict_get_str(qdict, "fdname");
+ int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);
+ CharDriverState *s;
+
+ if (strcmp(protocol, "spice") == 0) {
+ if (!using_spice) {
+ /* correct one? spice isn't a device ,,, */
+ qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
+ return -1;
+ }
+ qerror_report(QERR_ADD_CLIENT_FAILED);
+ return -1;
+ } else if (strcmp(protocol, "vnc") == 0) {
+ int fd = monitor_get_fd(mon, fdname);
+ vnc_display_add_client(NULL, fd, skipauth);
+ return 0;
+ } else if ((s = qemu_chr_find(protocol)) != NULL) {
+ int fd = monitor_get_fd(mon, fdname);
+ if (qemu_chr_add_client(s, fd) < 0) {
+ qerror_report(QERR_ADD_CLIENT_FAILED);
+ return -1;
+ }
+ return 0;
+ }
+
+ qerror_report(QERR_INVALID_PARAMETER, "protocol");
+ return -1;
+}
+
static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
const char *protocol = qdict_get_str(qdict, "protocol");
diff --git a/notify.c b/notify.c
index bcd3fc532..a6bac1f78 100644
--- a/notify.c
+++ b/notify.c
@@ -29,11 +29,11 @@ void notifier_list_remove(NotifierList *list, Notifier *notifier)
QTAILQ_REMOVE(&list->notifiers, notifier, node);
}
-void notifier_list_notify(NotifierList *list)
+void notifier_list_notify(NotifierList *list, void *data)
{
Notifier *notifier, *next;
QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
- notifier->notify(notifier);
+ notifier->notify(notifier, data);
}
}
diff --git a/notify.h b/notify.h
index b40522f58..54fc57cec 100644
--- a/notify.h
+++ b/notify.h
@@ -20,7 +20,7 @@ typedef struct Notifier Notifier;
struct Notifier
{
- void (*notify)(Notifier *notifier);
+ void (*notify)(Notifier *notifier, void *data);
QTAILQ_ENTRY(Notifier) node;
};
@@ -38,6 +38,6 @@ void notifier_list_add(NotifierList *list, Notifier *notifier);
void notifier_list_remove(NotifierList *list, Notifier *notifier);
-void notifier_list_notify(NotifierList *list);
+void notifier_list_notify(NotifierList *list, void *data);
#endif
diff --git a/qemu-char.c b/qemu-char.c
index fb13b2845..dcf706592 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -168,6 +168,11 @@ int qemu_chr_get_msgfd(CharDriverState *s)
return s->get_msgfd ? s->get_msgfd(s) : -1;
}
+int qemu_chr_add_client(CharDriverState *s, int fd)
+{
+ return s->chr_add_client ? s->chr_add_client(s, fd) : -1;
+}
+
void qemu_chr_accept_input(CharDriverState *s)
{
if (s->chr_accept_input)
@@ -219,13 +224,15 @@ static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
return len;
}
-static CharDriverState *qemu_chr_open_null(QemuOpts *opts)
+static int qemu_chr_open_null(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
chr = qemu_mallocz(sizeof(CharDriverState));
chr->chr_write = null_chr_write;
- return chr;
+
+ *_chr= chr;
+ return 0;
}
/* MUX driver for serial I/O splitting */
@@ -634,18 +641,21 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out)
return chr;
}
-static CharDriverState *qemu_chr_open_file_out(QemuOpts *opts)
+static int qemu_chr_open_file_out(QemuOpts *opts, CharDriverState **_chr)
{
int fd_out;
TFR(fd_out = qemu_open(qemu_opt_get(opts, "path"),
O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666));
- if (fd_out < 0)
- return NULL;
- return qemu_chr_open_fd(-1, fd_out);
+ if (fd_out < 0) {
+ return -errno;
+ }
+
+ *_chr = qemu_chr_open_fd(-1, fd_out);
+ return 0;
}
-static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts)
+static int qemu_chr_open_pipe(QemuOpts *opts, CharDriverState **_chr)
{
int fd_in, fd_out;
char filename_in[256], filename_out[256];
@@ -653,7 +663,7 @@ static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts)
if (filename == NULL) {
fprintf(stderr, "chardev: pipe: no filename given\n");
- return NULL;
+ return -EINVAL;
}
snprintf(filename_in, 256, "%s.in", filename);
@@ -665,11 +675,14 @@ static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts)
close(fd_in);
if (fd_out >= 0)
close(fd_out);
- TFR(fd_in = fd_out = open(filename, O_RDWR | O_BINARY));
- if (fd_in < 0)
- return NULL;
+ TFR(fd_in = fd_out = qemu_open(filename, O_RDWR | O_BINARY));
+ if (fd_in < 0) {
+ return -errno;
+ }
}
- return qemu_chr_open_fd(fd_in, fd_out);
+
+ *_chr = qemu_chr_open_fd(fd_in, fd_out);
+ return 0;
}
@@ -760,12 +773,14 @@ static void qemu_chr_close_stdio(struct CharDriverState *chr)
fd_chr_close(chr);
}
-static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
+static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
- if (stdio_nb_clients >= STDIO_MAX_CLIENTS)
- return NULL;
+ if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {
+ return -EBUSY;
+ }
+
if (stdio_nb_clients == 0) {
old_fd0_flags = fcntl(0, F_GETFL);
tcgetattr (0, &oldtty);
@@ -782,7 +797,8 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
display_type != DT_NOGRAPHIC);
qemu_chr_set_echo(chr, false);
- return chr;
+ *_chr = chr;
+ return 0;
}
#ifdef __sun__
@@ -969,7 +985,7 @@ static void pty_chr_close(struct CharDriverState *chr)
qemu_chr_event(chr, CHR_EVENT_CLOSED);
}
-static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
+static int qemu_chr_open_pty(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
PtyCharDriver *s;
@@ -987,7 +1003,7 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
s = qemu_mallocz(sizeof(PtyCharDriver));
if (openpty(&s->fd, &slave_fd, pty_name, NULL, NULL) < 0) {
- return NULL;
+ return -errno;
}
/* Set raw attributes on the pty. */
@@ -1009,7 +1025,8 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
s->timer = qemu_new_timer_ms(rt_clock, pty_chr_timer, chr);
- return chr;
+ *_chr = chr;
+ return 0;
}
static void tty_serial_init(int fd, int speed,
@@ -1210,30 +1227,28 @@ static void qemu_chr_close_tty(CharDriverState *chr)
}
}
-static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
+static int qemu_chr_open_tty(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
int fd;
- TFR(fd = open(filename, O_RDWR | O_NONBLOCK));
+ TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK));
if (fd < 0) {
- return NULL;
+ return -errno;
}
tty_serial_init(fd, 115200, 'N', 8, 1);
chr = qemu_chr_open_fd(fd, fd);
- if (!chr) {
- close(fd);
- return NULL;
- }
chr->chr_ioctl = tty_serial_ioctl;
chr->chr_close = qemu_chr_close_tty;
- return chr;
+
+ *_chr = chr;
+ return 0;
}
#else /* ! __linux__ && ! __sun__ */
-static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
+static int qemu_chr_open_pty(QemuOpts *opts, CharDriverState **_chr)
{
- return NULL;
+ return -ENOTSUP;
}
#endif /* __linux__ || __sun__ */
@@ -1347,7 +1362,7 @@ static void pp_close(CharDriverState *chr)
qemu_chr_event(chr, CHR_EVENT_CLOSED);
}
-static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
+static int qemu_chr_open_pp(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
@@ -1355,12 +1370,13 @@ static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
int fd;
TFR(fd = open(filename, O_RDWR));
- if (fd < 0)
- return NULL;
+ if (fd < 0) {
+ return -errno;
+ }
if (ioctl(fd, PPCLAIM) < 0) {
close(fd);
- return NULL;
+ return -errno;
}
drv = qemu_mallocz(sizeof(ParallelCharDriver));
@@ -1375,7 +1391,8 @@ static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
qemu_chr_generic_open(chr);
- return chr;
+ *_chr = chr;
+ return 0;
}
#endif /* __linux__ */
@@ -1417,21 +1434,24 @@ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
return 0;
}
-static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
+static int qemu_chr_open_pp(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
int fd;
- fd = open(filename, O_RDWR);
- if (fd < 0)
- return NULL;
+ fd = qemu_open(filename, O_RDWR);
+ if (fd < 0) {
+ return -errno;
+ }
chr = qemu_mallocz(sizeof(CharDriverState));
chr->opaque = (void *)(intptr_t)fd;
chr->chr_write = null_chr_write;
chr->chr_ioctl = pp_ioctl;
- return chr;
+
+ *_chr = chr;
+ return 0;
}
#endif
@@ -1637,7 +1657,7 @@ static int win_chr_poll(void *opaque)
return 0;
}
-static CharDriverState *qemu_chr_open_win(QemuOpts *opts)
+static int qemu_chr_open_win(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
@@ -1652,10 +1672,12 @@ static CharDriverState *qemu_chr_open_win(QemuOpts *opts)
if (win_chr_init(chr, filename) < 0) {
free(s);
free(chr);
- return NULL;
+ return -EIO;
}
qemu_chr_generic_open(chr);
- return chr;
+
+ *_chr = chr;
+ return 0;
}
static int win_chr_pipe_poll(void *opaque)
@@ -1737,7 +1759,7 @@ static int win_chr_pipe_init(CharDriverState *chr, const char *filename)
}
-static CharDriverState *qemu_chr_open_win_pipe(QemuOpts *opts)
+static int qemu_chr_open_win_pipe(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
@@ -1752,10 +1774,12 @@ static CharDriverState *qemu_chr_open_win_pipe(QemuOpts *opts)
if (win_chr_pipe_init(chr, filename) < 0) {
free(s);
free(chr);
- return NULL;
+ return -EIO;
}
qemu_chr_generic_open(chr);
- return chr;
+
+ *_chr = chr;
+ return 0;
}
static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
@@ -1772,22 +1796,23 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
return chr;
}
-static CharDriverState *qemu_chr_open_win_con(QemuOpts *opts)
+static int qemu_chr_open_win_con(QemuOpts *opts, CharDriverState **_chr)
{
- return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));
+ return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE), chr);
}
-static CharDriverState *qemu_chr_open_win_file_out(QemuOpts *opts)
+static int qemu_chr_open_win_file_out(QemuOpts *opts, CharDriverState **_chr)
{
const char *file_out = qemu_opt_get(opts, "path");
HANDLE fd_out;
fd_out = CreateFile(file_out, GENERIC_WRITE, FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fd_out == INVALID_HANDLE_VALUE)
- return NULL;
+ if (fd_out == INVALID_HANDLE_VALUE) {
+ return -EIO;
+ }
- return qemu_chr_open_win_file(fd_out);
+ return qemu_chr_open_win_file(fd_out, _chr);
}
#endif /* !_WIN32 */
@@ -1868,11 +1893,12 @@ static void udp_chr_close(CharDriverState *chr)
qemu_chr_event(chr, CHR_EVENT_CLOSED);
}
-static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
+static int qemu_chr_open_udp(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr = NULL;
NetCharDriver *s = NULL;
int fd = -1;
+ int ret;
chr = qemu_mallocz(sizeof(CharDriverState));
s = qemu_mallocz(sizeof(NetCharDriver));
@@ -1880,6 +1906,7 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
fd = inet_dgram_opts(opts);
if (fd < 0) {
fprintf(stderr, "inet_dgram_opts failed\n");
+ ret = -errno;
goto return_err;
}
@@ -1890,16 +1917,17 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
chr->chr_write = udp_chr_write;
chr->chr_update_read_handler = udp_chr_update_read_handler;
chr->chr_close = udp_chr_close;
- return chr;
+
+ *_chr = chr;
+ return 0;
return_err:
- if (chr)
- free(chr);
- if (s)
- free(s);
- if (fd >= 0)
+ qemu_free(chr);
+ qemu_free(s);
+ if (fd >= 0) {
closesocket(fd);
- return NULL;
+ }
+ return ret;
}
/***********************************************************/
@@ -2123,6 +2151,22 @@ static void socket_set_nodelay(int fd)
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
}
+static int tcp_chr_add_client(CharDriverState *chr, int fd)
+{
+ TCPCharDriver *s = chr->opaque;
+ if (s->fd != -1)
+ return -1;
+
+ socket_set_nonblock(fd);
+ if (s->do_nodelay)
+ socket_set_nodelay(fd);
+ s->fd = fd;
+ qemu_set_fd_handler(s->listen_fd, NULL, NULL, NULL);
+ tcp_chr_connect(chr);
+
+ return 0;
+}
+
static void tcp_chr_accept(void *opaque)
{
CharDriverState *chr = opaque;
@@ -2155,12 +2199,8 @@ static void tcp_chr_accept(void *opaque)
break;
}
}
- socket_set_nonblock(fd);
- if (s->do_nodelay)
- socket_set_nodelay(fd);
- s->fd = fd;
- qemu_set_fd_handler(s->listen_fd, NULL, NULL, NULL);
- tcp_chr_connect(chr);
+ if (tcp_chr_add_client(chr, fd) < 0)
+ close(fd);
}
static void tcp_chr_close(CharDriverState *chr)
@@ -2178,7 +2218,7 @@ static void tcp_chr_close(CharDriverState *chr)
qemu_chr_event(chr, CHR_EVENT_CLOSED);
}
-static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
+static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr = NULL;
TCPCharDriver *s = NULL;
@@ -2188,6 +2228,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
int do_nodelay;
int is_unix;
int is_telnet;
+ int ret;
is_listen = qemu_opt_get_bool(opts, "server", 0);
is_waitconnect = qemu_opt_get_bool(opts, "wait", 1);
@@ -2213,8 +2254,10 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
fd = inet_connect_opts(opts);
}
}
- if (fd < 0)
+ if (fd < 0) {
+ ret = -errno;
goto fail;
+ }
if (!is_waitconnect)
socket_set_nonblock(fd);
@@ -2230,6 +2273,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
chr->chr_write = tcp_chr_write;
chr->chr_close = tcp_chr_close;
chr->get_msgfd = tcp_get_msgfd;
+ chr->chr_add_client = tcp_chr_add_client;
if (is_listen) {
s->listen_fd = fd;
@@ -2266,14 +2310,16 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
tcp_chr_accept(chr);
socket_set_nonblock(s->listen_fd);
}
- return chr;
+
+ *_chr = chr;
+ return 0;
fail:
if (fd >= 0)
closesocket(fd);
qemu_free(s);
qemu_free(chr);
- return NULL;
+ return ret;
}
/***********************************************************/
@@ -2466,7 +2512,7 @@ fail:
static const struct {
const char *name;
- CharDriverState *(*open)(QemuOpts *opts);
+ int (*open)(QemuOpts *opts, CharDriverState **chr);
} backend_table[] = {
{ .name = "null", .open = qemu_chr_open_null },
{ .name = "socket", .open = qemu_chr_open_socket },
@@ -2506,6 +2552,7 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
{
CharDriverState *chr;
int i;
+ int ret;
if (qemu_opts_id(opts) == NULL) {
fprintf(stderr, "chardev: no id specified\n");
@@ -2527,10 +2574,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
return NULL;
}
- chr = backend_table[i].open(opts);
- if (!chr) {
- fprintf(stderr, "chardev: opening backend \"%s\" failed\n",
- qemu_opt_get(opts, "backend"));
+ ret = backend_table[i].open(opts, &chr);
+ if (ret < 0) {
+ fprintf(stderr, "chardev: opening backend \"%s\" failed: %s\n",
+ qemu_opt_get(opts, "backend"), strerror(-ret));
return NULL;
}
diff --git a/qemu-char.h b/qemu-char.h
index 892c6da9a..f361c6d28 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -57,6 +57,7 @@ struct CharDriverState {
void (*chr_update_read_handler)(struct CharDriverState *s);
int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg);
int (*get_msgfd)(struct CharDriverState *s);
+ int (*chr_add_client)(struct CharDriverState *chr, int fd);
IOEventHandler *chr_event;
IOCanReadHandler *chr_can_read;
IOReadHandler *chr_read;
@@ -99,6 +100,7 @@ int qemu_chr_can_read(CharDriverState *s);
void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len);
int qemu_chr_get_msgfd(CharDriverState *s);
void qemu_chr_accept_input(CharDriverState *s);
+int qemu_chr_add_client(CharDriverState *s, int fd);
void qemu_chr_info_print(Monitor *mon, const QObject *ret_data);
void qemu_chr_info(Monitor *mon, QObject **ret_data);
CharDriverState *qemu_chr_find(const char *name);
diff --git a/qemu-timer.c b/qemu-timer.c
index 72066c7c5..30e8f1272 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -150,6 +150,9 @@ struct QEMUClock {
int enabled;
QEMUTimer *warp_timer;
+
+ NotifierList reset_notifiers;
+ int64_t last;
};
struct QEMUTimer {
@@ -218,6 +221,7 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t);
static int unix_start_timer(struct qemu_alarm_timer *t);
static void unix_stop_timer(struct qemu_alarm_timer *t);
+static void unix_rearm_timer(struct qemu_alarm_timer *t);
#ifdef __linux__
@@ -290,7 +294,7 @@ static struct qemu_alarm_timer alarm_timers[] = {
{"dynticks", dynticks_start_timer,
dynticks_stop_timer, dynticks_rearm_timer},
#endif
- {"unix", unix_start_timer, unix_stop_timer, NULL},
+ {"unix", unix_start_timer, unix_stop_timer, unix_rearm_timer},
#else
{"mmtimer", mm_start_timer, mm_stop_timer, NULL},
{"mmtimer2", mm_start_timer, mm_stop_timer, mm_rearm_timer},
@@ -375,9 +379,15 @@ static QEMUTimer *active_timers[QEMU_NUM_CLOCKS];
static QEMUClock *qemu_new_clock(int type)
{
QEMUClock *clock;
+
clock = qemu_mallocz(sizeof(QEMUClock));
clock->type = type;
clock->enabled = 1;
+ notifier_list_init(&clock->reset_notifiers);
+ /* required to detect & report backward jumps */
+ if (type == QEMU_CLOCK_HOST) {
+ clock->last = get_clock_realtime();
+ }
return clock;
}
@@ -592,6 +602,8 @@ static void qemu_run_timers(QEMUClock *clock)
int64_t qemu_get_clock_ns(QEMUClock *clock)
{
+ int64_t now, last;
+
switch(clock->type) {
case QEMU_CLOCK_REALTIME:
return get_clock();
@@ -603,10 +615,26 @@ int64_t qemu_get_clock_ns(QEMUClock *clock)
return cpu_get_clock();
}
case QEMU_CLOCK_HOST:
- return get_clock_realtime();
+ now = get_clock_realtime();
+ last = clock->last;
+ clock->last = now;
+ if (now < last) {
+ notifier_list_notify(&clock->reset_notifiers, &now);
+ }
+ return now;
}
}
+void qemu_register_clock_reset_notifier(QEMUClock *clock, Notifier *notifier)
+{
+ notifier_list_add(&clock->reset_notifiers, notifier);
+}
+
+void qemu_unregister_clock_reset_notifier(QEMUClock *clock, Notifier *notifier)
+{
+ notifier_list_remove(&clock->reset_notifiers, notifier);
+}
+
void init_clocks(void)
{
rt_clock = qemu_new_clock(QEMU_CLOCK_REALTIME);
@@ -803,6 +831,8 @@ static int64_t qemu_next_alarm_deadline(void)
#if defined(__linux__)
+#include "compatfd.h"
+
static int dynticks_start_timer(struct qemu_alarm_timer *t)
{
struct sigevent ev;
@@ -822,6 +852,12 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t)
memset(&ev, 0, sizeof(ev));
ev.sigev_value.sival_int = 0;
ev.sigev_notify = SIGEV_SIGNAL;
+#ifdef SIGEV_THREAD_ID
+ if (qemu_signalfd_available()) {
+ ev.sigev_notify = SIGEV_THREAD_ID;
+ ev._sigev_un._tid = qemu_get_thread_id();
+ }
+#endif /* SIGEV_THREAD_ID */
ev.sigev_signo = SIGALRM;
if (timer_create(CLOCK_REALTIME, &ev, &host_timer)) {
@@ -890,8 +926,6 @@ static void dynticks_rearm_timer(struct qemu_alarm_timer *t)
static int unix_start_timer(struct qemu_alarm_timer *t)
{
struct sigaction act;
- struct itimerval itv;
- int err;
/* timer signal */
sigfillset(&act.sa_mask);
@@ -899,18 +933,35 @@ static int unix_start_timer(struct qemu_alarm_timer *t)
act.sa_handler = host_alarm_handler;
sigaction(SIGALRM, &act, NULL);
+ return 0;
+}
- itv.it_interval.tv_sec = 0;
- /* for i386 kernel 2.6 to get 1 ms */
- itv.it_interval.tv_usec = 999;
- itv.it_value.tv_sec = 0;
- itv.it_value.tv_usec = 10 * 1000;
+static void unix_rearm_timer(struct qemu_alarm_timer *t)
+{
+ struct itimerval itv;
+ int64_t nearest_delta_ns = INT64_MAX;
+ int err;
- err = setitimer(ITIMER_REAL, &itv, NULL);
- if (err)
- return -1;
+ assert(alarm_has_dynticks(t));
+ if (!active_timers[QEMU_CLOCK_REALTIME] &&
+ !active_timers[QEMU_CLOCK_VIRTUAL] &&
+ !active_timers[QEMU_CLOCK_HOST])
+ return;
- return 0;
+ nearest_delta_ns = qemu_next_alarm_deadline();
+ if (nearest_delta_ns < MIN_TIMER_REARM_NS)
+ nearest_delta_ns = MIN_TIMER_REARM_NS;
+
+ itv.it_interval.tv_sec = 0;
+ itv.it_interval.tv_usec = 0; /* 0 for one-shot timer */
+ itv.it_value.tv_sec = nearest_delta_ns / 1000000000;
+ itv.it_value.tv_usec = (nearest_delta_ns % 1000000000) / 1000;
+ err = setitimer(ITIMER_REAL, &itv, NULL);
+ if (err) {
+ perror("setitimer");
+ fprintf(stderr, "Internal timer error: aborting\n");
+ exit(1);
+ }
}
static void unix_stop_timer(struct qemu_alarm_timer *t)
diff --git a/qemu-timer.h b/qemu-timer.h
index 06cbe2091..0a4346984 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -2,6 +2,7 @@
#define QEMU_TIMER_H
#include "qemu-common.h"
+#include "notify.h"
#include <time.h>
#include <sys/time.h>
@@ -40,6 +41,10 @@ int64_t qemu_get_clock_ns(QEMUClock *clock);
void qemu_clock_enable(QEMUClock *clock, int enabled);
void qemu_clock_warp(QEMUClock *clock);
+void qemu_register_clock_reset_notifier(QEMUClock *clock, Notifier *notifier);
+void qemu_unregister_clock_reset_notifier(QEMUClock *clock,
+ Notifier *notifier);
+
QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale,
QEMUTimerCB *cb, void *opaque);
void qemu_free_timer(QEMUTimer *ts);
diff --git a/qerror.c b/qerror.c
index 229d0d63e..69c1bc9af 100644
--- a/qerror.c
+++ b/qerror.c
@@ -198,6 +198,10 @@ static const QErrorStringTable qerror_table[] = {
.desc = "Could not set password",
},
{
+ .error_fmt = QERR_ADD_CLIENT_FAILED,
+ .desc = "Could not add client",
+ },
+ {
.error_fmt = QERR_TOO_MANY_FILES,
.desc = "Too many open files",
},
diff --git a/qerror.h b/qerror.h
index 7ec0fc12d..8058456d2 100644
--- a/qerror.h
+++ b/qerror.h
@@ -166,6 +166,9 @@ QError *qobject_to_qerror(const QObject *obj);
#define QERR_SET_PASSWD_FAILED \
"{ 'class': 'SetPasswdFailed', 'data': {} }"
+#define QERR_ADD_CLIENT_FAILED \
+ "{ 'class': 'AddClientFailed', 'data': {} }"
+
#define QERR_TOO_MANY_FILES \
"{ 'class': 'TooManyFiles', 'data': {} }"
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 5d44edf4e..54e313ce5 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -919,6 +919,33 @@ Example:
EQMP
{
+ .name = "add_client",
+ .args_type = "protocol:s,fdname:s,skipauth:b?",
+ .params = "protocol fdname skipauth",
+ .help = "add a graphics client",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = add_graphics_client,
+ },
+
+SQMP
+add_client
+----------
+
+Add a graphics client
+
+Arguments:
+
+- "protocol": protocol name (json-string)
+- "fdname": file descriptor name (json-string)
+
+Example:
+
+-> { "execute": "add_client", "arguments": { "protocol": "vnc",
+ "fdname": "myclient" } }
+<- { "return": {} }
+
+EQMP
+ {
.name = "qmp_capabilities",
.args_type = "",
.params = "",
diff --git a/softmmu-semi.h b/softmmu-semi.h
index 79278cc76..86a9f8a84 100644
--- a/softmmu-semi.h
+++ b/softmmu-semi.h
@@ -4,7 +4,7 @@
*
* Copyright (c) 2007 CodeSourcery.
*
- * This code is licenced under the GPL
+ * This code is licensed under the GPL
*/
static inline uint32_t softmmu_tget32(CPUState *env, uint32_t addr)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 605c24123..95bf6b65d 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -159,7 +159,7 @@ static void print_allowed_subtypes(void)
fprintf(stderr, "\n");
}
-CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
+int qemu_chr_open_spice(QemuOpts *opts, CharDriverState **_chr)
{
CharDriverState *chr;
SpiceCharDriver *s;
@@ -171,7 +171,7 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
if (name == NULL) {
fprintf(stderr, "spice-qemu-char: missing name parameter\n");
print_allowed_subtypes();
- return NULL;
+ return -EINVAL;
}
for(;*psubtype != NULL; ++psubtype) {
if (strcmp(name, *psubtype) == 0) {
@@ -182,7 +182,7 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
if (subtype == NULL) {
fprintf(stderr, "spice-qemu-char: unsupported name\n");
print_allowed_subtypes();
- return NULL;
+ return -EINVAL;
}
chr = qemu_mallocz(sizeof(CharDriverState));
@@ -199,5 +199,6 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
qemu_chr_generic_open(chr);
- return chr;
+ *_chr = chr;
+ return 0;
}
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 28306279a..b51e35a30 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -4,7 +4,7 @@
* Copyright (c) 2007, 2008 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GNU GPL v2.
+ * This code is licensed under the GNU GPL v2.
*/
#include <stdlib.h>
#include <stdio.h>
diff --git a/target-arm/op_addsub.h b/target-arm/op_addsub.h
index c02c92adf..ca4a1893c 100644
--- a/target-arm/op_addsub.h
+++ b/target-arm/op_addsub.h
@@ -4,7 +4,7 @@
* Copyright (c) 2007 CodeSourcery.
* Written by Paul Brook
*
- * This code is licenced under the GPL.
+ * This code is licensed under the GPL.
*/
#ifdef ARITH_GE
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index 3c6f1fe41..f34be69f5 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -42,7 +42,7 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
void do_info_spice_print(Monitor *mon, const QObject *data);
void do_info_spice(Monitor *mon, QObject **ret_data);
-CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
+int qemu_chr_open_spice(QemuOpts *opts, CharDriverState **_chr);
#else /* CONFIG_SPICE */
diff --git a/ui/sdl.c b/ui/sdl.c
index f2bd4a035..6dbc5cb0e 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -481,7 +481,7 @@ static void sdl_grab_end(void)
sdl_update_caption();
}
-static void sdl_mouse_mode_change(Notifier *notify)
+static void sdl_mouse_mode_change(Notifier *notify, void *data)
{
if (kbd_mouse_is_absolute()) {
if (!absolute_enabled) {
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 110041769..3d77c0144 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -416,7 +416,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data)
*ret_data = QOBJECT(server);
}
-static void migration_state_notifier(Notifier *notifier)
+static void migration_state_notifier(Notifier *notifier, void *data)
{
int state = get_migration_state();
diff --git a/ui/spice-input.c b/ui/spice-input.c
index 37c8578a2..75abf5fbe 100644
--- a/ui/spice-input.c
+++ b/ui/spice-input.c
@@ -178,7 +178,7 @@ static const SpiceTabletInterface tablet_interface = {
.buttons = tablet_buttons,
};
-static void mouse_mode_notifier(Notifier *notifier)
+static void mouse_mode_notifier(Notifier *notifier, void *data)
{
QemuSpicePointer *pointer = container_of(notifier, QemuSpicePointer, mouse_mode);
bool is_absolute = kbd_mouse_is_absolute();
@@ -213,5 +213,5 @@ void qemu_spice_input_init(void)
pointer->absolute = false;
pointer->mouse_mode.notify = mouse_mode_notifier;
qemu_add_mouse_mode_change_notifier(&pointer->mouse_mode);
- mouse_mode_notifier(&pointer->mouse_mode);
+ mouse_mode_notifier(&pointer->mouse_mode, NULL);
}
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 17a621a2b..15af49bdb 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -491,13 +491,6 @@ static int protocol_client_auth_sasl_mechname_len(VncState *vs, uint8_t *data, s
return 0;
}
-#define USES_X509_AUTH(vs) \
- ((vs)->subauth == VNC_AUTH_VENCRYPT_X509NONE || \
- (vs)->subauth == VNC_AUTH_VENCRYPT_X509VNC || \
- (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN || \
- (vs)->subauth == VNC_AUTH_VENCRYPT_X509SASL)
-
-
void start_auth_sasl(VncState *vs)
{
const char *mechlist = NULL;
@@ -538,8 +531,8 @@ void start_auth_sasl(VncState *vs)
#ifdef CONFIG_VNC_TLS
/* Inform SASL that we've got an external SSF layer from TLS/x509 */
- if (vs->vd->auth == VNC_AUTH_VENCRYPT &&
- vs->vd->subauth == VNC_AUTH_VENCRYPT_X509SASL) {
+ if (vs->auth == VNC_AUTH_VENCRYPT &&
+ vs->subauth == VNC_AUTH_VENCRYPT_X509SASL) {
gnutls_cipher_algorithm_t cipher;
sasl_ssf_t ssf;
@@ -570,8 +563,8 @@ void start_auth_sasl(VncState *vs)
#ifdef CONFIG_VNC_TLS
/* Disable SSF, if using TLS+x509+SASL only. TLS without x509
is not sufficiently strong */
- || (vs->vd->auth == VNC_AUTH_VENCRYPT &&
- vs->vd->subauth == VNC_AUTH_VENCRYPT_X509SASL)
+ || (vs->auth == VNC_AUTH_VENCRYPT &&
+ vs->subauth == VNC_AUTH_VENCRYPT_X509SASL)
#endif /* CONFIG_VNC_TLS */
) {
/* If we've got TLS or UNIX domain sock, we don't care about SSF */
diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c
index 07c169186..674ba97dc 100644
--- a/ui/vnc-auth-vencrypt.c
+++ b/ui/vnc-auth-vencrypt.c
@@ -29,7 +29,7 @@
static void start_auth_vencrypt_subauth(VncState *vs)
{
- switch (vs->vd->subauth) {
+ switch (vs->subauth) {
case VNC_AUTH_VENCRYPT_TLSNONE:
case VNC_AUTH_VENCRYPT_X509NONE:
VNC_DEBUG("Accept TLS auth none\n");
@@ -51,7 +51,7 @@ static void start_auth_vencrypt_subauth(VncState *vs)
#endif /* CONFIG_VNC_SASL */
default: /* Should not be possible, but just in case */
- VNC_DEBUG("Reject subauth %d server bug\n", vs->vd->auth);
+ VNC_DEBUG("Reject subauth %d server bug\n", vs->auth);
vnc_write_u8(vs, 1);
if (vs->minor >= 8) {
static const char err[] = "Unsupported authentication type";
@@ -110,17 +110,17 @@ static void vnc_tls_handshake_io(void *opaque) {
#define NEED_X509_AUTH(vs) \
- ((vs)->vd->subauth == VNC_AUTH_VENCRYPT_X509NONE || \
- (vs)->vd->subauth == VNC_AUTH_VENCRYPT_X509VNC || \
- (vs)->vd->subauth == VNC_AUTH_VENCRYPT_X509PLAIN || \
- (vs)->vd->subauth == VNC_AUTH_VENCRYPT_X509SASL)
+ ((vs)->subauth == VNC_AUTH_VENCRYPT_X509NONE || \
+ (vs)->subauth == VNC_AUTH_VENCRYPT_X509VNC || \
+ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN || \
+ (vs)->subauth == VNC_AUTH_VENCRYPT_X509SASL)
static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len)
{
int auth = read_u32(data, 0);
- if (auth != vs->vd->subauth) {
+ if (auth != vs->subauth) {
VNC_DEBUG("Rejecting auth %d\n", auth);
vnc_write_u8(vs, 0); /* Reject auth */
vnc_flush(vs);
@@ -153,10 +153,10 @@ static int protocol_client_vencrypt_init(VncState *vs, uint8_t *data, size_t len
vnc_flush(vs);
vnc_client_error(vs);
} else {
- VNC_DEBUG("Sending allowed auth %d\n", vs->vd->subauth);
+ VNC_DEBUG("Sending allowed auth %d\n", vs->subauth);
vnc_write_u8(vs, 0); /* Accept version */
vnc_write_u8(vs, 1); /* Number of sub-auths */
- vnc_write_u32(vs, vs->vd->subauth); /* The supported auth */
+ vnc_write_u32(vs, vs->subauth); /* The supported auth */
vnc_flush(vs);
vnc_read_when(vs, protocol_client_vencrypt_auth, 4);
}
diff --git a/ui/vnc.c b/ui/vnc.c
index 14f2930d1..4425180a8 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1346,7 +1346,7 @@ static void client_cut_text(VncState *vs, size_t len, uint8_t *text)
{
}
-static void check_pointer_type_change(Notifier *notifier)
+static void check_pointer_type_change(Notifier *notifier, void *data)
{
VncState *vs = container_of(notifier, VncState, mouse_mode_notifier);
int absolute = kbd_mouse_is_absolute();
@@ -1769,7 +1769,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
}
}
vnc_desktop_resize(vs);
- check_pointer_type_change(&vs->mouse_mode_notifier);
+ check_pointer_type_change(&vs->mouse_mode_notifier, NULL);
}
static void set_pixel_conversion(VncState *vs)
@@ -2124,7 +2124,7 @@ static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)
{
/* We only advertise 1 auth scheme at a time, so client
* must pick the one we sent. Verify this */
- if (data[0] != vs->vd->auth) { /* Reject auth */
+ if (data[0] != vs->auth) { /* Reject auth */
VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)data[0]);
vnc_write_u32(vs, 1);
if (vs->minor >= 8) {
@@ -2135,7 +2135,7 @@ static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)
vnc_client_error(vs);
} else { /* Accept requested auth */
VNC_DEBUG("Client requested auth %d\n", (int)data[0]);
- switch (vs->vd->auth) {
+ switch (vs->auth) {
case VNC_AUTH_NONE:
VNC_DEBUG("Accept auth none\n");
if (vs->minor >= 8) {
@@ -2165,7 +2165,7 @@ static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)
#endif /* CONFIG_VNC_SASL */
default: /* Should not be possible, but just in case */
- VNC_DEBUG("Reject auth %d server code bug\n", vs->vd->auth);
+ VNC_DEBUG("Reject auth %d server code bug\n", vs->auth);
vnc_write_u8(vs, 1);
if (vs->minor >= 8) {
static const char err[] = "Authentication failed";
@@ -2210,26 +2210,26 @@ static int protocol_version(VncState *vs, uint8_t *version, size_t len)
vs->minor = 3;
if (vs->minor == 3) {
- if (vs->vd->auth == VNC_AUTH_NONE) {
+ if (vs->auth == VNC_AUTH_NONE) {
VNC_DEBUG("Tell client auth none\n");
- vnc_write_u32(vs, vs->vd->auth);
+ vnc_write_u32(vs, vs->auth);
vnc_flush(vs);
start_client_init(vs);
- } else if (vs->vd->auth == VNC_AUTH_VNC) {
+ } else if (vs->auth == VNC_AUTH_VNC) {
VNC_DEBUG("Tell client VNC auth\n");
- vnc_write_u32(vs, vs->vd->auth);
+ vnc_write_u32(vs, vs->auth);
vnc_flush(vs);
start_auth_vnc(vs);
} else {
- VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", vs->vd->auth);
+ VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", vs->auth);
vnc_write_u32(vs, VNC_AUTH_INVALID);
vnc_flush(vs);
vnc_client_error(vs);
}
} else {
- VNC_DEBUG("Telling client we support auth %d\n", vs->vd->auth);
+ VNC_DEBUG("Telling client we support auth %d\n", vs->auth);
vnc_write_u8(vs, 1); /* num auth */
- vnc_write_u8(vs, vs->vd->auth);
+ vnc_write_u8(vs, vs->auth);
vnc_read_when(vs, protocol_client_auth, 1);
vnc_flush(vs);
}
@@ -2494,12 +2494,25 @@ static void vnc_remove_timer(VncDisplay *vd)
}
}
-static void vnc_connect(VncDisplay *vd, int csock)
+static void vnc_connect(VncDisplay *vd, int csock, int skipauth)
{
VncState *vs = qemu_mallocz(sizeof(VncState));
int i;
vs->csock = csock;
+
+ if (skipauth) {
+ vs->auth = VNC_AUTH_NONE;
+#ifdef CONFIG_VNC_TLS
+ vs->subauth = VNC_AUTH_INVALID;
+#endif
+ } else {
+ vs->auth = vd->auth;
+#ifdef CONFIG_VNC_TLS
+ vs->subauth = vd->subauth;
+#endif
+ }
+
vs->lossy_rect = qemu_mallocz(VNC_STAT_ROWS * sizeof (*vs->lossy_rect));
for (i = 0; i < VNC_STAT_ROWS; ++i) {
vs->lossy_rect[i] = qemu_mallocz(VNC_STAT_COLS * sizeof (uint8_t));
@@ -2557,7 +2570,7 @@ static void vnc_listen_read(void *opaque)
int csock = qemu_accept(vs->lsock, (struct sockaddr *)&addr, &addrlen);
if (csock != -1) {
- vnc_connect(vs, csock);
+ vnc_connect(vs, csock, 0);
}
}
@@ -2887,7 +2900,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
} else {
int csock = vs->lsock;
vs->lsock = -1;
- vnc_connect(vs, csock);
+ vnc_connect(vs, csock, 0);
}
return 0;
@@ -2911,3 +2924,10 @@ int vnc_display_open(DisplayState *ds, const char *display)
}
return qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs);
}
+
+void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
+{
+ VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
+
+ return vnc_connect(vs, csock, skipauth);
+}
diff --git a/ui/vnc.h b/ui/vnc.h
index f10c5dc4e..66689f1d6 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -256,8 +256,10 @@ struct VncState
int major;
int minor;
+ int auth;
char challenge[VNC_AUTH_CHALLENGE_SIZE];
#ifdef CONFIG_VNC_TLS
+ int subauth; /* Used by VeNCrypt */
VncStateTLS tls;
#endif
#ifdef CONFIG_VNC_SASL
diff --git a/usb-linux.c b/usb-linux.c
index 1a2deb35c..53cc5fc00 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1260,7 +1260,7 @@ static int usb_host_close(USBHostDevice *dev)
return 0;
}
-static void usb_host_exit_notifier(struct Notifier* n)
+static void usb_host_exit_notifier(struct Notifier *n, void *data)
{
USBHostDevice *s = container_of(n, USBHostDevice, exit);
diff --git a/vl.c b/vl.c
index 274be1627..7ae549eac 100644
--- a/vl.c
+++ b/vl.c
@@ -1401,7 +1401,6 @@ static void main_loop(void)
monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
if (no_shutdown) {
vm_stop(VMSTOP_SHUTDOWN);
- no_shutdown = 0;
} else
break;
}
@@ -2013,7 +2012,7 @@ void qemu_remove_exit_notifier(Notifier *notify)
static void qemu_run_exit_notifiers(void)
{
- notifier_list_notify(&exit_notifiers);
+ notifier_list_notify(&exit_notifiers, NULL);
}
void qemu_add_machine_init_done_notifier(Notifier *notify)
@@ -2023,7 +2022,7 @@ void qemu_add_machine_init_done_notifier(Notifier *notify)
static void qemu_run_machine_init_done_notifiers(void)
{
- notifier_list_notify(&machine_init_done_notifiers);
+ notifier_list_notify(&machine_init_done_notifiers, NULL);
}
static const QEMUOption *lookup_opt(int argc, char **argv,
@@ -3163,8 +3162,8 @@ int main(int argc, char **argv, char **envp)
if (nb_numa_nodes > 0) {
int i;
- if (nb_numa_nodes > smp_cpus) {
- nb_numa_nodes = smp_cpus;
+ if (nb_numa_nodes > MAX_NODES) {
+ nb_numa_nodes = MAX_NODES;
}
/* If no memory size if given for any node, assume the default case
diff --git a/xen-all.c b/xen-all.c
index 8105c8368..167bed6db 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -839,7 +839,7 @@ static void xen_vm_change_state_handler(void *opaque, int running, int reason)
}
}
-static void xen_exit_notifier(Notifier *n)
+static void xen_exit_notifier(Notifier *n, void *data)
{
XenIOState *state = container_of(n, XenIOState, exit);