X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=guestfs-actions.pod;h=7c5223bbcb7cb15771832473e7b7e89ef60002d3;hp=889363a5b1888c0a1495251c045670d6f657e3fc;hb=9501ab7792e50e464dc65e9190a0e1d84b5dd423;hpb=ad5abc8d367c9c410051062cae066b1b141b4c76 diff --git a/guestfs-actions.pod b/guestfs-actions.pod index 889363a..7c5223b 100644 --- a/guestfs-actions.pod +++ b/guestfs-actions.pod @@ -239,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, @@ -248,7 +378,7 @@ 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. @@ -258,6 +388,56 @@ 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, @@ -342,6 +522,38 @@ C can be NULL. This function returns 0 on success or -1 on error. +=head2 guestfs_debug + + char *guestfs_debug (guestfs_h *handle, + const char *subcmd, + char * const* const extraargs); + +The C command exposes some internals of +C (the guestfs daemon) that runs inside the +qemu subprocess. + +There is no comprehensive help for this command. You have +to look at the file C in the libguestfs source +to find out what you can do. + +This function returns a string, or NULL on error. +I. + +=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, @@ -390,6 +602,29 @@ return the default path. 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); @@ -398,6 +633,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, @@ -424,6 +681,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); @@ -543,6 +822,19 @@ This function returns 0 on success or -1 on error. B. +=head2 guestfs_lvremove + + int guestfs_lvremove (guestfs_h *handle, + const char *device); + +Remove an LVM logical volume C, where C is +the path to the LV, such as C. + +You can also remove all LVs in a volume group by specifying +the VG name, C. + +This function returns 0 on success or -1 on error. + =head2 guestfs_lvs char **guestfs_lvs (guestfs_h *handle); @@ -627,6 +919,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); @@ -651,6 +981,20 @@ as C. This function returns 0 on success or -1 on error. +=head2 guestfs_pvremove + + int guestfs_pvremove (guestfs_h *handle, + const char *device); + +This wipes a physical volume C so that LVM will no longer +recognise it. + +The implementation uses the C command which refuses to +wipe physical volumes that contain any volume groups, so you have +to remove those first. + +This function returns 0 on success or -1 on error. + =head2 guestfs_pvs char **guestfs_pvs (guestfs_h *handle); @@ -738,6 +1082,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, @@ -755,6 +1110,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, @@ -843,6 +1229,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, @@ -859,8 +1297,8 @@ This function returns 0 on success or -1 on error. char **guestfs_tune2fs_l (guestfs_h *handle, const char *device); -This returns the contents of the ext2 or ext3 filesystem superblock -on C. +This returns the contents of the ext2, ext3 or ext4 filesystem +superblock on C. It is the same as running C. See L manpage for more details. The list of fields returned isn't @@ -894,6 +1332,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, @@ -905,6 +1358,18 @@ from the non-empty list of physical volumes C. This function returns 0 on success or -1 on error. +=head2 guestfs_vgremove + + int guestfs_vgremove (guestfs_h *handle, + const char *vgname); + +Remove an LVM volume group C, (for example C). + +This also forcibly removes all logical volumes in the volume +group (if any). + +This function returns 0 on success or -1 on error. + =head2 guestfs_vgs char **guestfs_vgs (guestfs_h *handle);