Fix do_commit() behavior
PATCH 1/1 Fix do_commit() behavior
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).
--- monitor.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
monitor.c +1 -1
@@ -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); }
Signature · 1 line
1.6.4.rc3.12.gdf73a
monitor.c static void do_commit(Monitor *mon, const char *device) · line 265
Quoted 11 lines · Luiz Capitulino
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)monitor.c +1
-1-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.
cheers,
Gerd
monitor.c static void do_commit(Monitor *mon, const char *device) · line 265
Quoted 9 lines · Luiz Capitulino
all_devices = !strcmp(device, "all"); TAILQ_FOREACH(dinfo,&drives, next) { if (!all_devices)monitor.c +1
-1-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.
Signature · 1 line
error compiling committee.c: too many arguments to function