X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_actions.ml;h=ce3382fa41e3db1c035695110b17666605ee2d48;hp=26dc64e41cab4718788cc528c20a0ed044d86d8d;hb=47412f137f2b09dbc2b44b78ba84c0b348e3f402;hpb=13d8963d8c0203e1f72c519e5acf79ebf7cccb4c diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 26dc64e..ce3382f 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -113,7 +113,7 @@ using L. You should call this after configuring the handle (eg. adding drives) but before performing any actions."); - ("wait_ready", (RErr, [], []), -1, [NotInFish], + ("wait_ready", (RErr, [], []), -1, [NotInFish; DeprecatedBy "launch"], [], "wait until the qemu subprocess launches (no op)", "\ @@ -155,7 +155,7 @@ and specifying the format."); "\ This function adds a virtual CD-ROM disk image to the guest. -This is equivalent to the qemu parameter C<-cdrom filename>. +This is equivalent to the qemu parameter I<-cdrom filename>. Notes: @@ -190,7 +190,7 @@ automatically."); "add qemu parameters", "\ This can be used to add arbitrary qemu command line parameters -of the form C<-param value>. Actually it's not quite arbitrary - we +of the form I<-param value>. Actually it's not quite arbitrary - we prevent you from setting some parameters which would interfere with parameters that we use. @@ -726,9 +726,6 @@ See also C."); [], "get type of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the type of the inspected operating system. Currently defined types are: @@ -746,6 +743,10 @@ Any Microsoft Windows operating system. FreeBSD. +=item \"netbsd\" + +NetBSD. + =item \"unknown\" The operating system type could not be determined. @@ -761,9 +762,6 @@ Please read L for more details."); [], "get architecture of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the architecture of the inspected operating system. The possible return values are listed under C. @@ -777,9 +775,6 @@ Please read L for more details."); [], "get distro of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the distro (distribution) of the inspected operating system. @@ -791,6 +786,10 @@ Currently defined distros are: Arch Linux. +=item \"centos\" + +CentOS. + =item \"debian\" Debian. @@ -807,6 +806,10 @@ Gentoo. Linux Mint. +=item \"mageia\" + +Mageia. + =item \"mandriva\" Mandriva. @@ -815,6 +818,10 @@ Mandriva. MeeGo. +=item \"opensuse\" + +OpenSUSE. + =item \"pardus\" Pardus. @@ -825,12 +832,20 @@ Some Red Hat-derived distro. =item \"rhel\" -Red Hat Enterprise Linux and some derivatives. +Red Hat Enterprise Linux. + +=item \"scientificlinux\" + +Scientific Linux. =item \"slackware\" Slackware. +=item \"ttylinux\" + +ttylinux. + =item \"ubuntu\" Ubuntu. @@ -855,9 +870,6 @@ Please read L for more details."); [], "get major version of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the major version number of the inspected operating system. @@ -876,9 +888,6 @@ Please read L for more details."); [], "get minor version of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the minor version number of the inspected operating system. @@ -891,9 +900,6 @@ See also C."); [], "get product name of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the product name of the inspected operating system. The product name is generally some freeform string which can be displayed to the user, but should not be @@ -908,9 +914,6 @@ Please read L for more details."); [], "get mountpoints of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns a hash of where we think the filesystems associated with this operating system should be mounted. Callers should note that this is at best an educated guess @@ -941,9 +944,6 @@ See also C."); [], "get filesystems associated with inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns a list of all the filesystems that we think are associated with this operating system. This includes the root filesystem, other ordinary filesystems, and @@ -1007,7 +1007,7 @@ be mountable but require special options. Filesystems may not all belong to a single logical operating system (use C to look for OSes)."); - ("add_drive_opts", (RErr, [String "filename"], [Bool "readonly"; String "format"; String "iface"]), -1, [FishAlias "add"], + ("add_drive_opts", (RErr, [String "filename"], [Bool "readonly"; String "format"; String "iface"; String "name"]), -1, [FishAlias "add"], [], "add an image to examine or modify", "\ @@ -1050,15 +1050,17 @@ this security hole. This rarely-used option lets you emulate the behaviour of the deprecated C call (q.v.) +=item C + +The name the drive had in the original guest, e.g. /dev/sdb. This is used as a +hint to the guest inspection process if it is available. + =back"); ("inspect_get_windows_systemroot", (RString "systemroot", [Device "root"], []), -1, [], [], "get Windows systemroot of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the Windows systemroot of the inspected guest. The systemroot is a directory path such as C. @@ -1088,7 +1090,14 @@ Please read L for more details."); This returns the internal QEMU command line. 'debug' commands are not part of the formal API and can be removed or changed at any time."); - ("add_domain", (RInt "nrdisks", [String "dom"], [String "libvirturi"; Bool "readonly"; String "iface"; Bool "live"]), -1, [FishAlias "domain"], + ("debug_drives", (RStringList "cmdline", [], []), -1, [NotInDocs], + [], + "debug the drives (internal use only)", + "\ +This returns the internal list of drives. 'debug' commands are +not part of the formal API and can be removed or changed at any time."); + + ("add_domain", (RInt "nrdisks", [String "dom"], [String "libvirturi"; Bool "readonly"; String "iface"; Bool "live"; Bool "allowuuid"]), -1, [FishAlias "domain"], [], "add the disk(s) from a named libvirt domain", "\ @@ -1122,6 +1131,11 @@ XML definition. The default (if the flag is omitted) is never to try. See L for more information. +If the C flag is true (default is false) then a UUID +I be passed instead of the domain name. The C string is +treated as a UUID first and looked up, and if that lookup fails +then we treat C as a name as usual. + The other optional parameters are passed directly through to C."); @@ -1165,9 +1179,6 @@ C."); [], "get package format used by the operating system", "\ -This function should only be called with a root device string -as returned by C. - This function and C return the package format and package management tool used by the inspected operating system. For example for Fedora these @@ -1178,7 +1189,8 @@ This returns the string C if we could not determine the package format I if the operating system does not have a real packaging system (eg. Windows). -Possible strings include: C, C, C, C, C. +Possible strings include: +C, C, C, C, C, C. Future versions of libguestfs may return other strings. Please read L for more details."); @@ -1187,9 +1199,6 @@ Please read L for more details."); [], "get package management tool used by the operating system", "\ -This function should only be called with a root device string -as returned by C. - C and this function return the package format and package management tool used by the inspected operating system. For example for Fedora these @@ -1202,7 +1211,7 @@ a real packaging system (eg. Windows). Possible strings include: C, C, C (for all Debian derivatives), -C, C, C, C. +C, C, C, C, C. Future versions of libguestfs may return other strings. Please read L for more details."); @@ -1211,9 +1220,6 @@ Please read L for more details."); [], "get list of applications installed in the operating system", "\ -This function should only be called with a root device string -as returned by C. - Return the list of applications installed in the operating system. I This call works differently from other parts of the @@ -1310,9 +1316,6 @@ Please read L for more details."); [], "get hostname of the operating system", "\ -This function should only be called with a root device string -as returned by C. - This function returns the hostname of the operating system as found by inspection of the guest's configuration files. @@ -1325,9 +1328,6 @@ Please read L for more details."); [], "get format of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the format of the inspected operating system. You can use it to detect install images, live CDs and similar. @@ -1359,9 +1359,6 @@ Please read L for more details."); [], "get live flag for install disk", "\ -This function should only be called with a root device string -as returned by C. - If C returns C (this is an install disk), then this returns true if a live image was detected on the disk. @@ -1372,9 +1369,6 @@ Please read L for more details."); [], "get netinst (network installer) flag for install disk", "\ -This function should only be called with a root device string -as returned by C. - If C returns C (this is an install disk), then this returns true if the disk is a network installer, ie. not a self-contained install CD but @@ -1387,9 +1381,6 @@ Please read L for more details."); [], "get multipart flag for install disk", "\ -This function should only be called with a root device string -as returned by C. - If C returns C (this is an install disk), then this returns true if the disk is part of a set. @@ -1431,9 +1422,6 @@ Return the current attach method. See C."); [], "get product variant of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the product variant of the inspected operating system. @@ -1461,9 +1449,6 @@ C."); [], "get Windows CurrentControlSet of inspected operating system", "\ -This function should only be called with a root device string -as returned by C. - This returns the Windows CurrentControlSet of the inspected guest. The CurrentControlSet is a registry key name such as C. @@ -1477,9 +1462,6 @@ Please read L for more details."); [], "get drive letter mappings", "\ -This function should only be called with a root device string -as returned by C. - This call is useful for Windows which uses a primitive system of assigning drive letters (like \"C:\") to partitions. This inspection API examines the Windows Registry to find out @@ -1509,6 +1491,105 @@ Please read L for more details. See also C, C."); + ("inspect_get_icon", (RBufferOut "icon", [Device "root"], [Bool "favicon"; Bool "highquality"]), -1, [], + [], + "get the icon corresponding to this operating system", + "\ +This function returns an icon corresponding to the inspected +operating system. The icon is returned as a buffer containing a +PNG image (re-encoded to PNG if necessary). + +If it was not possible to get an icon this function returns a +zero-length (non-NULL) buffer. I. + +Libguestfs will start by looking for a file called +C or C +and if it has the correct format, the contents of this file will +be returned. You can disable favicons by passing the +optional C boolean as false (default is true). + +If finding the favicon fails, then we look in other places in the +guest for a suitable icon. + +If the optional C boolean is true then +only high quality icons are returned, which means only icons of +high resolution with an alpha channel. The default (false) is +to return any icon we can, even if it is of substandard quality. + +Notes: + +=over 4 + +=item * + +Unlike most other inspection API calls, the guest's disks must be +mounted up before you call this, since it needs to read information +from the guest filesystem during the call. + +=item * + +B The icon data comes from the untrusted guest, +and should be treated with caution. PNG files have been +known to contain exploits. Ensure that libpng (or other relevant +libraries) are fully up to date before trying to process or +display the icon. + +=item * + +The PNG image returned can be any size. It might not be square. +Libguestfs tries to return the largest, highest quality +icon available. The application must scale the icon to the +required size. + +=item * + +Extracting icons from Windows guests requires the external +C program from the C package, and +several programs (C, C, C) +from the C package. These must be installed separately. + +=item * + +Operating system icons are usually trademarks. Seek legal +advice before using trademarks in applications. + +=back"); + + ("set_pgroup", (RErr, [Bool "pgroup"], []), -1, [FishAlias "pgroup"], + [], + "set process group flag", + "\ +If C is true, child processes are placed into +their own process group. + +The practical upshot of this is that signals like C (from +users pressing C<^C>) won't be received by the child process. + +The default for this flag is false, because usually you want +C<^C> to kill the subprocess."); + + ("get_pgroup", (RBool "pgroup", [], []), -1, [], + [], + "get process group flag", + "\ +This returns the process group flag."); + + ("set_smp", (RErr, [Int "smp"], []), -1, [FishAlias "smp"], + [], + "set number of virtual CPUs in appliance", + "\ +Change the number of virtual CPUs assigned to the appliance. The +default is C<1>. Increasing this may improve performance, though +often it has no effect. + +This function must be called before C."); + + ("get_smp", (RInt "smp", [], []), -1, [], + [], + "get number of virtual CPUs in appliance", + "\ +This returns the number of virtual CPUs assigned to the appliance."); + ] (* daemon_functions are any functions which cause some action @@ -1539,15 +1620,12 @@ exist. The mounted filesystem is writable, if we have sufficient permissions on the underlying device. -B -When you use this call, the filesystem options C and C -are set implicitly. This was originally done because we thought it -would improve reliability, but it turns out that I<-o sync> has a -very large negative performance impact and negligible effect on -reliability. Therefore we recommend that you avoid using -C in any code that needs performance, and instead -use C (use an empty string for the first -parameter if you don't want any options)."); +Before libguestfs 1.13.16, this call implicitly added the options +C and C. The C option greatly slowed +writes and caused many problems for users. If your program +might need to work with older versions of libguestfs, use +C instead (using an empty string for the +first parameter if you don't want any options)."); ("sync", (RErr, [], []), 2, [], [ InitEmpty, Always, TestRun [["sync"]]], @@ -1785,7 +1863,12 @@ do not overwrite original. Overrides C. =item C = 4 -Typecheck lenses (can be expensive). +Typecheck lenses. + +This option is only useful when debugging Augeas lenses. Use +of this option may require additional memory for the libguestfs +appliance. You may need to set the C +environment variable or call C. =item C = 8 @@ -2124,7 +2207,7 @@ example C."); ("sfdisk", (RErr, [Device "device"; Int "cyls"; Int "heads"; Int "sectors"; - StringList "lines"], []), 43, [DangerWillRobinson], + StringList "lines"], []), 43, [DangerWillRobinson; DeprecatedBy "part_add"], [], "create partitions on a block device", "\ @@ -2253,17 +2336,14 @@ of compressed file. The exact command which runs is C. Note in particular that the filename is not prepended to the output -(the C<-b> option). +(the I<-b> option). -This command can also be used on C devices -(and partitions, LV names). You can for example use this -to determine if a device contains a filesystem, although -it's usually better to use C. +The output depends on the output of the underlying L +command and it can change in future in ways beyond our control. +In other words, the output is not guaranteed by the ABI. -If the C does not begin with C then -this command only works for the content of regular files. -For other file types (directory, symbolic link etc) it -will just return the string C etc."); +See also: L, C, C, +C, C (etc), C."); ("command", (RString "output", [StringList "arguments"], []), 50, [ProtocolLimitWarning], [InitScratchFS, Always, TestOutput ( @@ -2957,10 +3037,9 @@ Checking or repairing NTFS volumes is not supported This command is entirely equivalent to running C."); ("zero", (RErr, [Device "device"], []), 85, [Progress], - [InitBasicFS, Always, TestOutput ( + [InitBasicFS, Always, TestRun ( [["umount"; "/dev/sda1"]; - ["zero"; "/dev/sda1"]; - ["file"; "/dev/sda1"]], "data")], + ["zero"; "/dev/sda1"]])], "write zeroes to the device", "\ This command writes zeroes over the first few blocks of C. @@ -2969,9 +3048,14 @@ How many blocks are zeroed isn't specified (but it's I enough to securely wipe the device). It should be sufficient to remove any partition tables, filesystem superblocks and so on. -See also: C, C."); +If blocks are already zero, then this command avoids writing +zeroes. This prevents the underlying device from becoming non-sparse +or growing unnecessarily. - ("grub_install", (RErr, [Pathname "root"; Device "device"], []), 86, [], +See also: C, C, +C"); + + ("grub_install", (RErr, [Pathname "root"; Device "device"], []), 86, [Optional "grub"], (* See: * https://bugzilla.redhat.com/show_bug.cgi?id=484986 * https://bugzilla.redhat.com/show_bug.cgi?id=479760 @@ -2981,12 +3065,32 @@ See also: C, C."); ["write"; "/boot/grub/device.map"; "(hd0) /dev/vda"]; ["grub_install"; "/"; "/dev/vda"]; ["is_dir"; "/boot"]])], - "install GRUB", + "install GRUB 1", "\ -This command installs GRUB (the Grand Unified Bootloader) on +This command installs GRUB 1 (the Grand Unified Bootloader) on C, with the root directory being C. -Note: If grub-install reports the error +Notes: + +=over 4 + +=item * + +There is currently no way in the API to install grub2, which +is used by most modern Linux guests. It is possible to run +the grub2 command from the guest, although see the +caveats in L. + +=item * + +This uses C from the host. Unfortunately grub is +not always compatible with itself, so this only works in rather +narrow circumstances. Careful testing with each guest version +is advisable. + +=item * + +If grub-install reports the error \"No suitable drive was found in the generated device map.\" it may be that you need to create a C file first that contains the mapping between grub device names @@ -2995,7 +3099,9 @@ a file containing: (hd0) /dev/vda -replacing C with the name of the installation device."); +replacing C with the name of the installation device. + +=back"); ("cp", (RErr, [Pathname "src"; Pathname "dest"], []), 87, [], [InitScratchFS, Always, TestOutput ( @@ -3215,7 +3321,7 @@ volume to match the new size of the underlying device."); ("sfdisk_N", (RErr, [Device "device"; Int "partnum"; Int "cyls"; Int "heads"; Int "sectors"; - String "line"], []), 99, [DangerWillRobinson], + String "line"], []), 99, [DangerWillRobinson; DeprecatedBy "part_add"], [], "modify a single partition on a block device", "\ @@ -3227,7 +3333,7 @@ pass C<0> for the cyls/heads/sectors parameters. See also: C"); - ("sfdisk_l", (RString "partitions", [Device "device"], []), 100, [], + ("sfdisk_l", (RString "partitions", [Device "device"], []), 100, [DeprecatedBy "part_list"], [], "display the partition table", "\ @@ -3264,9 +3370,6 @@ be parsed."); "\ This command activates or (if C is false) deactivates all logical volumes in all volume groups. -If activated, then they are made known to the -kernel, ie. they appear as C devices. If deactivated, -then those devices disappear. This command is the same as running C"); @@ -3276,9 +3379,6 @@ This command is the same as running C"); "\ This command activates or (if C is false) deactivates all logical volumes in the listed volume groups C. -If activated, then they are made known to the -kernel, ie. they appear as C devices. If deactivated, -then those devices disappear. This command is the same as running C @@ -3372,8 +3472,8 @@ See also C."); "check an ext2/ext3 filesystem", "\ This runs C, ie. runs the ext2/ext3 -filesystem checker on C, noninteractively (C<-p>), -even if the filesystem appears to be clean (C<-f>). +filesystem checker on C, noninteractively (I<-p>), +even if the filesystem appears to be clean (I<-f>). This command is only needed because of C (q.v.). Normally you should use C."); @@ -3846,7 +3946,7 @@ This function is primarily intended for use by programs. To get a simple list of names, use C. To get a printable directory for human consumption, use C."); - ("sfdiskM", (RErr, [Device "device"; StringList "lines"], []), 139, [DangerWillRobinson], + ("sfdiskM", (RErr, [Device "device"; StringList "lines"], []), 139, [DangerWillRobinson; DeprecatedBy "part_add"], [], "create partitions on a block device", "\ @@ -4149,7 +4249,7 @@ This command creates a hard link using the C command."); "create a hard link", "\ This command creates a hard link using the C command. -The C<-f> option removes the link (C) if it exists already."); +The I<-f> option removes the link (C) if it exists already."); ("ln_s", (RErr, [String "target"; Pathname "linkname"], []), 166, [], [InitScratchFS, Always, TestOutputStruct ( @@ -4170,7 +4270,7 @@ This command creates a symbolic link using the C command."); "create a symbolic link", "\ This command creates a symbolic link using the C command, -The C<-f> option removes the link (C) if it exists already."); +The I<-f> option removes the link (C) if it exists already."); ("readlink", (RString "link", [Pathname "path"], []), 168, [], [] (* XXX tested above *), @@ -4816,7 +4916,9 @@ Possible values for C are: =over 4 -=item B | B +=item B + +=item B Intel EFI / GPT partition table. @@ -4824,7 +4926,9 @@ This is recommended for >= 2 TB partitions that will be accessed from Linux and Intel-based Mac OS X. It also has limited backwards compatibility with the C format. -=item B | B +=item B + +=item B The standard PC \"Master Boot Record\" (MBR) format used by MS-DOS and Windows. This partition type will B work @@ -4842,7 +4946,9 @@ supported include: AIX disk labels. -=item B | B +=item B + +=item B Amiga \"Rigid Disk Block\" format. @@ -5191,7 +5297,11 @@ is not large enough."); "\ This command writes zeroes over the entire C. Compare with C which just zeroes the first few blocks of -a device."); +a device. + +If blocks are already zero, then this command avoids writing +zeroes. This prevents the underlying device from becoming non-sparse +or growing unnecessarily."); ("txz_in", (RErr, [FileIn "tarball"; Pathname "directory"], []), 229, [Optional "xz"], [InitScratchFS, Always, TestOutput ( @@ -5210,12 +5320,21 @@ I tar file) into C."); This command packs the contents of C and downloads it to local file C (as an xz compressed tar archive)."); - ("ntfsresize", (RErr, [Device "device"], []), 231, [Optional "ntfsprogs"], + ("ntfsresize", (RErr, [Device "device"], []), 231, [Optional "ntfsprogs"; DeprecatedBy "ntfsresize_opts"], [], "resize an NTFS filesystem", "\ This command resizes an NTFS filesystem, expanding or shrinking it to the size of the underlying device. + +I After the resize operation, the filesystem is marked +as requiring a consistency check (for safety). You have to boot +into Windows to perform this check and clear this condition. +Furthermore, ntfsresize refuses to resize filesystems +which have been marked in this way. So in effect it is +not possible to call ntfsresize multiple times on a single +filesystem without booting into Windows between each resize. + See also L."); ("vgscan", (RErr, [], []), 232, [], @@ -5397,7 +5516,9 @@ to ensure the length of the file is exactly C bytes."); "create a new file", "\ This call creates a file called C. The content of the -file is the string C (which can contain any 8 bit data)."); +file is the string C (which can contain any 8 bit data). + +See also C."); ("pwrite", (RInt "nbytes", [Pathname "path"; BufferIn "content"; Int64 "offset"], []), 247, [ProtocolLimitWarning], [InitScratchFS, Always, TestOutput ( @@ -5439,7 +5560,7 @@ allows you to specify the new size (in bytes) explicitly."); This command is the same as C except that it allows you to specify the new size (in bytes) explicitly."); - ("ntfsresize_size", (RErr, [Device "device"; Int64 "size"], []), 250, [Optional "ntfsprogs"], + ("ntfsresize_size", (RErr, [Device "device"; Int64 "size"], []), 250, [Optional "ntfsprogs"; DeprecatedBy "ntfsresize_opts"], [], "resize an NTFS filesystem (with size)", "\ @@ -5566,7 +5687,10 @@ encrypted to the underlying C respectively. If this block device contains LVM volume groups, then calling C followed by C -will make them visible."); +will make them visible. + +Use C to list all device mapper +devices."); ("luks_open_ro", (RErr, [Device "device"; Key "key"; String "mapname"], []), 258, [Optional "luks"], [], @@ -5726,7 +5850,9 @@ removes the partition number, returning the device name (eg. \"/dev/sdb\"). The named partition must exist, for example as a string returned -from C."); +from C. + +See also C."); ("upload_offset", (RErr, [FileIn "filename"; Dev_or_Path "remotefilename"; Int64 "offset"], []), 273, [Progress], (let md5 = Digest.to_hex (Digest.file "COPYING.LIB") in @@ -5824,10 +5950,10 @@ not refer to a logical volume. See also C."); - ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"; String "features"]), 278, [], + ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"; String "features"; Int "inode"; Int "sectorsize"]), 278, [], [InitEmpty, Always, TestOutput ( [["part_disk"; "/dev/sda"; "mbr"]; - ["mkfs_opts"; "ext2"; "/dev/sda1"; "4096"; ""]; + ["mkfs_opts"; "ext2"; "/dev/sda1"; ""; "NOARG"; ""; ""]; ["mount_options"; ""; "/dev/sda1"; "/"]; ["write"; "/new"; "new file contents"]; ["cat"; "/new"]], "new file contents")], @@ -5853,7 +5979,7 @@ For UFS block sizes, please see L. =item C -This passes the C<-O> parameter to the external mkfs program. +This passes the I<-O> parameter to the external mkfs program. For certain filesystem types, this allows extra filesystem features to be selected. See L and L @@ -5862,6 +5988,16 @@ for more details. You cannot use this optional parameter with the C or C filesystem type. +=item C + +This passes the I<-I> parameter to the external L program +which sets the inode size (only for ext2/3/4 filesystems at present). + +=item C + +This passes the I<-S> parameter to external L program, +which sets sector size for ufs filesystem. + =back"); ("getxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 279, [Optional "linuxxattrs"], @@ -5909,7 +6045,7 @@ See also: C, C, L."); "resize an ext2, ext3 or ext4 filesystem to the minimum size", "\ This command is the same as C, but the filesystem -is resized to its minimum size. This works like the C<-M> option +is resized to its minimum size. This works like the I<-M> option to the C command. To get the resulting size of the filesystem you should call @@ -5927,6 +6063,170 @@ Instead, use the autosync flag (C) to control whether or not this operation is performed when the handle is closed."); + ("is_zero", (RBool "zeroflag", [Pathname "path"], []), 283, [], + [InitISOFS, Always, TestOutputTrue ( + [["is_zero"; "/100kallzeroes"]]); + InitISOFS, Always, TestOutputFalse ( + [["is_zero"; "/100kallspaces"]])], + "test if a file contains all zero bytes", + "\ +This returns true iff the file exists and the file is empty or +it contains all zero bytes."); + + ("is_zero_device", (RBool "zeroflag", [Device "device"], []), 284, [], + [InitBasicFS, Always, TestOutputTrue ( + [["umount"; "/dev/sda1"]; + ["zero_device"; "/dev/sda1"]; + ["is_zero_device"; "/dev/sda1"]]); + InitBasicFS, Always, TestOutputFalse ( + [["is_zero_device"; "/dev/sda1"]])], + "test if a device contains all zero bytes", + "\ +This returns true iff the device exists and contains all zero bytes. + +Note that for large devices this can take a long time to run."); + + ("list_9p", (RStringList "mounttags", [], []), 285, [], + [], + "list 9p filesystems", + "\ +List all 9p filesystems attached to the guest. A list of +mount tags is returned."); + + ("mount_9p", (RErr, [String "mounttag"; String "mountpoint"], [String "options"]), 286, [], + [], + "mount 9p filesystem", + "\ +Mount the virtio-9p filesystem with the tag C on the +directory C. + +If required, C will be automatically added to the options. +Any other options required can be passed in the optional C +parameter."); + + ("list_dm_devices", (RStringList "devices", [], []), 287, [], + [], + "list device mapper devices", + "\ +List all device mapper devices. + +The returned list contains C devices, eg. ones created +by a previous call to C. + +Device mapper devices which correspond to logical volumes are I +returned in this list. Call C if you want to list logical +volumes."); + + ("ntfsresize_opts", (RErr, [Device "device"], [Int64 "size"; Bool "force"]), 288, [Optional "ntfsprogs"], + [], + "resize an NTFS filesystem", + "\ +This command resizes an NTFS filesystem, expanding or +shrinking it to the size of the underlying device. + +The optional parameters are: + +=over 4 + +=item C + +The new size (in bytes) of the filesystem. If omitted, the filesystem +is resized to fit the container (eg. partition). + +=item C + +If this option is true, then force the resize of the filesystem +even if the filesystem is marked as requiring a consistency check. + +After the resize operation, the filesystem is always marked +as requiring a consistency check (for safety). You have to boot +into Windows to perform this check and clear this condition. +If you I set the C option then it is not +possible to call C multiple times on a +single filesystem without booting into Windows between each resize. + +=back + +See also L."); + + ("btrfs_filesystem_resize", (RErr, [Pathname "mountpoint"], [Int64 "size"]), 289, [Optional "btrfs"], + [], + "resize a btrfs filesystem", + "\ +This command resizes a btrfs filesystem. + +Note that unlike other resize calls, the filesystem has to be +mounted and the parameter is the mountpoint not the device +(this is a requirement of btrfs itself). + +The optional parameters are: + +=over 4 + +=item C + +The new size (in bytes) of the filesystem. If omitted, the filesystem +is resized to the maximum size. + +=back + +See also L."); + + ("write_append", (RErr, [Pathname "path"; BufferIn "content"], []), 290, [ProtocolLimitWarning], + [InitScratchFS, Always, TestOutput ( + [["write"; "/write_append"; "line1\n"]; + ["write_append"; "/write_append"; "line2\n"]; + ["write_append"; "/write_append"; "line3a"]; + ["write_append"; "/write_append"; "line3b\n"]; + ["cat"; "/write_append"]], "line1\nline2\nline3aline3b\n")], + "append content to end of file", + "\ +This call appends C to the end of file C. If +C does not exist, then a new file is created. + +See also C."); + + ("compress_out", (RErr, [String "ctype"; Pathname "file"; FileOut "zfile"], [Int "level"]), 291, [], + [], + "output compressed file", + "\ +This command compresses C and writes it out to the local +file C. + +The compression program used is controlled by the C parameter. +Currently this includes: C, C, C, C or C. +Some compression types may not be supported by particular builds of +libguestfs, in which case you will get an error containing the +substring \"not supported\". + +The optional C parameter controls compression level. The +meaning and default for this parameter depends on the compression +program being used."); + + ("compress_device_out", (RErr, [String "ctype"; Device "device"; FileOut "zdevice"], [Int "level"]), 292, [], + [], + "output compressed device", + "\ +This command compresses C and writes it out to the local +file C. + +The C and optional C parameters have the same meaning +as in C."); + + ("part_to_partnum", (RInt "partnum", [Device "partition"], []), 293, [], + [InitPartition, Always, TestOutputInt ( + [["part_to_partnum"; "/dev/sda1"]], 1); + InitEmpty, Always, TestLastFail ( + [["part_to_partnum"; "/dev/sda"]])], + "convert partition name to partition number", + "\ +This function takes a partition name (eg. \"/dev/sdb1\") and +returns the partition number (eg. C<1>). + +The named partition must exist, for example as a string returned +from C. + +See also C."); ] let all_functions = non_daemon_functions @ daemon_functions @@ -6005,6 +6305,20 @@ them with the help of L like this: glob copy-out /home/* ."); + ("display", (RErr,[], []), -1, [], [], + "display an image", + " display filename + +Use C (a graphical display program) to display an image +file. It downloads the file, and runs C on it. + +To use an alternative program, set the C +environment variable. For example to use the GNOME display program: + + export GUESTFISH_DISPLAY_IMAGE=eog + +See also L."); + ("echo", (RErr,[], []), -1, [], [], "display a line of text", " echo [params ...] @@ -6101,6 +6415,17 @@ Close and reopen the libguestfs handle. It is not necessary to use this normally, because the handle is closed properly when guestfish exits. However this is occasionally useful for testing."); + ("setenv", (RErr,[], []), -1, [], [], + "set an environment variable", + " setenv VAR value + +Set the environment variable C to the string C. + +To print the value of an environment variable use a shell command +such as: + + !echo $VAR"); + ("sparse", (RErr,[], []), -1, [], [], "create a sparse disk image and add", " sparse filename size @@ -6135,4 +6460,10 @@ See also L."); Run the command as usual, but print the elapsed time afterwards. This can be useful for benchmarking operations."); + ("unsetenv", (RErr,[], []), -1, [], [], + "unset an environment variable", + " unsetenv VAR + +Remove C from the environment."); + ]