X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_actions.ml;h=f7a6a6cf0a49ef2df30d65b225e8229a5e49ea81;hp=8592a39cf7f5b7ffd374558925892cf4c0153f8b;hb=5d93d70b4d36b2337104b3dbca07722fa4d47ff5;hpb=edd747a09060dd191277f1bcae827a94939cfb9d diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 8592a39..f7a6a6c 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -743,6 +743,14 @@ Any Microsoft Windows operating system. FreeBSD. +=item \"netbsd\" + +NetBSD. + +=item \"hurd\" + +GNU/Hurd. + =item \"unknown\" The operating system type could not be determined. @@ -802,6 +810,10 @@ Gentoo. Linux Mint. +=item \"mageia\" + +Mageia. + =item \"mandriva\" Mandriva. @@ -810,6 +822,10 @@ Mandriva. MeeGo. +=item \"opensuse\" + +OpenSUSE. + =item \"pardus\" Pardus. @@ -830,6 +846,10 @@ Scientific Linux. Slackware. +=item \"ttylinux\" + +ttylinux. + =item \"ubuntu\" Ubuntu. @@ -991,7 +1011,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", "\ @@ -1034,6 +1054,11 @@ 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, [], @@ -1069,7 +1094,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"; Bool "allowuuid"]), -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"; String "readonlydisk"]), -1, [FishAlias "domain"], [], "add the disk(s) from a named libvirt domain", "\ @@ -1108,12 +1140,58 @@ 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 optional C parameter controls what we do for +disks which are marked Ereadonly/E in the libvirt XML. +Possible values are: + +=over 4 + +=item readonlydisk = \"error\" + +If C is false: + +The whole call is aborted with an error if any disk with +the Ereadonly/E flag is found. + +If C is true: + +Disks with the Ereadonly/E flag are added read-only. + +=item readonlydisk = \"read\" + +If C is false: + +Disks with the Ereadonly/E flag are added read-only. +Other disks are added read/write. + +If C is true: + +Disks with the Ereadonly/E flag are added read-only. + +=item readonlydisk = \"write\" (default) + +If C is false: + +Disks with the Ereadonly/E flag are added read/write. + +If C is true: + +Disks with the Ereadonly/E flag are added read-only. + +=item readonlydisk = \"ignore\" + +If C is true or false: + +Disks with the Ereadonly/E flag are skipped. + +=back + The other optional parameters are passed directly through to C."); (* This interface is not quite baked yet. -- RWMJ 2010-11-11 - ("add_libvirt_dom", (RInt "nrdisks", [Pointer ("virDomainPtr", "dom")], [Bool "readonly"; String "iface"; Bool "live"]), -1, [NotInFish], + ("add_libvirt_dom", (RInt "nrdisks", [Pointer ("virDomainPtr", "dom")], [Bool "readonly"; String "iface"; Bool "live"; String "readonlydisk"]), -1, [NotInFish], [], "add the disk(s) from a libvirt domain", "\ @@ -1143,6 +1221,10 @@ XML definition. The default (if the flag is omitted) is never to try. See L for more information. +The optional C parameter controls what we do for +disks which are marked Ereadonly/E in the libvirt XML. +See C for possible values. + The other optional parameters are passed directly through to C."); *) @@ -1161,7 +1243,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."); @@ -1182,7 +1265,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."); @@ -1526,6 +1609,41 @@ 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 @@ -1533,7 +1651,7 @@ advice before using trademarks in applications. *) let daemon_functions = [ - ("mount", (RErr, [Device "device"; String "mountpoint"], []), 1, [DeprecatedBy "mount_options"], + ("mount", (RErr, [Device "device"; String "mountpoint"], []), 1, [], [InitEmpty, Always, TestOutput ( [["part_disk"; "/dev/sda"; "mbr"]; ["mkfs"; "ext2"; "/dev/sda1"]; @@ -1556,15 +1674,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"]]], @@ -1802,7 +1917,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 @@ -2141,7 +2261,7 @@ example C."); ("sfdisk", (RErr, [Device "device"; Int "cyls"; Int "heads"; Int "sectors"; - StringList "lines"], []), 43, [DangerWillRobinson; DeprecatedBy "part_add"], + StringList "lines"], []), 43, [DeprecatedBy "part_add"], [], "create partitions on a block device", "\ @@ -2242,7 +2362,7 @@ This unmounts all mounted filesystems. Some internal mounts are not unmounted by this call."); - ("lvm_remove_all", (RErr, [], []), 48, [DangerWillRobinson; Optional "lvm2"], + ("lvm_remove_all", (RErr, [], []), 48, [Optional "lvm2"], [], "remove all LVM LVs, VGs and PVs", "\ @@ -2469,7 +2589,10 @@ C should be a file or directory in the mounted file system This is the same as the C system call."); ("tune2fs_l", (RHashtable "superblock", [Device "device"], []), 55, [], - [], (* XXX test *) + [InitScratchFS, Always, TestOutputHashtable ( + [["tune2fs_l"; "/dev/sdb1"]], + ["Filesystem magic number", "0xEF53"; + "Filesystem OS type", "Linux"])], "get ext2/ext3/ext4 superblock details", "\ This returns the contents of the ext2, ext3 or ext4 filesystem @@ -2595,7 +2718,7 @@ This uses the L command."); [InitScratchFS, Always, TestOutput ( (* Pick a file from cwd which isn't likely to change. *) [["mkdir"; "/upload"]; - ["upload"; "../COPYING.LIB"; "/upload/COPYING.LIB"]; + ["upload"; "../../COPYING.LIB"; "/upload/COPYING.LIB"]; ["checksum"; "md5"; "/upload/COPYING.LIB"]], Digest.to_hex (Digest.file "COPYING.LIB"))], "upload a file from the local machine", @@ -2611,7 +2734,7 @@ See also C."); [InitScratchFS, Always, TestOutput ( (* Pick a file from cwd which isn't likely to change. *) [["mkdir"; "/download"]; - ["upload"; "../COPYING.LIB"; "/download/COPYING.LIB"]; + ["upload"; "../../COPYING.LIB"; "/download/COPYING.LIB"]; ["download"; "/download/COPYING.LIB"; "testdownload.tmp"]; ["upload"; "testdownload.tmp"; "/download/upload"]; ["checksum"; "md5"; "/download/upload"]], @@ -2982,10 +3105,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. +If blocks are already zero, then this command avoids writing +zeroes. This prevents the underlying device from becoming non-sparse +or growing unnecessarily. + See also: C, C, C"); - ("grub_install", (RErr, [Pathname "root"; Device "device"], []), 86, [], + ("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 @@ -2995,12 +3122,32 @@ 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 @@ -3009,7 +3156,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 ( @@ -3229,7 +3378,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; DeprecatedBy "part_add"], + String "line"], []), 99, [DeprecatedBy "part_add"], [], "modify a single partition on a block device", "\ @@ -3475,7 +3624,7 @@ It is just a wrapper around the C L function with flags C. See that manual page for more details."); - ("scrub_device", (RErr, [Device "device"], []), 114, [DangerWillRobinson; Optional "scrub"], + ("scrub_device", (RErr, [Device "device"], []), 114, [Optional "scrub"], [InitNone, Always, TestRun ( (* use /dev/sdc because it's smaller *) [["scrub_device"; "/dev/sdc"]])], "scrub (securely wipe) a device", @@ -3854,7 +4003,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; DeprecatedBy "part_add"], + ("sfdiskM", (RErr, [Device "device"; StringList "lines"], []), 139, [DeprecatedBy "part_add"], [], "create partitions on a block device", "\ @@ -4670,10 +4819,31 @@ for the file until you write to it). To create a non-sparse file of zeroes, use C instead."); ("utimens", (RErr, [Pathname "path"; Int64 "atsecs"; Int64 "atnsecs"; Int64 "mtsecs"; Int64 "mtnsecs"], []), 201, [], + (* Test directories, named pipes etc (RHBZ#761451, RHBZ#761460) *) [InitScratchFS, Always, TestOutputStruct ( - [["touch"; "/utimens"]; - ["utimens"; "/utimens"; "12345"; "67890"; "9876"; "5432"]; - ["stat"; "/utimens"]], [CompareWithInt ("mtime", 9876)])], + [["touch"; "/utimens-file"]; + ["utimens"; "/utimens-file"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-file"]], [CompareWithInt ("mtime", 9876)]); + InitScratchFS, Always, TestOutputStruct ( + [["mkdir"; "/utimens-dir"]; + ["utimens"; "/utimens-dir"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-dir"]], [CompareWithInt ("mtime", 9876)]); + InitScratchFS, Always, TestOutputStruct ( + [["mkfifo"; "0o644"; "/utimens-fifo"]; + ["utimens"; "/utimens-fifo"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-fifo"]], [CompareWithInt ("mtime", 9876)]); + InitScratchFS, Always, TestOutputStruct ( + [["ln_sf"; "/utimens-file"; "/utimens-link"]; + ["utimens"; "/utimens-link"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-link"]], [CompareWithInt ("mtime", 9876)]); + InitScratchFS, Always, TestOutputStruct ( + [["mknod_b"; "0o644"; "8"; "0"; "/utimens-block"]; + ["utimens"; "/utimens-block"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-block"]], [CompareWithInt ("mtime", 9876)]); + InitScratchFS, Always, TestOutputStruct ( + [["mknod_c"; "0o644"; "1"; "3"; "/utimens-char"]; + ["utimens"; "/utimens-char"; "12345"; "67890"; "9876"; "5432"]; + ["stat"; "/utimens-char"]], [CompareWithInt ("mtime", 9876)])], "set timestamp of a file with nanosecond precision", "\ This command sets the timestamps of a file with nanosecond @@ -4824,7 +4994,9 @@ Possible values for C are: =over 4 -=item B | B +=item B + +=item B Intel EFI / GPT partition table. @@ -4832,7 +5004,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 @@ -4850,7 +5024,9 @@ supported include: AIX disk labels. -=item B | B +=item B + +=item B Amiga \"Rigid Disk Block\" format. @@ -4911,7 +5087,7 @@ backwards from the end of the disk (C<-1> is the last sector). Creating a partition which covers the whole disk is not so easy. Use C to do that."); - ("part_disk", (RErr, [Device "device"; String "parttype"], []), 210, [DangerWillRobinson], + ("part_disk", (RErr, [Device "device"; String "parttype"], []), 210, [], [InitEmpty, Always, TestRun ( [["part_disk"; "/dev/sda"; "mbr"]]); InitEmpty, Always, TestRun ( @@ -5070,7 +5246,7 @@ See also C. =back"); - ("dd", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"], []), 217, [], + ("dd", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"], []), 217, [DeprecatedBy "copy_device_to_device"], [InitScratchFS, Always, TestOutputBuffer ( [["mkdir"; "/dd"]; ["write"; "/dd/src"; "hello, world"]; @@ -5085,7 +5261,8 @@ example to duplicate a filesystem. If the destination is a device, it must be as large or larger than the source file or device, otherwise the copy will fail. -This command cannot do partial copies (see C)."); +This command cannot do partial copies +(see C)."); ("filesize", (RInt64 "size", [Pathname "file"], []), 218, [], [InitScratchFS, Always, TestOutputInt ( @@ -5178,7 +5355,7 @@ calls to associate logical volumes and volume groups. See also C."); - ("copy_size", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"; Int64 "size"], []), 227, [Progress], + ("copy_size", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"; Int64 "size"], []), 227, [Progress; DeprecatedBy "copy_device_to_device"], [InitScratchFS, Always, TestOutputBuffer ( [["mkdir"; "/copy_size"]; ["write"; "/copy_size/src"; "hello, world"]; @@ -5192,14 +5369,18 @@ or file C to another destination device or file C. Note this will fail if the source is too short or if the destination is not large enough."); - ("zero_device", (RErr, [Device "device"], []), 228, [DangerWillRobinson; Progress], + ("zero_device", (RErr, [Device "device"], []), 228, [Progress], [InitBasicFSonLVM, Always, TestRun ( [["zero_device"; "/dev/VG/LV"]])], "write zeroes to an entire device", "\ 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 ( @@ -5414,7 +5595,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 ( @@ -5605,7 +5788,7 @@ C parameter must be the name of the LUKS mapping device (ie. C) and I the name of the underlying block device."); - ("luks_format", (RErr, [Device "device"; Key "key"; Int "keyslot"], []), 260, [Optional "luks"; DangerWillRobinson], + ("luks_format", (RErr, [Device "device"; Key "key"; Int "keyslot"], []), 260, [Optional "luks"], [], "format a block device as a LUKS encrypted device", "\ @@ -5614,7 +5797,7 @@ the device as a LUKS encrypted device. C is the initial key, which is added to key slot C. (LUKS supports 8 key slots, numbered 0-7)."); - ("luks_format_cipher", (RErr, [Device "device"; Key "key"; Int "keyslot"; String "cipher"], []), 261, [Optional "luks"; DangerWillRobinson], + ("luks_format_cipher", (RErr, [Device "device"; Key "key"; Int "keyslot"; String "cipher"], []), 261, [Optional "luks"], [], "format a block device as a LUKS encrypted device", "\ @@ -5746,12 +5929,14 @@ 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 [InitScratchFS, Always, TestOutput ( - [["upload_offset"; "../COPYING.LIB"; "/upload_offset"; "0"]; + [["upload_offset"; "../../COPYING.LIB"; "/upload_offset"; "0"]; ["checksum"; "md5"; "/upload_offset"]], md5)]), "upload a file from the local machine with offset", "\ @@ -5779,7 +5964,7 @@ See also C, C."); [InitScratchFS, Always, TestOutput ( (* Pick a file from cwd which isn't likely to change. *) [["mkdir"; "/download_offset"]; - ["upload"; "../COPYING.LIB"; "/download_offset/COPYING.LIB"]; + ["upload"; "../../COPYING.LIB"; "/download_offset/COPYING.LIB"]; ["download_offset"; "/download_offset/COPYING.LIB"; "testdownload.tmp"; offset; size]; ["upload_offset"; "testdownload.tmp"; "/download_offset/COPYING.LIB"; offset]; ["checksum"; "md5"; "/download_offset/COPYING.LIB"]], md5)]), @@ -6043,6 +6228,375 @@ single filesystem without booting into Windows between each resize. 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."); + + ("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, +C, +C, and +C +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 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 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 for a general overview +of this call. + +This is B the function you want for copying files. This +is for copying blocks within existing files. See C, +C and C 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 ()"; + "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. + +The optional parameters are: + +=over 4 + +=item C + +Force tune2fs to complete the operation even in the face of errors. +This is the same as the tune2fs C<-f> option. + +=item C + +Set the number of mounts after which the filesystem is checked +by L. If this is C<0> then the number of mounts is +disregarded. This is the same as the tune2fs C<-c> option. + +=item C + +Set the number of times the filesystem has been mounted. +This is the same as the tune2fs C<-C> option. + +=item C + +Change the behavior of the kernel code when errors are detected. +Possible values currently are: C, C, C. +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 + +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 + +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 + +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 + +Set the last mounted directory. +This is the same as the tune2fs C<-M> option. + +=item C +Set the number of reserved filesystem blocks. +This is the same as the tune2fs C<-r> option. + +=item C + +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. For precise details of how tune2fs +works, see the L 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 on the devices +in the list C. + +The optional parameters are: + +=over 4 + +=item C + +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 and C then +the resulting array would be C<[EmissingE, \"/dev/sda\"]>. + +If C and C then +the resulting array would be C<[\"/dev/sda\", EmissingE]>. + +This defaults to C<0> (no missing devices). + +The length of C + the number of bits set in +C must equal C + C. + +=item C + +The number of active RAID devices. + +If not set, this defaults to the length of C plus +the number of bits set in C. + +=item C + +The number of spare devices. + +If not set, this defaults to C<0>. + +=item C + +The chunk size in bytes. + +=item C + +The RAID level, which can be one of: +I, I, I<0>, I, I, I<1>, I, +I, I<4>, I, I<5>, I, I<6>, I, I<10>. +Some of these are synonymous, and more levels may be added in future. + +If not set, this defaults to C. + +=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 '. The following fields are +usually present in the returned hash. Other fields may also be present. + +=over + +=item C + +The raid level of the MD device. + +=item C + +The number of underlying devices in the MD device. + +=item C + +The metadata version used. + +=item C + +The UUID of the MD device. + +=item C + +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. 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. The following fields are +usually present in the returned hash. Other fields may also be present. + +=over + +=item C + +The uuid of this device. + +=item C