X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=50eba95a2685306247e633e97dd00d74eabcc2de;hp=7de041c9cf549bc41e6840584dd44e4b7a1be818;hb=0884d8bbae6d76a603ec1385ada2938f88981c5c;hpb=e8ecc08f663b44f3d79517affe52f137858dfe00 diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 7de041c..50eba95 100644 --- a/guestfs-actions.pod +++ b/guestfs-actions.pod @@ -7,6 +7,11 @@ This function adds a virtual CD-ROM disk image to the guest. This is equivalent to the qemu parameter C<-cdrom filename>. +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. + This function returns 0 on success or -1 on error. =head2 guestfs_add_drive @@ -25,7 +30,36 @@ for whatever operations you want to perform (ie. read access if you just want to read the image or write access if you want to modify the image). -This is equivalent to the qemu parameter C<-drive file=filename>. +This is equivalent to the qemu parameter C<-drive file=filename,cache=off>. + +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_add_drive_ro + + int guestfs_add_drive_ro (guestfs_h *handle, + const char *filename); + +This adds a drive in snapshot mode, making it effectively +read-only. + +Note that writes to the device are allowed, and will be seen for +the duration of the guestfs handle, but they are written +to a temporary file which is discarded as soon as the guestfs +handle is closed. We don't currently have any method to enable +changes to be committed, although qemu can support this. + +This is equivalent to the qemu parameter +C<-drive file=filename,snapshot=on>. + +Note that this call checks for the existence of C. This +stops you from specifying other types of drive which are supported +by qemu such as C and C URLs. To specify those, use +the general C call instead. This function returns 0 on success or -1 on error. @@ -477,7 +511,9 @@ or compatible processor architecture). The single parameter is an argv-style list of arguments. 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). +non-empty (ie. must contain a program name). Note that +the command runs directly, and is I invoked via +the shell (see C). The return value is anything printed to I by the command. @@ -512,6 +548,8 @@ FTP. This is the same as C, but splits the result into a list of lines. +See also: C + This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. @@ -576,6 +614,33 @@ to find out what you can do. This function returns a string, or NULL on error. I. +=head2 guestfs_df + + char *guestfs_df (guestfs_h *handle); + +This command runs the C command to report disk space used. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_df_h + + char *guestfs_df_h (guestfs_h *handle); + +This command runs the C command to report disk space used +in human-readable format. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs. + +This function returns a string, or NULL on error. +I. + =head2 guestfs_dmesg char *guestfs_dmesg (guestfs_h *handle); @@ -624,6 +689,37 @@ so that the maximum guest memory is freed. This function returns 0 on success or -1 on error. +=head2 guestfs_du + + int64_t guestfs_du (guestfs_h *handle, + const char *path); + +This command runs the C command to estimate file space +usage for C. + +C can be a file or a directory. If C is a directory +then the estimate includes the contents of the directory and all +subdirectories (recursively). + +The result is the estimated size in I +(ie. units of 1024 bytes). + +On error this function returns -1. + +=head2 guestfs_e2fsck_f + + int guestfs_e2fsck_f (guestfs_h *handle, + const char *device); + +This runs C, ie. runs the ext2/ext3 +filesystem checker on C, noninteractively (C<-p>), +even if the filesystem appears to be clean (C<-f>). + +This command is only needed because of C +(q.v.). Normally you should use C. + +This function returns 0 on success or -1 on error. + =head2 guestfs_end_busy int guestfs_end_busy (guestfs_h *handle); @@ -677,6 +773,40 @@ particular that the filename is not prepended to the output This function returns a string, or NULL on error. I. +=head2 guestfs_find + + char **guestfs_find (guestfs_h *handle, + const char *directory); + +This command lists out all files and directories, recursively, +starting at C. It is essentially equivalent to +running the shell command C but some +post-processing happens on the output, described below. + +This returns a list of strings I. Thus +if the directory structure was: + + /tmp/a + /tmp/b + /tmp/c/d + +then the returned list from C C would be +4 elements: + + a + b + c + c/d + +If C is not a directory, then this command returns +an error. + +The returned list is sorted. + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_fsck int guestfs_fsck (guestfs_h *handle, @@ -755,6 +885,22 @@ C. This function returns a string, or NULL on error. I. +=head2 guestfs_get_memsize + + int guestfs_get_memsize (guestfs_h *handle); + +This gets the memory size in megabytes allocated to the +qemu subprocess. + +If C was not called +on this handle, and if C was not set, +then this returns the compiled-in default value for memsize. + +For more information on the architecture of libguestfs, +see L. + +On error this function returns -1. + =head2 guestfs_get_path const char *guestfs_get_path (guestfs_h *handle); @@ -798,6 +944,26 @@ This returns the verbose messages flag. This function returns a C truth value on success or -1 on error. +=head2 guestfs_glob_expand + + char **guestfs_glob_expand (guestfs_h *handle, + const char *pattern); + +This command searches for all the pathnames matching +C according to the wildcard expansion rules +used by the shell. + +If no paths match, then this returns an empty list +(note: not an error). + +It is just a wrapper around the C L function +with flags C. +See that manual page for more details. + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_grub_install int guestfs_grub_install (guestfs_h *handle, @@ -809,6 +975,44 @@ C, with the root directory being C. This function returns 0 on success or -1 on error. +=head2 guestfs_head + + char **guestfs_head (guestfs_h *handle, + const char *path); + +This command returns up to the first 10 lines of a file as +a list of strings. + +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_head_n + + char **guestfs_head_n (guestfs_h *handle, + int nrlines, + const char *path); + +If the parameter C is a positive number, this returns the first +C lines of the file C. + +If the parameter C is a negative number, this returns lines +from the file C, excluding the last C lines. + +If the parameter C is zero, this returns an empty list. + +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_hexdump char *guestfs_hexdump (guestfs_h *handle, @@ -824,6 +1028,25 @@ 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_initrd_list + + char **guestfs_initrd_list (guestfs_h *handle, + const char *path); + +This command lists out files contained in an initrd. + +The files are listed without any initial C character. The +files are listed in the order they appear (not necessarily +alphabetical). Directory names are listed as separate items. + +Old Linux kernels (2.4 and earlier) used a compressed ext2 +filesystem as initrd. We I support the newer initramfs +format (compressed cpio files). + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_is_busy int guestfs_is_busy (guestfs_h *handle); @@ -1026,6 +1249,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); @@ -1073,6 +1308,45 @@ as necessary. This is like the C shell command. This function returns 0 on success or -1 on error. +=head2 guestfs_mkdtemp + + char *guestfs_mkdtemp (guestfs_h *handle, + const char *template); + +This command creates a temporary directory. The +C