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<filename>. This
stops you from specifying other types of drive which are supported
This function returns a string, or NULL on error.
I<The caller must free the returned string after use>.
+=head2 guestfs_df
+
+ char *guestfs_df (guestfs_h *handle);
+
+This command runs the C<df> command to report disk space used.
+
+This command is mostly useful for interactive sessions. It
+is I<not> intended that you try to parse the output string.
+Use C<statvfs> from programs.
+
+This function returns a string, or NULL on error.
+I<The caller must free the returned string after use>.
+
+=head2 guestfs_df_h
+
+ char *guestfs_df_h (guestfs_h *handle);
+
+This command runs the C<df -h> command to report disk space used
+in human-readable format.
+
+This command is mostly useful for interactive sessions. It
+is I<not> intended that you try to parse the output string.
+Use C<statvfs> from programs.
+
+This function returns a string, or NULL on error.
+I<The caller must free the returned string after use>.
+
=head2 guestfs_dmesg
char *guestfs_dmesg (guestfs_h *handle);
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<du -s> command to estimate file space
+usage for C<path>.
+
+C<path> can be a file or a directory. If C<path> is a directory
+then the estimate includes the contents of the directory and all
+subdirectories (recursively).
+
+The result is the estimated size in I<kilobytes>
+(ie. units of 1024 bytes).
+
+On error this function returns -1.
+
=head2 guestfs_e2fsck_f
int guestfs_e2fsck_f (guestfs_h *handle,
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<pattern> 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<glob(3)> function
+with flags C<GLOB_MARK|GLOB_BRACE>.
+See that manual page for more details.
+
+This function returns a NULL-terminated array of strings
+(like L<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
=head2 guestfs_grub_install
int guestfs_grub_install (guestfs_h *handle,
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<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
+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<nrlines> is a positive number, this returns the first
+C<nrlines> lines of the file C<path>.
+
+If the parameter C<nrlines> is a negative number, this returns lines
+from the file C<path>, excluding the last C<nrlines> lines.
+
+If the parameter C<nrlines> is zero, this returns an empty list.
+
+This function returns a NULL-terminated array of strings
+(like L<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
+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,
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<only> support the newer initramfs
+format (compressed cpio files).
+
+This function returns a NULL-terminated array of strings
+(like L<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
=head2 guestfs_is_busy
int guestfs_is_busy (guestfs_h *handle);
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<template> parameter should be a full pathname for the
+temporary directory name with the final six characters being
+"XXXXXX".
+
+For example: "/tmp/myprogXXXXXX" or "/Temp/myprogXXXXXX",
+the second one being suitable for Windows filesystems.
+
+The name of the temporary directory that was created
+is returned.
+
+The temporary directory is created with mode 0700
+and is owned by root.
+
+The caller is responsible for deleting the temporary
+directory and its contents after use.
+
+See also: L<mkdtemp(3)>
+
+This function returns a string, or NULL on error.
+I<The caller must free the returned string after use>.
+
=head2 guestfs_mkfs
int guestfs_mkfs (guestfs_h *handle,
This function returns 0 on success or -1 on error.
+=head2 guestfs_mkswap
+
+ int guestfs_mkswap (guestfs_h *handle,
+ const char *device);
+
+Create a swap partition on C<device>.
+
+This function returns 0 on success or -1 on error.
+
+=head2 guestfs_mkswap_L
+
+ int guestfs_mkswap_L (guestfs_h *handle,
+ const char *label,
+ const char *device);
+
+Create a swap partition on C<device> with label C<label>.
+
+This function returns 0 on success or -1 on error.
+
+=head2 guestfs_mkswap_U
+
+ int guestfs_mkswap_U (guestfs_h *handle,
+ const char *uuid,
+ const char *device);
+
+Create a swap partition on C<device> with UUID C<uuid>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_mount
int guestfs_mount (guestfs_h *handle,
This function returns 0 on success or -1 on error.
+=head2 guestfs_mount_loop
+
+ int guestfs_mount_loop (guestfs_h *handle,
+ const char *file,
+ const char *mountpoint);
+
+This command lets you mount C<file> (a filesystem image
+in a file) on a mount point. It is entirely equivalent to
+the command C<mount -o loop file mountpoint>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_mount_options
int guestfs_mount_options (guestfs_h *handle,
This function returns 0 on success or -1 on error.
+=head2 guestfs_scrub_device
+
+ int guestfs_scrub_device (guestfs_h *handle,
+ const char *device);
+
+This command writes patterns over C<device> to make data retrieval
+more difficult.
+
+It is an interface to the L<scrub(1)> program. See that
+manual page for more details.
+
+This function returns 0 on success or -1 on error.
+
+B<This command is dangerous. Without careful use you
+can easily destroy all your data>.
+
+=head2 guestfs_scrub_file
+
+ int guestfs_scrub_file (guestfs_h *handle,
+ const char *file);
+
+This command writes patterns over a file to make data retrieval
+more difficult.
+
+The file is I<removed> after scrubbing.
+
+It is an interface to the L<scrub(1)> program. See that
+manual page for more details.
+
+This function returns 0 on success or -1 on error.
+
+=head2 guestfs_scrub_freespace
+
+ int guestfs_scrub_freespace (guestfs_h *handle,
+ const char *dir);
+
+This command creates the directory C<dir> and then fills it
+with files until the filesystem is full, and scrubs the files
+as for C<guestfs_scrub_file>, and deletes them.
+The intention is to scrub any free space on the partition
+containing C<dir>.
+
+It is an interface to the L<scrub(1)> program. See that
+manual page for more details.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_set_append
int guestfs_set_append (guestfs_h *handle,
int guestfs_sfdisk_N (guestfs_h *handle,
const char *device,
- int n,
+ int partnum,
int cyls,
int heads,
int sectors,
This function returns 0 on success or -1 on error.
+=head2 guestfs_tail
+
+ char **guestfs_tail (guestfs_h *handle,
+ const char *path);
+
+This command returns up to the last 10 lines of a file as
+a list of strings.
+
+This function returns a NULL-terminated array of strings
+(like L<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
+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_tail_n
+
+ char **guestfs_tail_n (guestfs_h *handle,
+ int nrlines,
+ const char *path);
+
+If the parameter C<nrlines> is a positive number, this returns the last
+C<nrlines> lines of the file C<path>.
+
+If the parameter C<nrlines> is a negative number, this returns lines
+from the file C<path>, starting with the C<-nrlines>th line.
+
+If the parameter C<nrlines> is zero, this returns an empty list.
+
+This function returns a NULL-terminated array of strings
+(like L<environ(3)>), or NULL if there was an error.
+I<The caller must free the strings and the array after use>.
+
+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_tar_in
int guestfs_tar_in (guestfs_h *handle,
This function returns 0 on success or -1 on error.
+=head2 guestfs_wc_c
+
+ int guestfs_wc_c (guestfs_h *handle,
+ const char *path);
+
+This command counts the characters in a file, using the
+C<wc -c> external command.
+
+On error this function returns -1.
+
+=head2 guestfs_wc_l
+
+ int guestfs_wc_l (guestfs_h *handle,
+ const char *path);
+
+This command counts the lines in a file, using the
+C<wc -l> external command.
+
+On error this function returns -1.
+
+=head2 guestfs_wc_w
+
+ int guestfs_wc_w (guestfs_h *handle,
+ const char *path);
+
+This command counts the words in a file, using the
+C<wc -w> external command.
+
+On error this function returns -1.
+
=head2 guestfs_write_file
int guestfs_write_file (guestfs_h *handle,
to securely wipe the device). It should be sufficient to remove
any partition tables, filesystem superblocks and so on.
+See also: C<guestfs_scrub_device>.
+
This function returns 0 on success or -1 on error.
=head2 guestfs_zerofree