Libguestfs provides ways to enumerate guest storage (eg. partitions,
LVs, what filesystem is in each LV, etc.). It can also run commands
-in the context of the guest. Also you can mount guest filesystems on
-the host (requires root privs and NFS).
+in the context of the guest. Also you can access filesystems over FTP.
Libguestfs is a library that can be linked with C and C++ management
programs (or management programs written in other languages, if people
=head1 HIGH-LEVEL API ACTIONS
-=head2 guestfs_sync
- int guestfs_sync (guestfs_h *handle);
-
-This syncs the disk, so that any writes are flushed through to the
-underlying disk image.
-
-You should always call this if you have modified a disk image, before
-calling C<guestfs_close>.
-
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
-Documentation will be auto-generated from here, including for
-guestfs_sync.
-
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
- do_[action] ([parameters])
- {
- guestfs_set_reply_callback (handle, [action]_cb, data);
- guestfs_nb_[action] (handle, [parameters ...]);
-
- guestfs_main_loop_run (); /* --> blocks, then calls my_cb */
- }
-
- [action]_cb (guestfs_h *handle, void *data)
- {
- retval = guestfs_nb_[action]_r (handle);
- /* ... */
- guestfs_main_loop_quit ();
- return retval;
- }
-
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
=head2 NON-BLOCKING ACTIONS
+XXX NOT IMPLEMENTED YET XXX
+
C<guestfs_set_reply_callback> is the most interesting callback to
play with, since it allows you to perform actions without blocking.
/* returns immediately */
}
- my_cb (guestfs_h *handle, void *data)
+ my_cb (guestfs_h *handle, void *data, XDR *xdr)
{
- retval = guestfs_nb_[action]_r (handle);
+ retval = guestfs_nb_[action]_r (handle, xdr);
/* ... */
}
There are C<guestfs_nb_*> and C<guestfs_nb_*_r> functions
-corresponding to (very nearly) every C<guestfs_*> action in the
-high-level API.
+corresponding to every C<guestfs_*> action in the high-level API.
=head2 guestfs_set_reply_callback
+ typedef void (*guestfs_reply_cb) (guestfs_h *g, void *opaque, XDR *xdr);
void guestfs_set_reply_callback (guestfs_h *handle,
guestfs_reply_cb cb,
void *opaque);
received from the child process. (This corresponds to a transition
from the BUSY state to the READY state).
+Note that the C<xdr> that you get in the callback is in C<XDR_DECODE>
+mode, and you need to consume it before you return from the callback
+function (since it gets destroyed after).
+
=head2 guestfs_set_log_message_callback
+ typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,
+ char *buf, int len);
void guestfs_set_log_message_callback (guestfs_h *handle,
guestfs_log_message_cb cb,
void *opaque);
=head2 guestfs_set_subprocess_quit_callback
+ typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);
void guestfs_set_subprocess_quit_callback (guestfs_h *handle,
guestfs_subprocess_quit_cb cb,
void *opaque);
=head2 guestfs_set_launch_done_callback
+ typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);
void guestfs_set_launch_done_callback (guestfs_h *handle,
guestfs_ready_cb cb,
void *opaque);