Rewrite of main loop impl, start of FileIn/FileOut support.
[libguestfs.git] / perl / lib / Sys / Guestfs.pm
index c9caf08..28d2b0f 100644 (file)
@@ -245,13 +245,92 @@ how files are saved.
 
 Set the value associated with C<path> to C<value>.
 
+=item $h->blockdev_flushbufs ($device);
+
+This tells the kernel to flush internal buffers associated
+with C<device>.
+
+This uses the L<blockdev(8)> command.
+
+=item $blocksize = $h->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.
+
+=item $ro = $h->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.
+
+=item $sizeinbytes = $h->blockdev_getsize64 ($device);
+
+This returns the size of the device in bytes.
+
+See also C<$h-E<gt>blockdev_getsz>.
+
+This uses the L<blockdev(8)> command.
+
+=item $sectorsize = $h->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<$h-E<gt>blockdev_getsz>
+for that).
+
+This uses the L<blockdev(8)> command.
+
+=item $sizeinsectors = $h->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<$h-E<gt>blockdev_getss> for the real sector size of
+the device, and C<$h-E<gt>blockdev_getsize64> for the more
+useful I<size in bytes>.
+
+This uses the L<blockdev(8)> command.
+
+=item $h->blockdev_rereadpt ($device);
+
+Reread the partition table on C<device>.
+
+This uses the L<blockdev(8)> command.
+
+=item $h->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.
+
+=item $h->blockdev_setro ($device);
+
+Sets the block device named C<device> to read-only.
+
+This uses the L<blockdev(8)> command.
+
+=item $h->blockdev_setrw ($device);
+
+Sets the block device named C<device> to read-write.
+
+This uses the L<blockdev(8)> command.
+
 =item $content = $h->cat ($path);
 
 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<$h-E<gt>read_file>
+as end of string).  For those you need to use the C<$h-E<gt>download>
 function which has a more complex interface.
 
 Because of the message protocol, there is a transfer limit 
@@ -402,6 +481,16 @@ hidden files are shown.
 This command is mostly useful for interactive sessions.  Programs
 should probably use C<$h-E<gt>readdir> instead.
 
+=item %statbuf = $h->lstat ($path);
+
+Returns file information for the given C<path>.
+
+This is the same as C<$h-E<gt>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.
+
 =item $h->lvcreate ($logvol, $volgroup, $mbytes);
 
 This creates an LVM volume group called C<logvol>
@@ -568,6 +657,20 @@ the string C<,> (comma).
 B<This command is dangerous.  Without careful use you
 can easily destroy all your data>.
 
+=item %statbuf = $h->stat ($path);
+
+Returns file information for the given C<path>.
+
+This is the same as the C<stat(2)> system call.
+
+=item %statbuf = $h->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.
+
 =item $h->sync ();
 
 This syncs the disk, so that any writes are flushed through to the
@@ -582,6 +685,16 @@ 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.
 
+=item %superblock = $h->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.
+
 =item $h->umount ($pathordevice);
 
 This unmounts the given filesystem.  The filesystem may be