examples: Use add_drive_opts function in examples.

In libguestfs 1.20, you will be able to use 'add_drive'
instead of 'add_drive_opts' (except in the C bindings).

However until libguestfs 1.20 is the minimum stable version
people will still be using old versions where you have to use
'add_drive_opts'.  This makes the examples confusing.

Therefore continue to use 'add_drive_opts' in the examples
for now.
This commit is contained in:
Richard W.M. Jones
2012-08-02 17:21:47 +01:00
parent b3d0cc0588
commit 863168467f
18 changed files with 25 additions and 25 deletions

View File

@@ -17,8 +17,8 @@ main(_) ->
ok = guestfs:set_trace(G, true),
% Attach the disk image to libguestfs.
ok = guestfs:add_drive(G, Output,
[{format, "raw"}, {readonly, false}]),
ok = guestfs:add_drive_opts(G, Output,
[{format, "raw"}, {readonly, false}]),
% Run the libguestfs back-end.
ok = guestfs:launch(G),

View File

@@ -7,8 +7,8 @@ guestfs-erlang - How to use libguestfs from Erlang
=head1 SYNOPSIS
{ok, G} = guestfs:create(),
ok = guestfs:add_drive(G, Disk,
[{format, "raw"}, {readonly, true}]),
ok = guestfs:add_drive_opts(G, Disk,
[{format, "raw"}, {readonly, true}]),
ok = guestfs:launch(G),
[Device] = guestfs:list_devices(G),
ok = guestfs:close(G).
@@ -43,12 +43,12 @@ For functions that take optional arguments, the first arguments are
the non-optional ones. The last argument is a list of tuples
supplying the remaining optional arguments.
ok = guestfs:add_drive(G, Disk,
[{format, "raw"}, {readonly, true}]).
ok = guestfs:add_drive_opts(G, Disk,
[{format, "raw"}, {readonly, true}]).
If the last argument would be an empty list, you can also omit it:
ok = guestfs:add_drive(G, Disk).
ok = guestfs:add_drive_opts(G, Disk).
=head2 RETURN VALUES AND ERRORS

View File

@@ -6,7 +6,7 @@ main([Disk]) ->
{ok, G} = guestfs:create(),
% Attach the disk image read-only to libguestfs.
ok = guestfs:add_drive(G, Disk, [{readonly, true}]),
ok = guestfs:add_drive_opts(G, Disk, [{readonly, true}]),
% Run the libguestfs back-end.
ok = guestfs:launch(G),

View File

@@ -29,7 +29,7 @@ public class CreateDisk
put ("readonly", Boolean.FALSE);
}
};
g.add_drive (output, optargs);
g.add_drive_opts (output, optargs);
// Run the libguestfs back-end.
g.launch ();

View File

@@ -35,7 +35,7 @@ public class InspectVM
}
};
g.add_drive (disk, optargs);
g.add_drive_opts (disk, optargs);
// Run the libguestfs back-end.
g.launch ();

View File

@@ -9,7 +9,7 @@ guestfs-java - How to use libguestfs from Java
import com.redhat.et.libguestfs.*;
GuestFS g = new GuestFS ();
g.add_drive ("disk.img");
g.add_drive_opts ("disk.img");
g.launch ();
=head1 DESCRIPTION

View File

@@ -17,7 +17,7 @@ let () =
g#set_trace true;
(* Attach the disk image to libguestfs. *)
g#add_drive ~format:"raw" ~readonly:false output;
g#add_drive_opts ~format:"raw" ~readonly:false output;
(* Run the libguestfs back-end. *)
g#launch ();

View File

@@ -9,13 +9,13 @@ guestfs-ocaml - How to use libguestfs from OCaml
Module style:
let g = Guestfs.create () in
Guestfs.add_drive g ~format:"raw" ~readonly:true "disk.img";
Guestfs.add_drive_opts g ~format:"raw" ~readonly:true "disk.img";
Guestfs.launch g;
Object-oriented style:
let g = new Guestfs.guestfs () in
g#add_drive ~format:"raw" ~readonly:true "disk.img";
g#add_drive_opts ~format:"raw" ~readonly:true "disk.img";
g#launch ();
ocamlfind opt prog.ml -package guestfs -linkpkg -o prog

View File

@@ -12,7 +12,7 @@ let () =
let g = new Guestfs.guestfs () in
(* Attach the disk image read-only to libguestfs. *)
g#add_drive (*~format:"raw"*) ~readonly:true disk;
g#add_drive_opts (*~format:"raw"*) ~readonly:true disk;
(* Run the libguestfs back-end. *)
g#launch ();

View File

@@ -18,7 +18,7 @@ close FILE or die "$output: $!";
$g->set_trace (1);
# Attach the disk image to libguestfs.
$g->add_drive ($output, format => "raw", readonly => 0);
$g->add_drive_opts ($output, format => "raw", readonly => 0);
# Run the libguestfs back-end.
$g->launch ();

View File

@@ -9,7 +9,7 @@ guestfs-perl - How to use libguestfs from Perl
use Sys::Guestfs;
my $g = Sys::Guestfs->new ();
$g->add_drive ('guest.img', format => 'raw');
$g->add_drive_opts ('guest.img', format => 'raw');
$g->launch ();
$g->mount_options ('', '/dev/sda1', '/');
$g->touch ('/hello');

View File

@@ -16,7 +16,7 @@ my $g = new Sys::Guestfs ();
# Attach the disk image read-only to libguestfs.
# You could also add an optional format => ... argument here. This is
# advisable since automatic format detection is insecure.
$g->add_drive ($disk, readonly => 1);
$g->add_drive_opts ($disk, readonly => 1);
# Run the libguestfs back-end.
$g->launch ();

View File

@@ -16,7 +16,7 @@ f.close ()
g.set_trace (1)
# Attach the disk image to libguestfs.
g.add_drive (output, format = "raw", readonly = 0)
g.add_drive_opts (output, format = "raw", readonly = 0)
# Run the libguestfs back-end.
g.launch ()

View File

@@ -8,7 +8,7 @@ guestfs-python - How to use libguestfs from Python
import guestfs
g = guestfs.GuestFS ()
g.add_drive ("disk.img", format="raw", readonly=1)
g.add_drive_opts ("disk.img", format="raw", readonly=1)
g.launch ()
=head1 DESCRIPTION

View File

@@ -9,7 +9,7 @@ disk = sys.argv[1]
g = guestfs.GuestFS ()
# Attach the disk image read-only to libguestfs.
g.add_drive (disk, readonly=1)
g.add_drive_opts (disk, readonly=1)
# Run the libguestfs back-end.
g.launch ()

View File

@@ -15,7 +15,7 @@ File.open(output, "w") {
g.set_trace(1)
# Attach the disk image to libguestfs.
g.add_drive(output, :format => "raw")
g.add_drive_opts(output, :format => "raw")
# Run the libguestfs back-end.
g.launch();

View File

@@ -8,8 +8,8 @@ guestfs-ruby - How to use libguestfs from Ruby
require 'guestfs'
g = Guestfs::Guestfs.new()
g.add_drive("disk.img",
:readonly => 1, :format => "raw")
g.add_drive_opts("disk.img",
:readonly => 1, :format => "raw")
g.launch()
=head1 DESCRIPTION

View File

@@ -11,7 +11,7 @@ disk = ARGV[0]
g = Guestfs::Guestfs.new()
# Attach the disk image read-only to libguestfs.
g.add_drive(disk, :readonly => 1)
g.add_drive_opts(disk, :readonly => 1)
# Run the libguestfs back-end.
g.launch()