X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=dcc8b50d39dab3b7376f76fd1c200755c9f7686f;hp=551b3e32f3b37def172568ec645d8eb280c15be3;hb=dd98434c1b45f7a27065b13839089c7265203e2d;hpb=5365ebd501850ea10d9a5b28fc6480ea34dbe16d diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 551b3e3..dcc8b50 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,16 +378,66 @@ 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 of somewhere between 2MB and 4MB. To transfer large files you should use FTP. +=head2 guestfs_checksum + + char *guestfs_checksum (guestfs_h *handle, + const char *csumtype, + const char *path); + +This call computes the MD5, SHAx or CRC checksum of the +file named C. + +The type of checksum to compute is given by the C +parameter which must have one of the following values: + +=over 4 + +=item C + +Compute the cyclic redundancy check (CRC) specified by POSIX +for the C command. + +=item C + +Compute the MD5 hash (using the C program). + +=item C + +Compute the SHA1 hash (using the C program). + +=item C + +Compute the SHA224 hash (using the C program). + +=item C + +Compute the SHA256 hash (using the C program). + +=item C + +Compute the SHA384 hash (using the C program). + +=item C + +Compute the SHA512 hash (using the C program). + +=back + +The checksum is returned as a printable string. + +This function returns a string, or NULL on error. +I. + =head2 guestfs_chmod int guestfs_chmod (guestfs_h *handle, @@ -288,7 +469,7 @@ This function returns 0 on success or -1 on error. char *guestfs_command (guestfs_h *handle, char * const* const arguments); -This calls runs a command from the guest filesystem. The +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). @@ -309,7 +490,7 @@ 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. +This function returns a string, or NULL on error. I. =head2 guestfs_command_lines @@ -341,6 +522,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, @@ -366,7 +562,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 @@ -386,9 +582,32 @@ 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_qemu + + const char *guestfs_get_qemu (guestfs_h *handle); + +Return the current qemu binary. + +This is always non-NULL. If it wasn't set already, then this will +return the default qemu binary name. + +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); @@ -397,6 +616,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, @@ -423,6 +664,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); @@ -481,7 +744,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 @@ -500,6 +763,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, @@ -547,7 +828,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 @@ -606,6 +889,44 @@ call, in order to improve reliability. This function returns 0 on success or -1 on error. +=head2 guestfs_mount_options + + int guestfs_mount_options (guestfs_h *handle, + const char *options, + const char *device, + const char *mountpoint); + +This is the same as the C command, but it +allows you to set the mount options as for the +L I<-o> flag. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_mount_ro + + int guestfs_mount_ro (guestfs_h *handle, + const char *device, + const char *mountpoint); + +This is the same as the C command, but it +mounts the filesystem with the read-only (I<-o ro>) flag. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_mount_vfs + + int guestfs_mount_vfs (guestfs_h *handle, + const char *options, + const char *vfstype, + const char *device, + const char *mountpoint); + +This is the same as the C command, but it +allows you to set both the mount options and the vfstype +as for the L I<-o> and I<-t> flags. + +This function returns 0 on success or -1 on error. + =head2 guestfs_mounts char **guestfs_mounts (guestfs_h *handle); @@ -653,7 +974,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 @@ -715,6 +1038,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, @@ -732,6 +1066,37 @@ Setting C to C restores the default path. This function returns 0 on success or -1 on error. +=head2 guestfs_set_qemu + + int guestfs_set_qemu (guestfs_h *handle, + const char *qemu); + +Set the qemu binary that we will use. + +The default is chosen when the library was compiled by the +configure script. + +You can also override this by setting the C +environment variable. + +The string C is stashed in the libguestfs handle, so the caller +must make sure it remains valid for the lifetime of the handle. + +Setting C to C restores the default qemu binary. + +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, @@ -778,6 +1143,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); @@ -790,6 +1185,58 @@ closing the handle. This function returns 0 on success or -1 on error. +=head2 guestfs_tar_in + + int guestfs_tar_in (guestfs_h *handle, + const char *tarfile, + const char *directory); + +This command uploads and unpacks local file C (an +I tar file) into C. + +To upload a compressed tarball, use C. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_tar_out + + int guestfs_tar_out (guestfs_h *handle, + const char *directory, + const char *tarfile); + +This command packs the contents of C and downloads +it to local file C. + +To download a compressed tarball, use C. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_tgz_in + + int guestfs_tgz_in (guestfs_h *handle, + const char *tarball, + const char *directory); + +This command uploads and unpacks local file C (a +I tar file) into C. + +To upload an uncompressed tarball, use C. + +This function returns 0 on success or -1 on error. + +=head2 guestfs_tgz_out + + int guestfs_tgz_out (guestfs_h *handle, + const char *directory, + const char *tarball); + +This command packs the contents of C and downloads +it to local file C. + +To download an uncompressed tarball, use C. + +This function returns 0 on success or -1 on error. + =head2 guestfs_touch int guestfs_touch (guestfs_h *handle, @@ -801,6 +1248,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, @@ -822,6 +1288,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, @@ -856,7 +1337,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