qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix do_commit() behavior
@ 2009-07-31 18:15 Luiz Capitulino
  2009-08-03  8:47 ` [Qemu-devel] " Gerd Hoffmann
  2009-08-06 15:39 ` [Qemu-devel] " Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Capitulino @ 2009-07-31 18:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, kraxel


Commit 751c6a17042b5d011013d6963c0505d671cf708e changed the monitor's
'commit' command to this behavior:

1. Any string you type as argument will cause do_commit() to
call bdrv_commit() to all devices

2. If you enter a device name, it will be the only one ignored
by do_commit() :)

The fix is to call bdrv_commit() to the specified device only and
ignore the others (when 'all' is not specified).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index 9093254..32fc26a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -259,7 +259,7 @@ static void do_commit(Monitor *mon, const char *device)
     all_devices = !strcmp(device, "all");
     TAILQ_FOREACH(dinfo, &drives, next) {
         if (!all_devices)
-            if (!strcmp(bdrv_get_device_name(dinfo->bdrv), device))
+            if (strcmp(bdrv_get_device_name(dinfo->bdrv), device))
                 continue;
         bdrv_commit(dinfo->bdrv);
     }
-- 
1.6.4.rc3.12.gdf73a

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

* [Qemu-devel] Re: [PATCH] Fix do_commit() behavior
  2009-07-31 18:15 [Qemu-devel] [PATCH] Fix do_commit() behavior Luiz Capitulino
@ 2009-08-03  8:47 ` Gerd Hoffmann
  2009-08-06 15:39 ` [Qemu-devel] " Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2009-08-03  8:47 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: aliguori, qemu-devel

On 07/31/09 20:15, Luiz Capitulino wrote:
> The fix is to call bdrv_commit() to the specified device only and
> ignore the others (when 'all' is not specified).

>       all_devices = !strcmp(device, "all");
>       TAILQ_FOREACH(dinfo,&drives, next) {
>           if (!all_devices)
> -            if (!strcmp(bdrv_get_device_name(dinfo->bdrv), device))
> +            if (strcmp(bdrv_get_device_name(dinfo->bdrv), device))
>                   continue;
>           bdrv_commit(dinfo->bdrv);
>       }

Fix is correct.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

cheers,
   Gerd

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

* Re: [Qemu-devel] [PATCH] Fix do_commit() behavior
  2009-07-31 18:15 [Qemu-devel] [PATCH] Fix do_commit() behavior Luiz Capitulino
  2009-08-03  8:47 ` [Qemu-devel] " Gerd Hoffmann
@ 2009-08-06 15:39 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2009-08-06 15:39 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: aliguori, qemu-devel, kraxel

On 07/31/2009 09:15 PM, Luiz Capitulino wrote:
>       all_devices = !strcmp(device, "all");
>       TAILQ_FOREACH(dinfo,&drives, next) {
>           if (!all_devices)
> -            if (!strcmp(bdrv_get_device_name(dinfo->bdrv), device))
> +            if (strcmp(bdrv_get_device_name(dinfo->bdrv), device))
>                   continue;
>           bdrv_commit(dinfo->bdrv);
>       }
>    

strcmp() without == 0 or != 0 is evil, as is !strcmp().  strcmp() does 
not return a boolean value or a count.


-- 
error compiling committee.c: too many arguments to function

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

end of thread, other threads:[~2009-08-06 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-31 18:15 [Qemu-devel] [PATCH] Fix do_commit() behavior Luiz Capitulino
2009-08-03  8:47 ` [Qemu-devel] " Gerd Hoffmann
2009-08-06 15:39 ` [Qemu-devel] " Avi Kivity

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