aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-05-01 15:30:41 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2010-05-01 15:30:41 -0300
commit383ed3e00151998736b4933eca5fe394f7080f58 (patch)
tree1070333a56135bb9a16df8a27d4dfc6fbd59ab45 /monitor.c
parentMerge commit 'f038e8f79bcda25bc30daacf3906d998c12b34f4' into upstream-merge (diff)
parentprovide a stub version of kvm-all.c if !CONFIG_KVM (diff)
downloadqemu-kvm-383ed3e00151998736b4933eca5fe394f7080f58.tar.gz
qemu-kvm-383ed3e00151998736b4933eca5fe394f7080f58.tar.bz2
qemu-kvm-383ed3e00151998736b4933eca5fe394f7080f58.zip
Merge commit '98c8573eb37bf5d7bb0c07225985a78537c73101' into upstream-merge
* commit '98c8573eb37bf5d7bb0c07225985a78537c73101': (75 commits) provide a stub version of kvm-all.c if !CONFIG_KVM tcg/arm: don't try to load constants using pc tcg/arm: optimize register allocation order tcg/arm: fix argument alignment in qemu_st64 tcg/arm: remove useless register tests in qemu_ld/st tcg/arm: bswap arguments in qemu_ld/st if needed tcg/arm: use ext* ops in qemu_ld tcg/arm: remove conditional argument for qemu_ld/st tcg/arm: add bswap ops tcg/arm: add ext16u op tcg/arm: add rotation ops tcg/arm: use the blx instruction when possible tcg/arm: sxtb and sxth are available starting with ARMv6 tcg/arm: add variables to define the allowed instructions set tcg/arm: align 64-bit arguments in function calls tcg/arm: replace integer values by registers enum tcg/arm: remove store signed functions tcg/arm: explicitely list clobbered/reserved regs tcg/arm: remove SAVE_LR code Check for invalid initrd file ... Conflicts: Makefile.target kvm-all.c kvm.h vl.c Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/monitor.c b/monitor.c
index d6491d895..a5f4cdf90 100644
--- a/monitor.c
+++ b/monitor.c
@@ -77,7 +77,7 @@
* 'l' target long (32 or 64 bit)
* 'M' just like 'l', except in user mode the value is
* multiplied by 2^20 (think Mebibyte)
- * 'b' double
+ * 'f' double
* user mode accepts an optional G, g, M, m, K, k suffix,
* which multiplies the value by 2^30 for suffixes G and
* g, 2^20 for M and m, 2^10 for K and k
@@ -88,6 +88,8 @@
*
* '?' optional type (for all types, except '/')
* '.' other form of optional type (for 'i' and 'l')
+ * 'b' boolean
+ * user mode accepts "on" or "off"
* '-' optional parameter (eg. '-f')
*
*/
@@ -977,7 +979,8 @@ static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
int index = qdict_get_int(qdict, "index");
if (mon_set_cpu(index) < 0) {
- qerror_report(QERR_INVALID_PARAMETER, "index");
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "index",
+ "a CPU number");
return -1;
}
return 0;
@@ -1125,6 +1128,7 @@ static int do_change_block(Monitor *mon, const char *device,
return -1;
}
if (bdrv_open2(bs, filename, BDRV_O_RDWR, drv) < 0) {
+ qerror_report(QERR_OPEN_FILE_FAILED, filename);
return -1;
}
return monitor_read_bdrv_key_start(mon, bs, NULL, NULL);
@@ -1188,9 +1192,10 @@ static int do_change(Monitor *mon, const QDict *qdict, QObject **ret_data)
return ret;
}
-static void do_screen_dump(Monitor *mon, const QDict *qdict)
+static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
vga_hw_screen_dump(qdict_get_str(qdict, "filename"));
+ return 0;
}
static void do_logfile(Monitor *mon, const QDict *qdict)
@@ -2435,7 +2440,8 @@ static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
if (qemu_isdigit(fdname[0])) {
- qerror_report(QERR_INVALID_PARAMETER, "fdname");
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "fdname",
+ "a name not starting with a digit");
return -1;
}
@@ -3742,7 +3748,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
qdict_put(qdict, key, qint_from_int(val));
}
break;
- case 'b':
+ case 'f':
case 'T':
{
double val;
@@ -3758,7 +3764,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
if (get_double(mon, &val, &p) < 0) {
goto fail;
}
- if (c == 'b' && *p) {
+ if (c == 'f' && *p) {
switch (*p) {
case 'K': case 'k':
val *= 1 << 10; p++; break;
@@ -3785,6 +3791,29 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
qdict_put(qdict, key, qfloat_from_double(val));
}
break;
+ case 'b':
+ {
+ const char *beg;
+ int val;
+
+ while (qemu_isspace(*p)) {
+ p++;
+ }
+ beg = p;
+ while (qemu_isgraph(*p)) {
+ p++;
+ }
+ if (p - beg == 2 && !memcmp(beg, "on", p - beg)) {
+ val = 1;
+ } else if (p - beg == 3 && !memcmp(beg, "off", p - beg)) {
+ val = 0;
+ } else {
+ monitor_printf(mon, "Expected 'on' or 'off'\n");
+ goto fail;
+ }
+ qdict_put(qdict, key, qbool_from_int(val));
+ }
+ break;
case '-':
{
const char *tmp = p;
@@ -4259,13 +4288,19 @@ static int check_arg(const CmdArgs *cmd_args, QDict *args)
return -1;
}
break;
- case 'b':
+ case 'f':
case 'T':
if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "number");
return -1;
}
break;
+ case 'b':
+ if (qobject_type(value) != QTYPE_QBOOL) {
+ qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool");
+ return -1;
+ }
+ break;
case '-':
if (qobject_type(value) != QTYPE_QINT &&
qobject_type(value) != QTYPE_QBOOL) {