X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=perl%2Flib%2FSys%2FGuestfs.pm;h=28d2b0fa41ccf82e19bcb8175b22e27ace632b3e;hp=9d050b47308207790070aa94bbcd6978c8eb4d60;hb=1765330e07a48dc6f7bdef7007f69ebe606fa731;hpb=adefe14e308a0f8cf73f9c60693a3dbbded157b9 diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index 9d050b4..28d2b0f 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -245,13 +245,92 @@ how files are saved. Set the value associated with C to C. +=item $h->blockdev_flushbufs ($device); + +This tells the kernel to flush internal buffers associated +with C. + +This uses the L command. + +=item $blocksize = $h->blockdev_getbsz ($device); + +This returns the block size of a device. + +(Note this is different from both I and +I). + +This uses the L 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 command. + +=item $sizeinbytes = $h->blockdev_getsize64 ($device); + +This returns the size of the device in bytes. + +See also C<$h-Eblockdev_getsz>. + +This uses the L 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-Eblockdev_getsz> +for that). + +This uses the L 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-Eblockdev_getss> for the real sector size of +the device, and C<$h-Eblockdev_getsize64> for the more +useful I. + +This uses the L command. + +=item $h->blockdev_rereadpt ($device); + +Reread the partition table on C. + +This uses the L command. + +=item $h->blockdev_setbsz ($device, $blocksize); + +This sets the block size of a device. + +(Note this is different from both I and +I). + +This uses the L command. + +=item $h->blockdev_setro ($device); + +Sets the block device named C to read-only. + +This uses the L command. + +=item $h->blockdev_setrw ($device); + +Sets the block device named C to read-write. + +This uses the L command. + =item $content = $h->cat ($path); 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<$h-Eread_file> +as end of string). For those you need to use the C<$h-Edownload> function which has a more complex interface. Because of the message protocol, there is a transfer limit @@ -271,6 +350,34 @@ 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). +=item $output = $h->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 and C. 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. + +=item @lines = $h->command_lines (\@arguments); + +This is the same as C<$h-Ecommand>, but splits the +result into a list of lines. + =item $h->config ($qemuparam, $qemuvalue); This can be used to add arbitrary qemu command line parameters @@ -374,6 +481,16 @@ hidden files are shown. This command is mostly useful for interactive sessions. Programs should probably use C<$h-Ereaddir> instead. +=item %statbuf = $h->lstat ($path); + +Returns file information for the given C. + +This is the same as C<$h-Estat> except that if C +is a symbolic link, then the link is stat-ed, not the file it +refers to. + +This is the same as the C system call. + =item $h->lvcreate ($logvol, $volgroup, $mbytes); This creates an LVM volume group called C @@ -540,6 +657,20 @@ the string C<,> (comma). B. +=item %statbuf = $h->stat ($path); + +Returns file information for the given C. + +This is the same as the C system call. + +=item %statbuf = $h->statvfs ($path); + +Returns file system statistics for any mounted file system. +C 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 system call. + =item $h->sync (); This syncs the disk, so that any writes are flushed through to the @@ -554,6 +685,16 @@ Touch acts like the L 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. + +It is the same as running C. See L +manpage for more details. The list of fields returned isn't +clearly defined, and depends on both the version of C +that libguestfs was built against, and the filesystem itself. + =item $h->umount ($pathordevice); This unmounts the given filesystem. The filesystem may be