X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=6f33d80e5b261bd3319e2ffcaa7a10986c65644b;hp=7c5223bbcb7cb15771832473e7b7e89ef60002d3;hb=ca49c50e06834bbc68e21630a5552c57494f2b53;hpb=aed0fa2c015e56a882fd6d4b759c82df08fc40d7 diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 7c5223b..6f33d80 100644 --- a/guestfs-actions.pod +++ b/guestfs-actions.pod @@ -479,6 +479,13 @@ The first element is the name of the program to run. Subsequent elements are parameters. The list must be non-empty (ie. must contain a program name). +The return value is anything printed to I by +the command. + +If the command returns a non-zero exit status, then +this function returns an error message. The error message +string is the content of I from the command. + The C<$PATH> environment variable will contain at least C and C. If you require a program from another location, you should provide the full path in the @@ -493,6 +500,10 @@ locations. This function returns a string, or NULL on error. I. +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + =head2 guestfs_command_lines char **guestfs_command_lines (guestfs_h *handle, @@ -505,6 +516,10 @@ This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + =head2 guestfs_config int guestfs_config (guestfs_h *handle, @@ -522,6 +537,28 @@ C can be NULL. This function returns 0 on success or -1 on error. +=head2 guestfs_cp + + int guestfs_cp (guestfs_h *handle, + const char *src, + const char *dest); + +This copies a file from C to C where C is +either a destination filename or destination directory. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_cp_a + + int guestfs_cp_a (guestfs_h *handle, + const char *src, + const char *dest); + +This copies a file or directory from C to C +recursively using the C command. + +This function returns 0 on success or -1 on error. + =head2 guestfs_debug char *guestfs_debug (guestfs_h *handle, @@ -539,6 +576,22 @@ to find out what you can do. This function returns a string, or NULL on error. I. +=head2 guestfs_dmesg + + char *guestfs_dmesg (guestfs_h *handle); + +This returns the kernel messages (C output) from +the guest kernel. This is sometimes useful for extended +debugging of problems. + +Another way to get the same information is to enable +verbose messages with C or by setting +the environment variable C before +running the program. + +This function returns a string, or NULL on error. +I. + =head2 guestfs_download int guestfs_download (guestfs_h *handle, @@ -554,6 +607,48 @@ See also C, C. This function returns 0 on success or -1 on error. +=head2 guestfs_drop_caches + + int guestfs_drop_caches (guestfs_h *handle, + int whattodrop); + +This instructs the guest kernel to drop its page cache, +and/or dentries and inode caches. The parameter C +tells the kernel what precisely to drop, see +L + +Setting C to 3 should drop everything. + +This automatically calls L before the operation, +so that the maximum guest memory is freed. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_end_busy + + int guestfs_end_busy (guestfs_h *handle); + +This sets the state to C, or if in C then it leaves the +state as is. This is only used when implementing +actions using the low-level API. + +For more information on states, see L. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_equal + + int guestfs_equal (guestfs_h *handle, + const char *file1, + const char *file2); + +This compares the two files C and C and returns +true if their content is exactly equal, or false otherwise. + +The external L program is used for the comparison. + +This function returns a C truth value on success or -1 on error. + =head2 guestfs_exists int guestfs_exists (guestfs_h *handle, @@ -582,6 +677,54 @@ particular that the filename is not prepended to the output This function returns a string, or NULL on error. I. +=head2 guestfs_fsck + + int guestfs_fsck (guestfs_h *handle, + const char *fstype, + const char *device); + +This runs the filesystem checker (fsck) on C which +should have filesystem type C. + +The returned integer is the status. See L for the +list of status codes from C. + +Notes: + +=over 4 + +=item * + +Multiple status codes can be summed together. + +=item * + +A non-zero return code can mean "success", for example if +errors have been corrected on the filesystem. + +=item * + +Checking or repairing NTFS volumes is not supported +(by linux-ntfs). + +=back + +This command is entirely equivalent to running C. + +On error this function returns -1. + +=head2 guestfs_get_append + + const char *guestfs_get_append (guestfs_h *handle); + +Return the additional kernel options which are added to the +guest kernel command line. + +If C then no options are added. + +This function returns a string, or NULL on error. +The string is owned by the guest handle and must I be freed. + =head2 guestfs_get_autosync int guestfs_get_autosync (guestfs_h *handle); @@ -590,6 +733,28 @@ Get the autosync flag. This function returns a C truth value on success or -1 on error. +=head2 guestfs_get_e2label + + char *guestfs_get_e2label (guestfs_h *handle, + const char *device); + +This returns the ext2/3/4 filesystem label of the filesystem on +C. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_get_e2uuid + + char *guestfs_get_e2uuid (guestfs_h *handle, + const char *device); + +This returns the ext2/3/4 filesystem UUID of the filesystem on +C. + +This function returns a string, or NULL on error. +I. + =head2 guestfs_get_path const char *guestfs_get_path (guestfs_h *handle); @@ -633,6 +798,32 @@ This returns the verbose messages flag. This function returns a C truth value on success or -1 on error. +=head2 guestfs_grub_install + + int guestfs_grub_install (guestfs_h *handle, + const char *root, + const char *device); + +This command installs GRUB (the Grand Unified Bootloader) on +C, with the root directory being C. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_hexdump + + char *guestfs_hexdump (guestfs_h *handle, + const char *path); + +This runs C on the given C. The result is +the human-readable, canonical hex dump of the file. + +This function returns a string, or NULL on error. +I. + +Because of the message protocol, there is a transfer limit +of somewhere between 2MB and 4MB. To transfer large files you should use +FTP. + =head2 guestfs_is_busy int guestfs_is_busy (guestfs_h *handle); @@ -835,6 +1026,18 @@ the VG name, C. This function returns 0 on success or -1 on error. +=head2 guestfs_lvresize + + int guestfs_lvresize (guestfs_h *handle, + const char *device, + int mbytes); + +This resizes (expands or shrinks) an existing LVM logical +volume to C. When reducing, data in the reduced part +is lost. + +This function returns 0 on success or -1 on error. + =head2 guestfs_lvs char **guestfs_lvs (guestfs_h *handle); @@ -889,7 +1092,7 @@ This function returns 0 on success or -1 on error. const char *device); This creates a filesystem on C (usually a partition -of LVM logical volume). The filesystem type is C, for +or LVM logical volume). The filesystem type is C, for example C. This function returns 0 on success or -1 on error. @@ -970,6 +1173,28 @@ This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. +=head2 guestfs_mv + + int guestfs_mv (guestfs_h *handle, + const char *src, + const char *dest); + +This moves a file from C to C where C is +either a destination filename or destination directory. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_ping_daemon + + int guestfs_ping_daemon (guestfs_h *handle); + +This is a test probe into the guestfs daemon running inside +the qemu subprocess. Calling this function checks that the +daemon responds to the ping message, without affecting the daemon +or attached block device(s) in any other way. + +This function returns 0 on success or -1 on error. + =head2 guestfs_pvcreate int guestfs_pvcreate (guestfs_h *handle, @@ -995,6 +1220,16 @@ to remove those first. This function returns 0 on success or -1 on error. +=head2 guestfs_pvresize + + int guestfs_pvresize (guestfs_h *handle, + const char *device); + +This resizes (expands or shrinks) an existing LVM physical +volume to match the new size of the underlying device. + +This function returns 0 on success or -1 on error. + =head2 guestfs_pvs char **guestfs_pvs (guestfs_h *handle); @@ -1042,6 +1277,16 @@ This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. +=head2 guestfs_resize2fs + + int guestfs_resize2fs (guestfs_h *handle, + const char *device); + +This resizes an ext2 or ext3 filesystem to match the size of +the underlying device. + +This function returns 0 on success or -1 on error. + =head2 guestfs_rm int guestfs_rm (guestfs_h *handle, @@ -1071,15 +1316,35 @@ Remove the single directory C. This function returns 0 on success or -1 on error. +=head2 guestfs_set_append + + int guestfs_set_append (guestfs_h *handle, + const char *append); + +This function is used to add additional options to the +guest kernel command line. + +The default is C unless overridden by setting +C environment variable. + +Setting C to C means I additional options +are passed (libguestfs always adds a few of its own). + +This function returns 0 on success or -1 on error. + =head2 guestfs_set_autosync int guestfs_set_autosync (guestfs_h *handle, int autosync); If C is true, this enables autosync. Libguestfs will make a -best effort attempt to run C when the handle is closed +best effort attempt to run C followed by +C when the handle is closed (also if the program exits without closing handles). +This is disabled by default (except in guestfish where it is +enabled by default). + This function returns 0 on success or -1 on error. =head2 guestfs_set_busy @@ -1093,6 +1358,37 @@ For more information on states, see L. This function returns 0 on success or -1 on error. +=head2 guestfs_set_e2label + + int guestfs_set_e2label (guestfs_h *handle, + const char *device, + const char *label); + +This sets the ext2/3/4 filesystem label of the filesystem on +C to C