X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=d57dae3802f3acca4396b10e4d8b8a93d8a72f5a;hp=32c6d672978c0920078d3edd059fbee4d1adaac1;hb=170f262f0413de843af62b968f6d12c1c476ae7f;hpb=adefe14e308a0f8cf73f9c60693a3dbbded157b9 diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 32c6d67..d57dae3 100644 --- a/guestfs-actions.pod +++ b/guestfs-actions.pod @@ -58,7 +58,8 @@ On success this returns a pair containing the number of nodes in the nodeset, and a boolean flag if a node was created. -This function returns a C. +This function returns a C, +or NULL if there was an error. I after use>. =head2 guestfs_aug_defvar @@ -84,7 +85,7 @@ On error this function returns -1. Look up the value associated with C. If C matches exactly one node, the C is returned. -This function returns a string or NULL on error. +This function returns a string, or NULL on error. I. =head2 guestfs_aug_init @@ -238,6 +239,136 @@ Set the value associated with C to C. This function returns 0 on success or -1 on error. +=head2 guestfs_blockdev_flushbufs + + int guestfs_blockdev_flushbufs (guestfs_h *handle, + const char *device); + +This tells the kernel to flush internal buffers associated +with C. + +This uses the L command. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_blockdev_getbsz + + int guestfs_blockdev_getbsz (guestfs_h *handle, + const char *device); + +This returns the block size of a device. + +(Note this is different from both I and +I). + +This uses the L command. + +On error this function returns -1. + +=head2 guestfs_blockdev_getro + + int guestfs_blockdev_getro (guestfs_h *handle, + const char *device); + +Returns a boolean indicating if the block device is read-only +(true if read-only, false if not). + +This uses the L command. + +This function returns a C truth value on success or -1 on error. + +=head2 guestfs_blockdev_getsize64 + + int64_t guestfs_blockdev_getsize64 (guestfs_h *handle, + const char *device); + +This returns the size of the device in bytes. + +See also C. + +This uses the L command. + +On error this function returns -1. + +=head2 guestfs_blockdev_getss + + int guestfs_blockdev_getss (guestfs_h *handle, + const char *device); + +This returns the size of sectors on a block device. +Usually 512, but can be larger for modern devices. + +(Note, this is not the size in sectors, use C +for that). + +This uses the L command. + +On error this function returns -1. + +=head2 guestfs_blockdev_getsz + + int64_t guestfs_blockdev_getsz (guestfs_h *handle, + const char *device); + +This returns the size of the device in units of 512-byte sectors +(even if the sectorsize isn't 512 bytes ... weird). + +See also C for the real sector size of +the device, and C for the more +useful I. + +This uses the L command. + +On error this function returns -1. + +=head2 guestfs_blockdev_rereadpt + + int guestfs_blockdev_rereadpt (guestfs_h *handle, + const char *device); + +Reread the partition table on C. + +This uses the L command. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_blockdev_setbsz + + int guestfs_blockdev_setbsz (guestfs_h *handle, + const char *device, + int blocksize); + +This sets the block size of a device. + +(Note this is different from both I and +I). + +This uses the L command. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_blockdev_setro + + int guestfs_blockdev_setro (guestfs_h *handle, + const char *device); + +Sets the block device named C to read-only. + +This uses the L command. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_blockdev_setrw + + int guestfs_blockdev_setrw (guestfs_h *handle, + const char *device); + +Sets the block device named C to read-write. + +This uses the L command. + +This function returns 0 on success or -1 on error. + =head2 guestfs_cat char *guestfs_cat (guestfs_h *handle, @@ -247,10 +378,10 @@ Return the contents of the file named C. Note that this function cannot correctly handle binary files (specifically, files containing C<\0> character which is treated -as end of string). For those you need to use the C +as end of string). For those you need to use the C function which has a more complex interface. -This function returns a string or NULL on error. +This function returns a string, or NULL on error. I. Because of the message protocol, there is a transfer limit @@ -283,6 +414,47 @@ yourself (Augeas support makes this relatively easy). This function returns 0 on success or -1 on error. +=head2 guestfs_command + + char *guestfs_command (guestfs_h *handle, + char * const* const arguments); + +This call runs a command from the guest filesystem. The +filesystem must be mounted, and must contain a compatible +operating system (ie. something Linux, with the same +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). + +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 +first parameter. + +Shared libraries and data files required by the program +must be available on filesystems which are mounted in the +correct places. It is the caller's responsibility to ensure +all filesystems that are needed are mounted at the right +locations. + +This function returns a string, or NULL on error. +I. + +=head2 guestfs_command_lines + + char **guestfs_command_lines (guestfs_h *handle, + char * const* const arguments); + +This is the same as C, but splits the +result into a list of lines. + +This function returns a NULL-terminated array of strings +(like L), or NULL if there was an error. +I. + =head2 guestfs_config int guestfs_config (guestfs_h *handle, @@ -300,6 +472,21 @@ C can be NULL. This function returns 0 on success or -1 on error. +=head2 guestfs_download + + int guestfs_download (guestfs_h *handle, + const char *remotefilename, + const char *filename); + +Download file C and save it as C +on the local machine. + +C can also be a named pipe. + +See also C, C. + +This function returns 0 on success or -1 on error. + =head2 guestfs_exists int guestfs_exists (guestfs_h *handle, @@ -325,7 +512,7 @@ The exact command which runs is C. Note in particular that the filename is not prepended to the output (the C<-b> option). -This function returns a string or NULL on error. +This function returns a string, or NULL on error. I. =head2 guestfs_get_autosync @@ -345,9 +532,20 @@ Return the current search path. This is always non-NULL. If it wasn't set already, then this will return the default path. -This function returns a string or NULL on error. +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_state + + int guestfs_get_state (guestfs_h *handle); + +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. + +On error this function returns -1. + =head2 guestfs_get_verbose int guestfs_get_verbose (guestfs_h *handle); @@ -356,6 +554,28 @@ This returns the verbose messages flag. This function returns a C truth value on success or -1 on error. +=head2 guestfs_is_busy + + int guestfs_is_busy (guestfs_h *handle); + +This returns true iff this handle is busy processing a command +(in the C state). + +For more information on states, see L. + +This function returns a C truth value on success or -1 on error. + +=head2 guestfs_is_config + + int guestfs_is_config (guestfs_h *handle); + +This returns true iff this handle is being configured +(in the C state). + +For more information on states, see L. + +This function returns a C truth value on success or -1 on error. + =head2 guestfs_is_dir int guestfs_is_dir (guestfs_h *handle, @@ -382,6 +602,28 @@ See also C. This function returns a C truth value on success or -1 on error. +=head2 guestfs_is_launching + + int guestfs_is_launching (guestfs_h *handle); + +This returns true iff this handle is launching the subprocess +(in the C state). + +For more information on states, see L. + +This function returns a C truth value on success or -1 on error. + +=head2 guestfs_is_ready + + int guestfs_is_ready (guestfs_h *handle); + +This returns true iff this handle is ready to accept commands +(in the C state). + +For more information on states, see L. + +This function returns a C truth value on success or -1 on error. + =head2 guestfs_kill_subprocess int guestfs_kill_subprocess (guestfs_h *handle); @@ -440,7 +682,7 @@ there is no cwd) in the format of 'ls -la'. This command is mostly useful for interactive sessions. It is I intended that you try to parse the output string. -This function returns a string or NULL on error. +This function returns a string, or NULL on error. I. =head2 guestfs_ls @@ -459,6 +701,24 @@ This function returns a NULL-terminated array of strings (like L), or NULL if there was an error. I. +=head2 guestfs_lstat + + struct guestfs_stat *guestfs_lstat (guestfs_h *handle, + const char *path); + +Returns file information for the given C. + +This is the same as C except that if C +is a symbolic link, then the link is stat-ed, not the file it +refers to. + +This is the same as the C system call. + +This function returns a C +(see L and Eguestfs-structs.hE), +or NULL if there was an error. +I after use>. + =head2 guestfs_lvcreate int guestfs_lvcreate (guestfs_h *handle, @@ -506,7 +766,9 @@ I. List all the logical volumes detected. This is the equivalent of the L command. The "full" version includes all fields. -This function returns a C. +This function returns a C +(see Eguestfs-structs.hE), +or NULL if there was an error. I after use>. =head2 guestfs_mkdir @@ -612,7 +874,9 @@ I. List all the physical volumes detected. This is the equivalent of the L command. The "full" version includes all fields. -This function returns a C. +This function returns a C +(see Eguestfs-structs.hE), +or NULL if there was an error. I after use>. =head2 guestfs_read_lines @@ -674,6 +938,17 @@ best effort attempt to run C when the handle is closed This function returns 0 on success or -1 on error. +=head2 guestfs_set_busy + + int guestfs_set_busy (guestfs_h *handle); + +This sets the state to C. 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_set_path int guestfs_set_path (guestfs_h *handle, @@ -691,6 +966,17 @@ Setting C to C restores the default path. This function returns 0 on success or -1 on error. +=head2 guestfs_set_ready + + int guestfs_set_ready (guestfs_h *handle); + +This sets the state to C. 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_set_verbose int guestfs_set_verbose (guestfs_h *handle, @@ -737,6 +1023,36 @@ This function returns 0 on success or -1 on error. B. +=head2 guestfs_stat + + struct guestfs_stat *guestfs_stat (guestfs_h *handle, + const char *path); + +Returns file information for the given C. + +This is the same as the C system call. + +This function returns a C +(see L and Eguestfs-structs.hE), +or NULL if there was an error. +I after use>. + +=head2 guestfs_statvfs + + struct guestfs_statvfs *guestfs_statvfs (guestfs_h *handle, + const char *path); + +Returns file system statistics for any mounted file system. +C should be a file or directory in the mounted file system +(typically it is the mount point itself, but it doesn't need to be). + +This is the same as the C system call. + +This function returns a C +(see L and Eguestfs-structs.hE), +or NULL if there was an error. +I after use>. + =head2 guestfs_sync int guestfs_sync (guestfs_h *handle); @@ -760,6 +1076,25 @@ to create a new zero-length file. This function returns 0 on success or -1 on error. +=head2 guestfs_tune2fs_l + + char **guestfs_tune2fs_l (guestfs_h *handle, + const char *device); + +This returns the contents of the ext2 or ext3 filesystem superblock +on C. + +It is the same as running C. See L +manpage for more details. The list of fields returned isn't +clearly defined, and depends on both the version of C +that libguestfs was built against, and the filesystem itself. + +This function returns a NULL-terminated array of +strings, or NULL if there was an error. +The array of strings will always have length C<2n+1>, where +C keys and values alternate, followed by the trailing NULL entry. +I. + =head2 guestfs_umount int guestfs_umount (guestfs_h *handle, @@ -781,6 +1116,21 @@ Some internal mounts are not unmounted by this call. This function returns 0 on success or -1 on error. +=head2 guestfs_upload + + int guestfs_upload (guestfs_h *handle, + const char *filename, + const char *remotefilename); + +Upload local file C to C on the +filesystem. + +C can also be a named pipe. + +See also C. + +This function returns 0 on success or -1 on error. + =head2 guestfs_vgcreate int guestfs_vgcreate (guestfs_h *handle, @@ -815,7 +1165,9 @@ I. List all the volumes groups detected. This is the equivalent of the L command. The "full" version includes all fields. -This function returns a C. +This function returns a C +(see Eguestfs-structs.hE), +or NULL if there was an error. I after use>. =head2 guestfs_wait_ready