+ ("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<mounttag> on the
+directory C<mountpoint>.
+
+If required, C<trans=virtio> will be automatically added to the options.
+Any other options required can be passed in the optional C<options>
+parameter.");
+
+ ("list_dm_devices", (RStringList "devices", [], []), 287, [],
+ [],
+ "list device mapper devices",
+ "\
+List all device mapper devices.
+
+The returned list contains C</dev/mapper/*> devices, eg. ones created
+by a previous call to C<guestfs_luks_open>.
+
+Device mapper devices which correspond to logical volumes are I<not>
+returned in this list. Call C<guestfs_lvs> 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<size>
+
+The new size (in bytes) of the filesystem. If omitted, the filesystem
+is resized to fit the container (eg. partition).
+
+=item C<force>
+
+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<don't> set the C<force> option then it is not
+possible to call C<guestfs_ntfsresize_opts> multiple times on a
+single filesystem without booting into Windows between each resize.
+
+=back
+
+See also L<ntfsresize(8)>.");
+
+ ("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<size>
+
+The new size (in bytes) of the filesystem. If omitted, the filesystem
+is resized to the maximum size.
+
+=back
+
+See also L<btrfs(8)>.");
+
+ ("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<content> to the end of file C<path>. If
+C<path> does not exist, then a new file is created.
+
+See also C<guestfs_write>.");
+
+ ("compress_out", (RErr, [String "ctype"; Pathname "file"; FileOut "zfile"], [Int "level"]), 291, [],
+ [],
+ "output compressed file",
+ "\
+This command compresses C<file> and writes it out to the local
+file C<zfile>.
+
+The compression program used is controlled by the C<ctype> parameter.
+Currently this includes: C<compress>, C<gzip>, C<bzip2>, C<xz> or C<lzop>.
+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<level> 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<device> and writes it out to the local
+file C<zdevice>.
+
+The C<ctype> and optional C<level> parameters have the same meaning
+as in C<guestfs_compress_out>.");
+
+ ("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<guestfs_list_partitions>.
+
+See also C<guestfs_part_to_dev>.");
+
+ ("copy_device_to_device", (RErr, [Device "src"; Device "dest"], [Int64 "srcoffset"; Int64 "destoffset"; Int64 "size"]), 294, [Progress],
+ [],
+ "copy from source device to destination device",
+ "\
+The four calls C<guestfs_copy_device_to_device>,
+C<guestfs_copy_device_to_file>,
+C<guestfs_copy_file_to_device>, and
+C<guestfs_copy_file_to_file>
+let you copy from a source (device|file) to a destination
+(device|file).
+
+Partial copies can be made since you can specify optionally
+the source offset, destination offset and size to copy. These
+values are all specified in bytes. If not given, the offsets
+both default to zero, and the size defaults to copying as much
+as possible until we hit the end of the source.
+
+The source and destination may be the same object. However
+overlapping regions may not be copied correctly.
+
+If the destination is a file, it is created if required. If
+the destination file is not large enough, it is extended.");
+
+ ("copy_device_to_file", (RErr, [Device "src"; Pathname "dest"], [Int64 "srcoffset"; Int64 "destoffset"; Int64 "size"]), 295, [Progress],
+ [],
+ "copy from source device to destination file",
+ "\
+See C<guestfs_copy_device_to_device> for a general overview
+of this call.");
+
+ ("copy_file_to_device", (RErr, [Pathname "src"; Device "dest"], [Int64 "srcoffset"; Int64 "destoffset"; Int64 "size"]), 296, [Progress],
+ [],
+ "copy from source file to destination device",
+ "\
+See C<guestfs_copy_device_to_device> for a general overview
+of this call.");
+
+ ("copy_file_to_file", (RErr, [Pathname "src"; Pathname "dest"], [Int64 "srcoffset"; Int64 "destoffset"; Int64 "size"]), 297, [Progress],
+ [InitScratchFS, Always, TestOutputBuffer (
+ [["mkdir"; "/copyff"];
+ ["write"; "/copyff/src"; "hello, world"];
+ ["copy_file_to_file"; "/copyff/src"; "/copyff/dest"; ""; ""; ""];
+ ["read_file"; "/copyff/dest"]], "hello, world")],
+ "copy from source file to destination file",
+ "\
+See C<guestfs_copy_device_to_device> for a general overview
+of this call.
+
+This is B<not> the function you want for copying files. This
+is for copying blocks within existing files. See C<guestfs_cp>,
+C<guestfs_cp_a> and C<guestfs_mv> for general file copying and
+moving functions.");
+
+ ("tune2fs", (RErr, [Device "device"], [Bool "force"; Int "maxmountcount"; Int "mountcount"; String "errorbehavior"; Int64 "group"; Int "intervalbetweenchecks"; Int "reservedblockspercentage"; String "lastmounteddirectory"; Int64 "reservedblockscount"; Int64 "user"]), 298, [],
+ [InitScratchFS, Always, TestOutputHashtable (
+ [["tune2fs"; "/dev/sdb1"; "false"; "0"; ""; "NOARG"; ""; "0"; ""; "NOARG"; ""; ""];
+ ["tune2fs_l"; "/dev/sdb1"]],
+ ["Check interval", "0 (<none>)";
+ "Maximum mount count", "-1"]);
+ InitScratchFS, Always, TestOutputHashtable (
+ [["tune2fs"; "/dev/sdb1"; "false"; "0"; ""; "NOARG"; ""; "86400"; ""; "NOARG"; ""; ""];
+ ["tune2fs_l"; "/dev/sdb1"]],
+ ["Check interval", "86400 (1 day)";
+ "Maximum mount count", "-1"]);
+ InitScratchFS, Always, TestOutputHashtable (
+ [["tune2fs"; "/dev/sdb1"; "false"; ""; ""; "NOARG"; "1"; ""; ""; "NOARG"; ""; "1"];
+ ["tune2fs_l"; "/dev/sdb1"]],
+ ["Reserved blocks uid", "1 (user bin)";
+ "Reserved blocks gid", "1 (group bin)"]);
+ InitScratchFS, Always, TestOutputHashtable (
+ [["tune2fs"; "/dev/sdb1"; "false"; ""; ""; "NOARG"; "0"; ""; ""; "NOARG"; ""; "0"];
+ ["tune2fs_l"; "/dev/sdb1"]],
+ ["Reserved blocks uid", "0 (user root)";
+ "Reserved blocks gid", "0 (group root)"])
+ ],
+ "adjust ext2/ext3/ext4 filesystem parameters",
+ "\
+This call allows you to adjust various filesystem parameters of
+an ext2/ext3/ext4 filesystem called C<device>.
+
+The optional parameters are:
+
+=over 4
+
+=item C<force>
+
+Force tune2fs to complete the operation even in the face of errors.
+This is the same as the tune2fs C<-f> option.
+
+=item C<maxmountcount>
+
+Set the number of mounts after which the filesystem is checked
+by L<e2fsck(8)>. If this is C<0> then the number of mounts is
+disregarded. This is the same as the tune2fs C<-c> option.
+
+=item C<mountcount>
+
+Set the number of times the filesystem has been mounted.
+This is the same as the tune2fs C<-C> option.
+
+=item C<errorbehavior>
+
+Change the behavior of the kernel code when errors are detected.
+Possible values currently are: C<continue>, C<remount-ro>, C<panic>.
+In practice these options don't really make any difference,
+particularly for write errors.
+
+This is the same as the tune2fs C<-e> option.
+
+=item C<group>
+
+Set the group which can use reserved filesystem blocks.
+This is the same as the tune2fs C<-g> option except that it
+can only be specified as a number.
+
+=item C<intervalbetweenchecks>
+
+Adjust the maximal time between two filesystem checks
+(in seconds). If the option is passed as C<0> then
+time-dependent checking is disabled.
+
+This is the same as the tune2fs C<-i> option.
+
+=item C<reservedblockspercentage>
+
+Set the percentage of the filesystem which may only be allocated
+by privileged processes.
+This is the same as the tune2fs C<-m> option.
+
+=item C<lastmounteddirectory>
+
+Set the last mounted directory.
+This is the same as the tune2fs C<-M> option.
+
+=item C<reservedblockscount>
+Set the number of reserved filesystem blocks.
+This is the same as the tune2fs C<-r> option.
+
+=item C<user>
+
+Set the user who can use the reserved filesystem blocks.
+This is the same as the tune2fs C<-u> option except that it
+can only be specified as a number.
+
+=back
+
+To get the current values of filesystem parameters, see
+C<guestfs_tune2fs_l>. For precise details of how tune2fs
+works, see the L<tune2fs(8)> man page.");
+
+ ("md_create", (RErr, [String "name"; DeviceList "devices"], [Int64 "missingbitmap"; Int "nrdevices"; Int "spare"; Int64 "chunk"; String "level"]), 299, [Optional "mdadm"],
+ [],
+ "create a Linux md (RAID) device",
+ "\
+Create a Linux md (RAID) device named C<name> on the devices
+in the list C<devices>.
+
+The optional parameters are:
+
+=over 4
+
+=item C<missingbitmap>
+
+A bitmap of missing devices. If a bit is set it means that a
+missing device is added to the array. The least significant bit
+corresponds to the first device in the array.
+
+As examples:
+
+If C<devices = [\"/dev/sda\"]> and C<missingbitmap = 0x1> then
+the resulting array would be C<[E<lt>missingE<gt>, \"/dev/sda\"]>.
+
+If C<devices = [\"/dev/sda\"]> and C<missingbitmap = 0x2> then
+the resulting array would be C<[\"/dev/sda\", E<lt>missingE<gt>]>.
+
+This defaults to C<0> (no missing devices).
+
+The length of C<devices> + the number of bits set in
+C<missingbitmap> must equal C<nrdevices> + C<spare>.
+
+=item C<nrdevices>
+
+The number of active RAID devices.
+
+If not set, this defaults to the length of C<devices> plus
+the number of bits set in C<missingbitmap>.
+
+=item C<spare>
+
+The number of spare devices.
+
+If not set, this defaults to C<0>.
+
+=item C<chunk>
+
+The chunk size in bytes.
+
+=item C<level>
+
+The RAID level, which can be one of:
+I<linear>, I<raid0>, I<0>, I<stripe>, I<raid1>, I<1>, I<mirror>,
+I<raid4>, I<4>, I<raid5>, I<5>, I<raid6>, I<6>, I<raid10>, I<10>.
+Some of these are synonymous, and more levels may be added in future.
+
+If not set, this defaults to C<raid1>.
+
+=back");
+
+ ("list_md_devices", (RStringList "devices", [], []), 300, [],
+ [],
+ "list Linux md (RAID) devices",
+ "\
+List all Linux md devices.");
+
+ ("md_detail", (RHashtable "info", [Device "md"], []), 301, [Optional "mdadm"],
+ [],
+ "obtain metadata for an MD device",
+ "\
+This command exposes the output of 'mdadm -DY <md>'. The following fields are
+usually present in the returned hash. Other fields may also be present.
+
+=over
+
+=item C<level>
+
+The raid level of the MD device.
+
+=item C<devices>
+
+The number of underlying devices in the MD device.
+
+=item C<metadata>
+
+The metadata version used.
+
+=item C<uuid>
+
+The UUID of the MD device.
+
+=item C<name>
+
+The name of the MD device.
+
+=back");
+
+ ("md_stop", (RErr, [Device "md"], []), 302, [Optional "mdadm"],
+ [],
+ "stop a Linux md (RAID) device",
+ "\
+This command deactivates the MD array named C<md>. The
+device is stopped, but it is not destroyed or zeroed.");
+
+ ("blkid", (RHashtable "info", [Device "device"], []), 303, [],
+ [InitScratchFS, Always, TestOutputHashtable (
+ [["blkid"; "/dev/sdb1"]],
+ ["TYPE", "ext2";
+ "USAGE", "filesystem";
+ "PART_ENTRY_NUMBER", "1";
+ "PART_ENTRY_TYPE", "0x83";
+ "PART_ENTRY_OFFSET", "128";
+ "PART_ENTRY_SIZE", "102145"])],
+ "print block device attributes",
+ "\
+This command returns block device attributes for C<device>. The following fields are
+usually present in the returned hash. Other fields may also be present.
+
+=over
+
+=item C<UUID>
+
+The uuid of this device.
+
+=item C<LABEL>
+
+The label of this device.
+
+=item C<VERSION>
+
+The version of blkid command.
+
+=item C<TYPE>
+
+The filesystem type or RAID of this device.
+
+=item C<USAGE>
+
+The usage of this device, for example C<filesystem> or C<raid>.
+
+=back");
+