summaryrefslogtreecommitdiffstats
path: root/perl
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-18 15:31:53 +0100
committerRichard Jones <rjones@redhat.com>2009-04-18 15:31:53 +0100
commitef499de8946cf4b8120ef7917b2e5d7f9115041f (patch)
tree8972aedf961b05a1d836ab15dcf946e837d12b42 /perl
parentad1d84a142169baaed293de71fb9430178d9f999 (diff)
downloadlibguestfs-ef499de8946cf4b8120ef7917b2e5d7f9115041f.tar.gz
libguestfs-ef499de8946cf4b8120ef7917b2e5d7f9115041f.tar.xz
libguestfs-ef499de8946cf4b8120ef7917b2e5d7f9115041f.zip
Separate out the high-level API actions.
- Split out the high-level API actions so that they are in a separate file, and use the defined guestfs C API, instead of fiddling around with internal structures.
Diffstat (limited to 'perl')
-rw-r--r--perl/Guestfs.xs65
-rw-r--r--perl/lib/Sys/Guestfs.pm35
2 files changed, 100 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs
index beb1c997..e4a1b502 100644
--- a/perl/Guestfs.xs
+++ b/perl/Guestfs.xs
@@ -239,6 +239,71 @@ PREINIT:
OUTPUT:
RETVAL
+SV *
+is_ready (g)
+ guestfs_h *g;
+PREINIT:
+ int ready;
+ CODE:
+ ready = guestfs_is_ready (g);
+ if (ready == -1)
+ croak ("is_ready: %s", guestfs_last_error (g));
+ RETVAL = newSViv (ready);
+ OUTPUT:
+ RETVAL
+
+SV *
+is_config (g)
+ guestfs_h *g;
+PREINIT:
+ int config;
+ CODE:
+ config = guestfs_is_config (g);
+ if (config == -1)
+ croak ("is_config: %s", guestfs_last_error (g));
+ RETVAL = newSViv (config);
+ OUTPUT:
+ RETVAL
+
+SV *
+is_launching (g)
+ guestfs_h *g;
+PREINIT:
+ int launching;
+ CODE:
+ launching = guestfs_is_launching (g);
+ if (launching == -1)
+ croak ("is_launching: %s", guestfs_last_error (g));
+ RETVAL = newSViv (launching);
+ OUTPUT:
+ RETVAL
+
+SV *
+is_busy (g)
+ guestfs_h *g;
+PREINIT:
+ int busy;
+ CODE:
+ busy = guestfs_is_busy (g);
+ if (busy == -1)
+ croak ("is_busy: %s", guestfs_last_error (g));
+ RETVAL = newSViv (busy);
+ OUTPUT:
+ RETVAL
+
+SV *
+get_state (g)
+ guestfs_h *g;
+PREINIT:
+ int state;
+ CODE:
+ state = guestfs_get_state (g);
+ if (state == -1)
+ croak ("get_state: %s", guestfs_last_error (g));
+ RETVAL = newSViv (state);
+ OUTPUT:
+ RETVAL
+
void
mount (g, device, mountpoint)
guestfs_h *g;
diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm
index 28d2b0fa..71223145 100644
--- a/perl/lib/Sys/Guestfs.pm
+++ b/perl/lib/Sys/Guestfs.pm
@@ -417,10 +417,31 @@ Return the current search path.
This is always non-NULL. If it wasn't set already, then this will
return the default path.
+=item $state = $h->get_state ();
+
+This returns the current state as an opaque integer. This is
+only useful for printing debug and internal error messages.
+
+For more information on states, see L<guestfs(3)>.
+
=item $verbose = $h->get_verbose ();
This returns the verbose messages flag.
+=item $busy = $h->is_busy ();
+
+This returns true iff this handle is busy processing a command
+(in the C<BUSY> state).
+
+For more information on states, see L<guestfs(3)>.
+
+=item $config = $h->is_config ();
+
+This returns true iff this handle is being configured
+(in the C<CONFIG> state).
+
+For more information on states, see L<guestfs(3)>.
+
=item $dirflag = $h->is_dir ($path);
This returns C<true> if and only if there is a directory
@@ -437,6 +458,20 @@ other objects like directories.
See also C<$h-E<gt>stat>.
+=item $launching = $h->is_launching ();
+
+This returns true iff this handle is launching the subprocess
+(in the C<LAUNCHING> state).
+
+For more information on states, see L<guestfs(3)>.
+
+=item $ready = $h->is_ready ();
+
+This returns true iff this handle is ready to accept commands
+(in the C<READY> state).
+
+For more information on states, see L<guestfs(3)>.
+
=item $h->kill_subprocess ();
This kills the qemu subprocess. You should never need to call this.