qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] qmp: Remove unused variable.
@ 2014-04-22 21:44 Hani Benhabiles
  2014-04-24 15:19 ` Michael Tokarev
  2014-04-25 15:40 ` Luiz Capitulino
  0 siblings, 2 replies; 7+ messages in thread
From: Hani Benhabiles @ 2014-04-22 21:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, lcapitulino

Signed-off-by: Hani Benhabiles <hani@linux.com>
---
 qmp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/qmp.c b/qmp.c
index 87a28f7..44a6e17 100644
--- a/qmp.c
+++ b/qmp.c
@@ -194,11 +194,10 @@ void qmp_system_wakeup(Error **errp)
 ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
 {
     Object *obj;
-    bool ambiguous = false;
     ObjectPropertyInfoList *props = NULL;
     ObjectProperty *prop;
 
-    obj = object_resolve_path(path, &ambiguous);
+    obj = object_resolve_path(path, NULL);
     if (obj == NULL) {
         error_set(errp, QERR_DEVICE_NOT_FOUND, path);
         return NULL;
-- 
1.8.3.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-22 21:44 [Qemu-trivial] [PATCH] qmp: Remove unused variable Hani Benhabiles
@ 2014-04-24 15:19 ` Michael Tokarev
  2014-04-25 15:40 ` Luiz Capitulino
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2014-04-24 15:19 UTC (permalink / raw)
  To: Hani Benhabiles, qemu-devel; +Cc: qemu-trivial, lcapitulino

Thanks, applied to -trivial.

/mjt


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-22 21:44 [Qemu-trivial] [PATCH] qmp: Remove unused variable Hani Benhabiles
  2014-04-24 15:19 ` Michael Tokarev
@ 2014-04-25 15:40 ` Luiz Capitulino
  2014-04-25 15:51   ` Andreas Färber
  1 sibling, 1 reply; 7+ messages in thread
From: Luiz Capitulino @ 2014-04-25 15:40 UTC (permalink / raw)
  To: Hani Benhabiles
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, afaerber, imammedo

On Tue, 22 Apr 2014 22:44:03 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:

> Signed-off-by: Hani Benhabiles <hani@linux.com>
> ---
>  qmp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/qmp.c b/qmp.c
> index 87a28f7..44a6e17 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -194,11 +194,10 @@ void qmp_system_wakeup(Error **errp)
>  ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
>  {
>      Object *obj;
> -    bool ambiguous = false;
>      ObjectPropertyInfoList *props = NULL;
>      ObjectProperty *prop;
>  
> -    obj = object_resolve_path(path, &ambiguous);
> +    obj = object_resolve_path(path, NULL);
>      if (obj == NULL) {
>          error_set(errp, QERR_DEVICE_NOT_FOUND, path);
>          return NULL;

I'm under the impression that this check in object_resolve_partial_path():

        if (ambiguous && *ambiguous) {
            return NULL;
        }

Uses 'ambiguous' internally. In that case, this change could have a side effect.

But I'm not sure, I think it would be good to get a reviewed-by from
a QOM expert.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-25 15:40 ` Luiz Capitulino
@ 2014-04-25 15:51   ` Andreas Färber
  2014-04-26  0:46     ` Hani Benhabiles
  2014-04-28  8:37     ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Färber @ 2014-04-25 15:51 UTC (permalink / raw)
  To: Luiz Capitulino, Hani Benhabiles, Paolo Bonzini
  Cc: qemu-trivial, imammedo, qemu-devel

Am 25.04.2014 17:40, schrieb Luiz Capitulino:
> On Tue, 22 Apr 2014 22:44:03 +0100
> Hani Benhabiles <kroosec@gmail.com> wrote:
> 
>> Signed-off-by: Hani Benhabiles <hani@linux.com>
>> ---
>>  qmp.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/qmp.c b/qmp.c
>> index 87a28f7..44a6e17 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -194,11 +194,10 @@ void qmp_system_wakeup(Error **errp)
>>  ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
>>  {
>>      Object *obj;
>> -    bool ambiguous = false;
>>      ObjectPropertyInfoList *props = NULL;
>>      ObjectProperty *prop;
>>  
>> -    obj = object_resolve_path(path, &ambiguous);
>> +    obj = object_resolve_path(path, NULL);
>>      if (obj == NULL) {
>>          error_set(errp, QERR_DEVICE_NOT_FOUND, path);
>>          return NULL;
> 
> I'm under the impression that this check in object_resolve_partial_path():
> 
>         if (ambiguous && *ambiguous) {
>             return NULL;
>         }
> 
> Uses 'ambiguous' internally. In that case, this change could have a side effect.
> 
> But I'm not sure, I think it would be good to get a reviewed-by from
> a QOM expert.

Your understanding matches mine. I would propose to instead use the
variable in error reporting:

if (ambiguous) {
    error_setg(errp, "Path '%s' is ambiguous.", path);
} else {
    error_set(errp, QERR_DEVICE_NOT_FOUND, path);
}

My reasoning is that an ambiguous path might deliver unpredictable
results (whichever it encounters first), across QEMU versions at least.

But I'd like to hear Paolo's opinion, too, since he was involved in
loosening requirements on paths.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-25 15:51   ` Andreas Färber
@ 2014-04-26  0:46     ` Hani Benhabiles
  2014-04-28  8:38       ` Paolo Bonzini
  2014-04-28  8:37     ` Paolo Bonzini
  1 sibling, 1 reply; 7+ messages in thread
From: Hani Benhabiles @ 2014-04-26  0:46 UTC (permalink / raw)
  To: Andreas Färber
  Cc: qemu-trivial, Paolo Bonzini, imammedo, qemu-devel,
	Luiz Capitulino

On Fri, Apr 25, 2014 at 05:51:33PM +0200, Andreas Färber wrote:
> Am 25.04.2014 17:40, schrieb Luiz Capitulino:
> > On Tue, 22 Apr 2014 22:44:03 +0100
> > Hani Benhabiles <kroosec@gmail.com> wrote:
> > 
> >> Signed-off-by: Hani Benhabiles <hani@linux.com>
> >> ---
> >>  qmp.c | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/qmp.c b/qmp.c
> >> index 87a28f7..44a6e17 100644
> >> --- a/qmp.c
> >> +++ b/qmp.c
> >> @@ -194,11 +194,10 @@ void qmp_system_wakeup(Error **errp)
> >>  ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
> >>  {
> >>      Object *obj;
> >> -    bool ambiguous = false;
> >>      ObjectPropertyInfoList *props = NULL;
> >>      ObjectProperty *prop;
> >>  
> >> -    obj = object_resolve_path(path, &ambiguous);
> >> +    obj = object_resolve_path(path, NULL);
> >>      if (obj == NULL) {
> >>          error_set(errp, QERR_DEVICE_NOT_FOUND, path);
> >>          return NULL;
> > 
> > I'm under the impression that this check in object_resolve_partial_path():
> > 
> >         if (ambiguous && *ambiguous) {
> >             return NULL;
> >         }
> > 
> > Uses 'ambiguous' internally. In that case, this change could have a side effect.
> > 
> > But I'm not sure, I think it would be good to get a reviewed-by from
> > a QOM expert.
> 
> Your understanding matches mine. I would propose to instead use the
> variable in error reporting:
> 

Luiz, Andreas, thanks for spotting this.

On second thought, I agree that this has the side effect of listing the last
found object with that path value, though the preivous behaviour too is
suboptimal as it reports that no devices are found at that path.

> if (ambiguous) {
>     error_setg(errp, "Path '%s' is ambiguous.", path);
> } else {
>     error_set(errp, QERR_DEVICE_NOT_FOUND, path);
> }
> 

Probably, you meant something like this:

if (ambiguous) {
    error_set(errp, QERR_AMBIGUOUS_PATH, path);
} else if (!obj) {
    error_set(errp, QERR_DEVICE_NOT_FOUND, path);
}


> My reasoning is that an ambiguous path might deliver unpredictable
> results (whichever it encounters first), across QEMU versions at least.
> 
> But I'd like to hear Paolo's opinion, too, since he was involved in
> loosening requirements on paths.
> 

Is this documented somewhere ? Searching the mailing-list archives doesn't show
something concrete. Paolo ?

Quick grepping shows only one out of 9 other object_resolve_path() calls
checking for path ambiguity.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-25 15:51   ` Andreas Färber
  2014-04-26  0:46     ` Hani Benhabiles
@ 2014-04-28  8:37     ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2014-04-28  8:37 UTC (permalink / raw)
  To: Andreas Färber, Luiz Capitulino, Hani Benhabiles
  Cc: qemu-trivial, imammedo, qemu-devel

Il 25/04/2014 17:51, Andreas Färber ha scritto:
>
> if (ambiguous) {
>     error_setg(errp, "Path '%s' is ambiguous.", path);
> } else {
>     error_set(errp, QERR_DEVICE_NOT_FOUND, path);
> }
>
> My reasoning is that an ambiguous path might deliver unpredictable
> results (whichever it encounters first), across QEMU versions at least.
>
> But I'd like to hear Paolo's opinion, too, since he was involved in
> loosening requirements on paths.

I agree.  I think the only loosening I did was to allow an empty path if 
the required type is not NULL.

Paolo


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [PATCH] qmp: Remove unused variable.
  2014-04-26  0:46     ` Hani Benhabiles
@ 2014-04-28  8:38       ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2014-04-28  8:38 UTC (permalink / raw)
  To: Hani Benhabiles, Andreas Färber
  Cc: qemu-trivial, imammedo, qemu-devel, Luiz Capitulino

Il 26/04/2014 02:46, Hani Benhabiles ha scritto:
>> if (ambiguous) {
>> >     error_setg(errp, "Path '%s' is ambiguous.", path);
>> > } else {
>> >     error_set(errp, QERR_DEVICE_NOT_FOUND, path);
>> > }
>> >
> Probably, you meant something like this:
>
> if (ambiguous) {
>     error_set(errp, QERR_AMBIGUOUS_PATH, path);
> } else if (!obj) {
>     error_set(errp, QERR_DEVICE_NOT_FOUND, path);
> }
>
>

No, error_set is being phased out.  New errors typically use error_setg 
instead.

Paolo


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-28  8:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 21:44 [Qemu-trivial] [PATCH] qmp: Remove unused variable Hani Benhabiles
2014-04-24 15:19 ` Michael Tokarev
2014-04-25 15:40 ` Luiz Capitulino
2014-04-25 15:51   ` Andreas Färber
2014-04-26  0:46     ` Hani Benhabiles
2014-04-28  8:38       ` Paolo Bonzini
2014-04-28  8:37     ` Paolo Bonzini

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).