number of nodes in the nodeset, and a boolean flag
if a node was created.
-This function returns a C<struct guestfs_int_bool *>.
+This function returns a C<struct guestfs_int_bool *>,
+or NULL if there was an error.
I<The caller must call C<guestfs_free_int_bool> after use>.
=head2 guestfs_aug_defvar
Look up the value associated with C<path>. If C<path>
matches exactly one node, the C<value> is returned.
-This function returns a string or NULL on error.
+This function returns a string, or NULL on error.
I<The caller must free the returned string after use>.
=head2 guestfs_aug_init
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<device>.
+
+This uses the L<blockdev(8)> 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<size in blocks> and
+I<filesystem block size>).
+
+This uses the L<blockdev(8)> 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<blockdev(8)> 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<guestfs_blockdev_getsz>.
+
+This uses the L<blockdev(8)> 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<guestfs_blockdev_getsz>
+for that).
+
+This uses the L<blockdev(8)> 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<guestfs_blockdev_getss> for the real sector size of
+the device, and C<guestfs_blockdev_getsize64> for the more
+useful I<size in bytes>.
+
+This uses the L<blockdev(8)> 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<device>.
+
+This uses the L<blockdev(8)> 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<size in blocks> and
+I<filesystem block size>).
+
+This uses the L<blockdev(8)> 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<device> to read-only.
+
+This uses the L<blockdev(8)> 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<device> to read-write.
+
+This uses the L<blockdev(8)> command.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_cat
char *guestfs_cat (guestfs_h *handle,
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<guestfs_read_file>
+as end of string). For those you need to use the C<guestfs_download>
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<The caller must free the returned string after use>.
Because of the message protocol, there is a transfer limit
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).
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<The caller must free the returned string after use>.
=head2 guestfs_command_lines
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<remotefilename> and save it as C<filename>
+on the local machine.
+
+C<filename> can also be a named pipe.
+
+See also C<guestfs_upload>, C<guestfs_cat>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_exists
int guestfs_exists (guestfs_h *handle,
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<The caller must free the returned string after use>.
=head2 guestfs_get_autosync
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<not> 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<guestfs(3)>.
+
+On error this function returns -1.
+
=head2 guestfs_get_verbose
int guestfs_get_verbose (guestfs_h *handle);
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<BUSY> state).
+
+For more information on states, see L<guestfs(3)>.
+
+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<CONFIG> state).
+
+For more information on states, see L<guestfs(3)>.
+
+This function returns a C truth value on success or -1 on error.
+
=head2 guestfs_is_dir
int guestfs_is_dir (guestfs_h *handle,
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<LAUNCHING> state).
+
+For more information on states, see L<guestfs(3)>.
+
+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<READY> state).
+
+For more information on states, see L<guestfs(3)>.
+
+This function returns a C truth value on success or -1 on error.
+
=head2 guestfs_kill_subprocess
int guestfs_kill_subprocess (guestfs_h *handle);
This command is mostly useful for interactive sessions. It
is I<not> 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<The caller must free the returned string after use>.
=head2 guestfs_ls
(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_lstat
+
+ struct guestfs_stat *guestfs_lstat (guestfs_h *handle,
+ const char *path);
+
+Returns file information for the given C<path>.
+
+This is the same as C<guestfs_stat> except that if C<path>
+is a symbolic link, then the link is stat-ed, not the file it
+refers to.
+
+This is the same as the C<lstat(2)> system call.
+
+This function returns a C<struct guestfs_stat *>
+(see L<stat(2)> and E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
+I<The caller must call C<free> after use>.
+
=head2 guestfs_lvcreate
int guestfs_lvcreate (guestfs_h *handle,
List all the logical volumes detected. This is the equivalent
of the L<lvs(8)> command. The "full" version includes all fields.
-This function returns a C<struct guestfs_lvm_lv_list *>.
+This function returns a C<struct guestfs_lvm_lv_list *>
+(see E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
I<The caller must call C<guestfs_free_lvm_lv_list> after use>.
=head2 guestfs_mkdir
List all the physical volumes detected. This is the equivalent
of the L<pvs(8)> command. The "full" version includes all fields.
-This function returns a C<struct guestfs_lvm_pv_list *>.
+This function returns a C<struct guestfs_lvm_pv_list *>
+(see E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
I<The caller must call C<guestfs_free_lvm_pv_list> after use>.
=head2 guestfs_read_lines
B<This command is dangerous. Without careful use you
can easily destroy all your data>.
+=head2 guestfs_stat
+
+ struct guestfs_stat *guestfs_stat (guestfs_h *handle,
+ const char *path);
+
+Returns file information for the given C<path>.
+
+This is the same as the C<stat(2)> system call.
+
+This function returns a C<struct guestfs_stat *>
+(see L<stat(2)> and E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
+I<The caller must call C<free> 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<path> 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<statvfs(2)> system call.
+
+This function returns a C<struct guestfs_statvfs *>
+(see L<statvfs(2)> and E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
+I<The caller must call C<free> after use>.
+
=head2 guestfs_sync
int guestfs_sync (guestfs_h *handle);
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<device>.
+
+It is the same as running C<tune2fs -l device>. See L<tune2fs(8)>
+manpage for more details. The list of fields returned isn't
+clearly defined, and depends on both the version of C<tune2fs>
+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<n> keys and values alternate, followed by the trailing NULL entry.
+I<The caller must free the strings and the array after use>.
+
=head2 guestfs_umount
int guestfs_umount (guestfs_h *handle,
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<filename> to C<remotefilename> on the
+filesystem.
+
+C<filename> can also be a named pipe.
+
+See also C<guestfs_download>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_vgcreate
int guestfs_vgcreate (guestfs_h *handle,
List all the volumes groups detected. This is the equivalent
of the L<vgs(8)> command. The "full" version includes all fields.
-This function returns a C<struct guestfs_lvm_vg_list *>.
+This function returns a C<struct guestfs_lvm_vg_list *>
+(see E<lt>guestfs-structs.hE<gt>),
+or NULL if there was an error.
I<The caller must call C<guestfs_free_lvm_vg_list> after use>.
=head2 guestfs_wait_ready