mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
examples: In create_disk example, don't call set_autosync.
This is now set by default in all supported versions of libguestfs. It's just confusing if the examples refer to it.
This commit is contained in:
@@ -16,10 +16,6 @@ main(_) ->
|
||||
% Set the trace flag so that we can see each libguestfs call.
|
||||
ok = guestfs:set_trace(G, true),
|
||||
|
||||
% Set the autosync flag so that the disk will be synchronized
|
||||
% automatically when the libguestfs handle is closed.
|
||||
ok = guestfs:set_autosync(G, true),
|
||||
|
||||
% Attach the disk image to libguestfs.
|
||||
ok = guestfs:add_drive_opts(G, Output,
|
||||
[{format, "raw"}, {readonly, false}]),
|
||||
@@ -55,10 +51,6 @@ main(_) ->
|
||||
% the disk image.
|
||||
ok = guestfs:upload(G, "/etc/resolv.conf", "/foo/resolv.conf"),
|
||||
|
||||
% Because 'autosync' was set (above) we can just close the handle
|
||||
% and the disk contents will be synchronized. You can also do
|
||||
% this manually by calling guestfs:umount_all and guestfs:sync.
|
||||
%
|
||||
% Note also that handles are automatically closed if they are
|
||||
% reaped by the garbage collector. You only need to call close
|
||||
% if you want to close the handle right away.
|
||||
|
||||
@@ -37,11 +37,6 @@ main (int argc, char *argv[])
|
||||
/* Set the trace flag so that we can see each libguestfs call. */
|
||||
guestfs_set_trace (g, 1);
|
||||
|
||||
/* Set the autosync flag so that the disk will be synchronized
|
||||
* automatically when the libguestfs handle is closed.
|
||||
*/
|
||||
guestfs_set_autosync (g, 1);
|
||||
|
||||
/* Add the disk image to libguestfs. */
|
||||
if (guestfs_add_drive_opts (g, "disk.img",
|
||||
GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", /* raw format */
|
||||
@@ -104,10 +99,6 @@ main (int argc, char *argv[])
|
||||
if (guestfs_upload (g, "/etc/resolv.conf", "/foo/resolv.conf") == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
/* Because 'autosync' was set (above) we can just close the handle
|
||||
* and the disk contents will be synchronized. You can also do
|
||||
* this manually by calling guestfs_umount_all and guestfs_sync.
|
||||
*/
|
||||
guestfs_close (g);
|
||||
|
||||
/* Free up the lists. */
|
||||
|
||||
@@ -22,10 +22,6 @@ public class CreateDisk
|
||||
// Set the trace flag so that we can see each libguestfs call.
|
||||
g.set_trace (true);
|
||||
|
||||
// Set the autosync flag so that the disk will be synchronized
|
||||
// automatically when the libguestfs handle is closed.
|
||||
g.set_autosync (true);
|
||||
|
||||
// Attach the disk image to libguestfs.
|
||||
Map<String, Object> optargs = new HashMap<String, Object>() {
|
||||
{
|
||||
@@ -70,10 +66,6 @@ public class CreateDisk
|
||||
// the disk image.
|
||||
g.upload ("/etc/resolv.conf", "/foo/resolv.conf");
|
||||
|
||||
// Because 'autosync' was set (above) we can just close the handle
|
||||
// and the disk contents will be synchronized. You can also do
|
||||
// this manually by calling g#umount_all and g#sync.
|
||||
//
|
||||
// Note also that handles are automatically closed if they are
|
||||
// reaped by the garbage collector. You only need to call close
|
||||
// if you want to close the handle right away.
|
||||
|
||||
@@ -16,11 +16,6 @@ let () =
|
||||
(* Set the trace flag so that we can see each libguestfs call. *)
|
||||
g#set_trace true;
|
||||
|
||||
(* Set the autosync flag so that the disk will be synchronized
|
||||
* automatically when the libguestfs handle is closed.
|
||||
*)
|
||||
g#set_autosync true;
|
||||
|
||||
(* Attach the disk image to libguestfs. *)
|
||||
g#add_drive_opts ~format:"raw" ~readonly:false output;
|
||||
|
||||
@@ -62,11 +57,7 @@ let () =
|
||||
*)
|
||||
g#upload "/etc/resolv.conf" "/foo/resolv.conf";
|
||||
|
||||
(* Because 'autosync' was set (above) we can just close the handle
|
||||
* and the disk contents will be synchronized. You can also do
|
||||
* this manually by calling g#umount_all and g#sync.
|
||||
*
|
||||
* Note also that handles are automatically closed if they are
|
||||
(* Note also that handles are automatically closed if they are
|
||||
* reaped by the garbage collector. You only need to call close
|
||||
* if you want to close the handle right away.
|
||||
*)
|
||||
|
||||
@@ -17,10 +17,6 @@ close FILE or die "$output: $!";
|
||||
# Set the trace flag so that we can see each libguestfs call.
|
||||
$g->set_trace (1);
|
||||
|
||||
# Set the autosync flag so that the disk will be synchronized
|
||||
# automatically when the libguestfs handle is closed.
|
||||
$g->set_autosync (1);
|
||||
|
||||
# Attach the disk image to libguestfs.
|
||||
$g->add_drive_opts ($output, format => "raw", readonly => 0);
|
||||
|
||||
@@ -61,7 +57,4 @@ $g->mkdir ("/foo");
|
||||
# the disk image.
|
||||
$g->upload ("/etc/resolv.conf", "/foo/resolv.conf");
|
||||
|
||||
# Because 'autosync' was set (above) we can just exit here
|
||||
# and the disk contents will be synchronized. You can also do
|
||||
# this manually by calling $g->umount_all and $g->sync.
|
||||
exit 0
|
||||
|
||||
@@ -15,10 +15,6 @@ f.close ()
|
||||
# Set the trace flag so that we can see each libguestfs call.
|
||||
g.set_trace (1)
|
||||
|
||||
# Set the autosync flag so that the disk will be synchronized
|
||||
# automatically when the libguestfs handle is closed.
|
||||
g.set_autosync (1)
|
||||
|
||||
# Attach the disk image to libguestfs.
|
||||
g.add_drive_opts (output, format = "raw", readonly = 0)
|
||||
|
||||
@@ -55,7 +51,4 @@ g.mkdir ("/foo")
|
||||
# the disk image.
|
||||
g.upload ("/etc/resolv.conf", "/foo/resolv.conf")
|
||||
|
||||
# Because 'autosync' was set (above) we can just close the handle
|
||||
# and the disk contents will be synchronized. You can also do
|
||||
# this manually by calling g.umount_all and g.sync.
|
||||
g.close ()
|
||||
|
||||
@@ -14,10 +14,6 @@ File.open(output, "w") {
|
||||
# Set the trace flag so that we can see each libguestfs call.
|
||||
g.set_trace(1)
|
||||
|
||||
# Set the autosync flag so that the disk will be synchronized
|
||||
# automatically when the libguestfs handle is closed.
|
||||
g.set_autosync(1)
|
||||
|
||||
# Attach the disk image to libguestfs.
|
||||
g.add_drive_opts(output, :format => "raw")
|
||||
|
||||
@@ -58,7 +54,4 @@ g.mkdir("/foo")
|
||||
# the disk image.
|
||||
g.upload("/etc/resolv.conf", "/foo/resolv.conf")
|
||||
|
||||
# Because 'autosync' was set (above) we can just close the handle
|
||||
# and the disk contents will be synchronized. You can also do
|
||||
# this manually by calling g#umount_all and g#sync.
|
||||
g.close()
|
||||
|
||||
Reference in New Issue
Block a user