Rewrite of main loop impl, start of FileIn/FileOut support.
[libguestfs.git] / guestfish-actions.pod
index 50ecfec..116878d 100644 (file)
@@ -182,6 +182,105 @@ how files are saved.
 
 Set the value associated with C<path> to C<value>.
 
+=head2 blockdev-flushbufs
+
+ blockdev-flushbufs device
+
+This tells the kernel to flush internal buffers associated
+with C<device>.
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-getbsz
+
+ blockdev-getbsz 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.
+
+=head2 blockdev-getro
+
+ blockdev-getro 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.
+
+=head2 blockdev-getsize64
+
+ blockdev-getsize64 device
+
+This returns the size of the device in bytes.
+
+See also C<blockdev_getsz>.
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-getss
+
+ blockdev-getss 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<blockdev_getsz>
+for that).
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-getsz
+
+ blockdev-getsz 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<blockdev_getss> for the real sector size of
+the device, and C<blockdev_getsize64> for the more
+useful I<size in bytes>.
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-rereadpt
+
+ blockdev-rereadpt device
+
+Reread the partition table on C<device>.
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-setbsz
+
+ blockdev-setbsz device 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.
+
+=head2 blockdev-setro
+
+ blockdev-setro device
+
+Sets the block device named C<device> to read-only.
+
+This uses the L<blockdev(8)> command.
+
+=head2 blockdev-setrw
+
+ blockdev-setrw device
+
+Sets the block device named C<device> to read-write.
+
+This uses the L<blockdev(8)> command.
+
 =head2 cat
 
  cat path
@@ -190,7 +289,7 @@ Return the contents of the file named C<path>.
 
 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<read_file>
+as end of string).  For those you need to use the C<download>
 function which has a more complex interface.
 
 Because of the message protocol, there is a transfer limit 
@@ -214,6 +313,38 @@ Only numeric uid and gid are supported.  If you want to use
 names, you will need to locate and parse the password file
 yourself (Augeas support makes this relatively easy).
 
+=head2 command
+
+ command 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</usr/bin> and C</bin>.  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.
+
+=head2 command-lines
+
+ command-lines arguments,...
+
+This is the same as C<command>, but splits the
+result into a list of lines.
+
 =head2 config
 
  config qemuparam qemuvalue
@@ -236,6 +367,18 @@ This returns C<true> if and only if there is a file, directory
 
 See also C<is_file>, C<is_dir>, C<stat>.
 
+=head2 file
+
+ file path
+
+This call uses the standard L<file(1)> command to determine
+the type or contents of the file.  This also works on devices,
+for example to find out whether a partition contains a filesystem.
+
+The exact command which runs is C<file -bsL path>.  Note in
+particular that the filename is not prepended to the output
+(the C<-b> option).
+
 =head2 get-autosync
 
  get-autosync
@@ -333,6 +476,18 @@ hidden files are shown.
 This command is mostly useful for interactive sessions.  Programs
 should probably use C<readdir> instead.
 
+=head2 lstat
+
+ lstat path
+
+Returns file information for the given C<path>.
+
+This is the same as C<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.
+
 =head2 lvcreate
 
  lvcreate logvol volgroup mbytes
@@ -539,6 +694,24 @@ the string C<,> (comma).
 B<This command is dangerous.  Without careful use you
 can easily destroy all your data>.
 
+=head2 stat
+
+ stat path
+
+Returns file information for the given C<path>.
+
+This is the same as the C<stat(2)> system call.
+
+=head2 statvfs
+
+ statvfs 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.
+
 =head2 sync
 
  sync
@@ -557,6 +730,18 @@ Touch acts like the L<touch(1)> command.  It can be used to
 update the timestamps on a file, or, if the file does not exist,
 to create a new zero-length file.
 
+=head2 tune2fs-l
+
+ tune2fs-l 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.
+
 =head2 umount | unmount
 
  umount pathordevice