[Libguestfs] [PATCH 1/1] tools: add '--blocksize' option for C-based tools

Richard W.M. Jones rjones at redhat.com
Thu Feb 13 09:43:46 UTC 2020


On Tue, Feb 11, 2020 at 11:51:17PM +0200, Mykola Ivanets wrote:
> diff --git a/align/scan.c b/align/scan.c
> index b9f29868c..5a456d3d6 100644
> --- a/align/scan.c
> +++ b/align/scan.c
> @@ -90,6 +90,8 @@ usage (int status)
>                "  -c|--connect uri     Specify libvirt URI for -d option\n"
>                "  -d|--domain guest    Add disks from libvirt guest\n"
>                "  --format[=raw|..]    Force disk format for -a option\n"
> +              "  --blocksize[=512|4096]\n"
> +              "                       Set sector size of the disk for -a option\n"
>                "  --help               Display brief help\n"
>                "  -P nr_threads        Use at most nr_threads\n"
>                "  -q|--quiet           No output, just exit code\n"

These options need to be kept in alphabetical order.

> @@ -119,6 +121,7 @@ main (int argc, char *argv[])
>      { "connect", 1, 0, 'c' },
>      { "domain", 1, 0, 'd' },
>      { "format", 2, 0, 0 },
> +    { "blocksize", 2, 0, 0 },
>      { "help", 0, 0, HELP_OPTION },
>      { "long-options", 0, 0, 0 },
>      { "quiet", 0, 0, 'q' },

And here.

> diff --git a/align/virt-alignment-scan.pod b/align/virt-alignment-scan.pod
> index 19953546e..21b5339e0 100644
> --- a/align/virt-alignment-scan.pod
> +++ b/align/virt-alignment-scan.pod
> @@ -162,6 +162,18 @@ If you have untrusted raw-format guest disk images, you should use
>  this option to specify the disk format.  This avoids a possible
>  security problem with malicious guests (CVE-2010-3851).
>  
> +=item B<--blocksize=512>
> +
> +=item B<--blocksize=4096>
> +
> +=item B<--blocksize>
> +
> +This parameter sets the sector size of the disk image.  Similar to
> +I<--format> option it affects all subsequent I<-a> options.  Using
> +I<--blocksize> with no argument switches disk sector size to the
> +default value which usually 512 bytes.  See also
> +L<guestfs(3)/guestfs_add_drive_opts>.
> +
>  =item B<-P> nr_threads

And here.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list