On 05/10/2011 02:07 PM, Cole Robinson wrote: > virRunWithHook is now unused, so we can drop it. Tested w/ raw + qcow2 > volume creation and copying. > > Signed-off-by: Cole Robinson <[email protected]> > --- > src/libvirt_private.syms | 1 - > src/storage/storage_backend.c | 151 > +++++++++++++++-------------------------- > src/util/util.c | 23 ++----- > src/util/util.h | 3 - > 4 files changed, 61 insertions(+), 117 deletions(-)
Only a 1:2 ratio; not quite as impressive as the 1:9 ratio in 1/16 :)
> @@ -945,13 +905,12 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn
> ATTRIBUTE_UNUSED,
> return -1;
> }
>
> - imgargv[0] = virFindFileInPath("qcow-create");
> - imgargv[1] = size;
> - imgargv[2] = vol->target.path;
> - imgargv[3] = NULL;
> + create_tool = virFindFileInPath("qcow-create");
> + cmd = virCommandNewArgList(create_tool, size, vol->target.path, NULL);
Instead of separately tracking size as an allocated string for the
converted vol->capacity value, you can get a further reduction in lines
as well as less malloc pressure by using virCommandAddArgFormat("%llu",
VIR_DIV_UP(vol->capacity,1024*1024)) at the right location. Up to you
if you want to squash that in now or leave it for a followup patch.
ACK.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
