Il 30/06/2014 15:59, Sebastian Tanase ha scritto:
The align option is used for activating the align algorithm
in order to synchronise the host clock and the guest clock.

Signed-off-by: Sebastian Tanase <sebastian.tan...@openwide.fr>
Tested-by: Camille Bégué <camille.be...@openwide.fr>
---
 cpus.c                | 13 +++++++++++++
 include/qemu-common.h |  1 +
 qemu-options.hx       | 15 +++++++++++++--
 vl.c                  |  4 ++++
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index dcca96a..3fa8ce7 100644
--- a/cpus.c
+++ b/cpus.c
@@ -448,13 +448,24 @@ void configure_icount(QemuOpts *opts, Error **errp)
     vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
     option = qemu_opt_get(opts, "shift");
     if (!option) {
+        if (qemu_opt_get(opts, "align") != NULL) {
+            error_setg(errp, "Please specify shift option when using align");
+        }
         return;
     }
+    icount_align_option = qemu_opt_get_bool(opts, "align", false);
     /* When using -icount shift, the shift option will be
        misinterpreted as a boolean */
     if (strcmp(option, "on") == 0 || strcmp(option, "off") == 0) {
         error_setg(errp, "The shift option must be a number or auto");
     }
+    /* When using icount [shift=]N|auto -icount align, shift becomes
+       align therefore we have to specify align=on|off.
+       We do however inform the user whenever the case. */
+    if (strcmp(option, "align") == 0) {
+        error_setg(errp, "Please specify align=on or off so as not "
+         "to create confusion between the shift and align options");
+    }

Can you prepare a follow-up (on top of this patch) that instead adds proper error handling to the strtol call below? Then these strcmps can probably go away.

Paolo

Reply via email to