qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Alberto Garcia <agarcia@igalia.com>
Cc: qemu-trivial@nongnu.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] ivshmem, qdev-monitor: fix order of qerror parameters
Date: Tue, 14 Aug 2012 10:42:30 -0300	[thread overview]
Message-ID: <20120814104230.64aed4e3@doriath.home> (raw)
In-Reply-To: <1344944488-27075-1-git-send-email-agarcia@igalia.com>

On Tue, 14 Aug 2012 14:41:28 +0300
Alberto Garcia <agarcia@igalia.com> wrote:

> Now that the QERR_ macros no longer contain a json dictionary,
> the order of some parameters needs to be fixed for them to appear
> correctly.
> ---
>  hw/ivshmem.c      |    3 ++-
>  hw/qdev-monitor.c |    2 +-
>  2 ficheiros modificados, 3 adições(+), 2 eliminados(-)
> 
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index 0c58161..b4d65a6 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -677,7 +677,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
>      }
>  
>      if (s->role_val == IVSHMEM_PEER) {
> -        error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "ivshmem", "peer mode");
> +        error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION,
> +                  "peer mode", "ivshmem");

Good catch, Alberto.

Here's the real problem. The original QERR_DEVICE_FEATURE_BLOCKS_MIGRATION was:

 "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"

This is what was used in a error_set() call, so ordering was device name,
feature name.

However, the human error message format was:

 "Migration is disabled when using feature '%(feature)' in device '%(device)'"

So, when constructing the error message, ordering was feature name, device name.

However, my script that moved all error messages from qerror.c to the QERR_
just did (as a final result):

 error_set(errp,
           "Migration is disabled when using feature '%s' in device '%s'",
           device_name, feature_name);

Sh?t.

Now, I think that the best way to fix this is to change the error message
instead of fixing callers.

For example, we could have:

 "Migration is disabled when device '%s' is using feature '%s'"

Additionally, we should check all old QERR_ macros to see if anyone else
swaps parameters like this and change them too.

I'll do it.

>          migrate_add_blocker(s->migration_blocker);
>      }
>  
> diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
> index b22a37a..018b386 100644
> --- a/hw/qdev-monitor.c
> +++ b/hw/qdev-monitor.c
> @@ -443,7 +443,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
>          bus = qbus_find_recursive(sysbus_get_default(), NULL, k->bus_type);
>          if (!bus) {
>              qerror_report(QERR_NO_BUS_FOR_DEVICE,
> -                          driver, k->bus_type);
> +                          k->bus_type, driver);
>              return NULL;
>          }
>      }

       reply	other threads:[~2012-08-14 13:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1344944488-27075-1-git-send-email-agarcia@igalia.com>
2012-08-14 13:42 ` Luiz Capitulino [this message]
2012-08-14 14:15   ` [Qemu-devel] [PATCH] ivshmem, qdev-monitor: fix order of qerror parameters Alberto Garcia
2012-08-14 14:43     ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120814104230.64aed4e3@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=agarcia@igalia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).