[Libguestfs] [PATCH 1/2] New API: btrfs-image
Richard W.M. Jones
rjones at redhat.com
Thu Mar 5 12:47:04 UTC 2015
On Tue, Mar 03, 2015 at 03:48:02AM -0500, Chen Hanxiao wrote:
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> + if (compresslevel >= 0) {
> + snprintf (compresslevel_s, sizeof compresslevel_s, "%d", compresslevel);
> + ADD_ARG (argv, i, "-c");
> + ADD_ARG (argv, i, compresslevel_s);
> + }
Because compresslevel is an optional parameter, you can't just use it
directly like this. You have to check optargs_bitmask. The condition
should be something like:
if ((optargs_bitmask & GUESTFS_BTRFS_IMAGE_COMPRESSLEVEL_BITMASK) &&
compresslevel >= 0) {
...
}
> + if (numthreads) {
I would prefer not to expose the -t parameter, since it's essentially
an implementation detail.
If btrfs-image doesn't do the right thing, then you could pass
`sysconf (_SC_NPROCESSORS_ONLN)' here (see builder/pxzcat-c.c for an
example).
> +This used to create an image of a btrfs filesystem.
^ This is used ...
> +All data will be zeroed, but metadata and the like is preserved." };
This is fine with the corrections above.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list