X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=13c1cfae75d18bbe4648b54f178461365a38827d;hp=7905c3676eebce2a15ce58fb342911229cbde092;hb=3d15f7e652340777514ff30c3cfc560a90b612ec;hpb=72caee07a5f4f2d7e34c954dba500ffbdbc27207 diff --git a/src/generator.ml b/src/generator.ml index 7905c36..13c1cfa 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -598,6 +598,35 @@ actions using the low-level API. For more information on states, see L."); + ("set_memsize", (RErr, [Int "memsize"]), -1, [FishAlias "memsize"], + [], + "set memory allocated to the qemu subprocess", + "\ +This sets the memory size in megabytes allocated to the +qemu subprocess. This only has any effect if called before +C. + +You can also change this by setting the environment +variable C before the handle is +created. + +For more information on the architecture of libguestfs, +see L."); + + ("get_memsize", (RInt "memsize", []), -1, [], + [], + "get memory allocated to the qemu subprocess", + "\ +This gets the memory size in megabytes allocated to the +qemu subprocess. + +If C was not called +on this handle, and if C was not set, +then this returns the compiled-in default value for memsize. + +For more information on the architecture of libguestfs, +see L."); + ] (* daemon_functions are any functions which cause some action @@ -2173,7 +2202,7 @@ or data on the filesystem."); This resizes (expands or shrinks) an existing LVM physical volume to match the new size of the underlying device."); - ("sfdisk_N", (RErr, [String "device"; Int "n"; + ("sfdisk_N", (RErr, [String "device"; Int "partnum"; Int "cyls"; Int "heads"; Int "sectors"; String "line"]), 99, [DangerWillRobinson], [], @@ -2473,6 +2502,180 @@ directory and its contents after use. See also: L"); + ("wc_l", (RInt "lines", [String "path"]), 118, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_l"; "/10klines"]], 10000)], + "count lines in a file", + "\ +This command counts the lines in a file, using the +C external command."); + + ("wc_w", (RInt "words", [String "path"]), 119, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_w"; "/10klines"]], 10000)], + "count words in a file", + "\ +This command counts the words in a file, using the +C external command."); + + ("wc_c", (RInt "chars", [String "path"]), 120, [], + [InitBasicFS, Always, TestOutputInt ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["wc_c"; "/100kallspaces"]], 102400)], + "count characters in a file", + "\ +This command counts the characters in a file, using the +C external command."); + + ("head", (RStringList "lines", [String "path"]), 121, [ProtocolLimitWarning], + [InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["head"; "/10klines"]], ["0abcdefghijklmnopqrstuvwxyz";"1abcdefghijklmnopqrstuvwxyz";"2abcdefghijklmnopqrstuvwxyz";"3abcdefghijklmnopqrstuvwxyz";"4abcdefghijklmnopqrstuvwxyz";"5abcdefghijklmnopqrstuvwxyz";"6abcdefghijklmnopqrstuvwxyz";"7abcdefghijklmnopqrstuvwxyz";"8abcdefghijklmnopqrstuvwxyz";"9abcdefghijklmnopqrstuvwxyz"])], + "return first 10 lines of a file", + "\ +This command returns up to the first 10 lines of a file as +a list of strings."); + + ("head_n", (RStringList "lines", [Int "nrlines"; String "path"]), 122, [ProtocolLimitWarning], + [InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["head_n"; "3"; "/10klines"]], ["0abcdefghijklmnopqrstuvwxyz";"1abcdefghijklmnopqrstuvwxyz";"2abcdefghijklmnopqrstuvwxyz"]); + InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["head_n"; "-9997"; "/10klines"]], ["0abcdefghijklmnopqrstuvwxyz";"1abcdefghijklmnopqrstuvwxyz";"2abcdefghijklmnopqrstuvwxyz"]); + InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["head_n"; "0"; "/10klines"]], [])], + "return first N lines of a file", + "\ +If the parameter C is a positive number, this returns the first +C lines of the file C. + +If the parameter C is a negative number, this returns lines +from the file C, excluding the last C lines. + +If the parameter C is zero, this returns an empty list."); + + ("tail", (RStringList "lines", [String "path"]), 123, [ProtocolLimitWarning], + [InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["tail"; "/10klines"]], ["9990abcdefghijklmnopqrstuvwxyz";"9991abcdefghijklmnopqrstuvwxyz";"9992abcdefghijklmnopqrstuvwxyz";"9993abcdefghijklmnopqrstuvwxyz";"9994abcdefghijklmnopqrstuvwxyz";"9995abcdefghijklmnopqrstuvwxyz";"9996abcdefghijklmnopqrstuvwxyz";"9997abcdefghijklmnopqrstuvwxyz";"9998abcdefghijklmnopqrstuvwxyz";"9999abcdefghijklmnopqrstuvwxyz"])], + "return last 10 lines of a file", + "\ +This command returns up to the last 10 lines of a file as +a list of strings."); + + ("tail_n", (RStringList "lines", [Int "nrlines"; String "path"]), 124, [ProtocolLimitWarning], + [InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["tail_n"; "3"; "/10klines"]], ["9997abcdefghijklmnopqrstuvwxyz";"9998abcdefghijklmnopqrstuvwxyz";"9999abcdefghijklmnopqrstuvwxyz"]); + InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["tail_n"; "-9998"; "/10klines"]], ["9997abcdefghijklmnopqrstuvwxyz";"9998abcdefghijklmnopqrstuvwxyz";"9999abcdefghijklmnopqrstuvwxyz"]); + InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["tail_n"; "0"; "/10klines"]], [])], + "return last N lines of a file", + "\ +If the parameter C is a positive number, this returns the last +C lines of the file C. + +If the parameter C is a negative number, this returns lines +from the file C, starting with the C<-nrlines>th line. + +If the parameter C is zero, this returns an empty list."); + + ("df", (RString "output", []), 125, [], + [], (* XXX Tricky to test because it depends on the exact format + * of the 'df' command and other imponderables. + *) + "report file system disk space usage", + "\ +This command runs the C command to report disk space used. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs."); + + ("df_h", (RString "output", []), 126, [], + [], (* XXX Tricky to test because it depends on the exact format + * of the 'df' command and other imponderables. + *) + "report file system disk space usage (human readable)", + "\ +This command runs the C command to report disk space used +in human-readable format. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string. +Use C from programs."); + + ("du", (RInt64 "sizekb", [String "path"]), 127, [], + [InitBasicFS, Always, TestOutputInt ( + [["mkdir"; "/p"]; + ["du"; "/p"]], 1 (* ie. 1 block, so depends on ext3 blocksize *))], + "estimate file space usage", + "\ +This command runs the C command to estimate file space +usage for C. + +C can be a file or a directory. If C is a directory +then the estimate includes the contents of the directory and all +subdirectories (recursively). + +The result is the estimated size in I +(ie. units of 1024 bytes)."); + + ("initrd_list", (RStringList "filenames", [String "path"]), 128, [], + [InitBasicFS, Always, TestOutputList ( + [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"]; + ["initrd_list"; "/initrd"]], ["empty";"known-1";"known-2";"known-3"])], + "list files in an initrd", + "\ +This command lists out files contained in an initrd. + +The files are listed without any initial C character. The +files are listed in the order they appear (not necessarily +alphabetical). Directory names are listed as separate items. + +Old Linux kernels (2.4 and earlier) used a compressed ext2 +filesystem as initrd. We I support the newer initramfs +format (compressed cpio files)."); + + ("mount_loop", (RErr, [String "file"; String "mountpoint"]), 129, [], + [], + "mount a file using the loop device", + "\ +This command lets you mount C (a filesystem image +in a file) on a mount point. It is entirely equivalent to +the command C."); + + ("mkswap", (RErr, [String "device"]), 130, [], + [InitEmpty, Always, TestRun ( + [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","]; + ["mkswap"; "/dev/sda1"]])], + "create a swap partition", + "\ +Create a swap partition on C."); + + ("mkswap_L", (RErr, [String "label"; String "device"]), 131, [], + [InitEmpty, Always, TestRun ( + [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","]; + ["mkswap_L"; "hello"; "/dev/sda1"]])], + "create a swap partition with a label", + "\ +Create a swap partition on C with label C