[Libguestfs] [PATCH 05/10] examples: Update various examples to use new disk-create API.
Pino Toscano
ptoscano at redhat.com
Tue Jan 28 16:53:51 UTC 2014
On Tuesday 28 January 2014 16:24:52 Richard W.M. Jones wrote:
> --- a/ocaml/examples/create_disk.ml
> +++ b/ocaml/examples/create_disk.ml
> @@ -9,9 +9,7 @@ let () =
> let g = new Guestfs.guestfs () in
>
> (* Create a raw-format sparse disk image, 512 MB in size. *)
> - let fd = openfile output [O_WRONLY;O_CREAT;O_TRUNC;O_NOCTTY] 0o666 in
> - ftruncate fd (512 * 1024 * 1024);
> - close fd;
> + g#disk_create output "raw" 536870912L;
Minor niptick: I'd leave the multiplication, as it was before and as
the other examples do (easier to spot and to change).
--
Pino Toscano
More information about the Libguestfs
mailing list