(* libguestfs * Copyright (C) 2009-2012 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) (* Please read generator/README first. *) open Types open Utils (* Default settings for all action fields. So we copy and override * this struct by writing '{ defaults with name = &c }' *) let defaults = { name = ""; style = RErr, [], []; proc_nr = None; tests = []; shortdesc = ""; longdesc = ""; protocol_limit_warning = false; fish_alias = []; fish_output = None; in_fish = true; in_docs = true; deprecated_by = None; optional = None; progress = false; camel_name = ""; cancellable = false; config_only = false; once_had_no_optargs = false; blocking = true; c_name = ""; c_function = ""; c_optarg_prefix = ""; non_c_aliases = [] } (* These test functions are used in the language binding tests. *) let test_all_args = [ String "str"; OptString "optstr"; StringList "strlist"; Bool "b"; Int "integer"; Int64 "integer64"; FileIn "filein"; FileOut "fileout"; BufferIn "bufferin"; ] let test_all_optargs = [ OBool "obool"; OInt "oint"; OInt64 "oint64"; OString "ostring"; OStringList "ostringlist"; ] let test_all_rets = [ (* except for RErr, which is tested thoroughly elsewhere *) "internal_test_rint", RInt "valout"; "internal_test_rint64", RInt64 "valout"; "internal_test_rbool", RBool "valout"; "internal_test_rconststring", RConstString "valout"; "internal_test_rconstoptstring", RConstOptString "valout"; "internal_test_rstring", RString "valout"; "internal_test_rstringlist", RStringList "valout"; "internal_test_rstruct", RStruct ("valout", "lvm_pv"); "internal_test_rstructlist", RStructList ("valout", "lvm_pv"); "internal_test_rhashtable", RHashtable "valout"; "internal_test_rbufferout", RBufferOut "valout"; ] let test_functions = [ { defaults with name = "internal_test"; style = RErr, test_all_args, test_all_optargs; in_fish = false; in_docs = false; cancellable = true; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible parameter type correctly. It echos the contents of each parameter to stdout (by default) or to a file (if C was called). You probably don't want to call this function." }; { defaults with name = "internal_test_only_optargs"; style = RErr, [], [OInt "test"]; in_fish = false; in_docs = false; cancellable = true; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle no args, some optargs correctly. It echos the contents of each parameter to stdout (by default) or to a file (if C was called). You probably don't want to call this function." }; { defaults with name = "internal_test_63_optargs"; style = RErr, [], [OInt "opt1"; OInt "opt2"; OInt "opt3"; OInt "opt4"; OInt "opt5"; OInt "opt6"; OInt "opt7"; OInt "opt8"; OInt "opt9"; OInt "opt10"; OInt "opt11"; OInt "opt12"; OInt "opt13"; OInt "opt14"; OInt "opt15"; OInt "opt16"; OInt "opt17"; OInt "opt18"; OInt "opt19"; OInt "opt20"; OInt "opt21"; OInt "opt22"; OInt "opt23"; OInt "opt24"; OInt "opt25"; OInt "opt26"; OInt "opt27"; OInt "opt28"; OInt "opt29"; OInt "opt30"; OInt "opt31"; OInt "opt32"; OInt "opt33"; OInt "opt34"; OInt "opt35"; OInt "opt36"; OInt "opt37"; OInt "opt38"; OInt "opt39"; OInt "opt40"; OInt "opt41"; OInt "opt42"; OInt "opt43"; OInt "opt44"; OInt "opt45"; OInt "opt46"; OInt "opt47"; OInt "opt48"; OInt "opt49"; OInt "opt50"; OInt "opt51"; OInt "opt52"; OInt "opt53"; OInt "opt54"; OInt "opt55"; OInt "opt56"; OInt "opt57"; OInt "opt58"; OInt "opt59"; OInt "opt60"; OInt "opt61"; OInt "opt62"; OInt "opt63"]; in_fish = false; in_docs = false; cancellable = true; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle the full range of 63 optargs correctly. (Note that 63 is not an absolute limit and it could be raised by changing the XDR protocol). It echos the contents of each parameter to stdout (by default) or to a file (if C was called). You probably don't want to call this function." } ] @ List.flatten ( List.map ( fun (name, ret) -> [ { defaults with name = name; style = ret, [String "val"], []; in_fish = false; in_docs = false; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible return type correctly. It converts string C to the return type. You probably don't want to call this function." }; { defaults with name = name ^ "err"; style = ret, [], []; in_fish = false; in_docs = false; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible return type correctly. This function always returns an error. You probably don't want to call this function." } ] ) test_all_rets ) (* non_daemon_functions are any functions which don't get processed * in the daemon, eg. functions for setting and getting local * configuration values. *) let non_daemon_functions = test_functions @ [ { defaults with name = "internal_test_set_output"; style = RErr, [String "filename"], []; in_fish = false; in_docs = false; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible parameter type correctly. It sets the output file used by C. You probably don't want to call this function." }; { defaults with name = "internal_test_close_output"; style = RErr, [], []; in_fish = false; in_docs = false; blocking = false; shortdesc = "internal test function - do not use"; longdesc = "\ This is an internal test function which is used to test whether the automatically generated bindings can handle every possible parameter type correctly. It closes the output file previously opened by C. You probably don't want to call this function." }; { defaults with name = "launch"; style = RErr, [], []; fish_alias = ["run"]; progress = true; config_only = true; shortdesc = "launch the qemu subprocess"; longdesc = "\ Internally libguestfs is implemented by running a virtual machine using L. You should call this after configuring the handle (eg. adding drives) but before performing any actions. Do not call C twice on the same handle. Although it will not give an error (for historical reasons), the precise behaviour when you do this is not well defined. Handles are very cheap to create, so create a new one for each launch." }; { defaults with name = "wait_ready"; style = RErr, [], []; in_fish = false; deprecated_by = Some "launch"; blocking = false; shortdesc = "wait until the qemu subprocess launches (no op)"; longdesc = "\ This function is a no op. In versions of the API E 1.0.71 you had to call this function just after calling C to wait for the launch to complete. However this is no longer necessary because C now does the waiting. If you see any calls to this function in code then you can just remove them, unless you want to retain compatibility with older versions of the API." }; { defaults with name = "kill_subprocess"; style = RErr, [], []; deprecated_by = Some "shutdown"; shortdesc = "kill the qemu subprocess"; longdesc = "\ This kills the qemu subprocess. Do not call this. See: C instead." }; { defaults with name = "add_cdrom"; style = RErr, [String "filename"], []; deprecated_by = Some "add_drive"; config_only = true; blocking = false; shortdesc = "add a CD-ROM disk image to examine"; longdesc = "\ This function adds a virtual CD-ROM disk image to the guest. B ISO files are just ordinary read-only disk images. Use C instead." }; { defaults with name = "add_drive_ro"; style = RErr, [String "filename"], []; fish_alias = ["add-ro"]; config_only = true; blocking = false; shortdesc = "add a drive in snapshot mode (read-only)"; longdesc = "\ This function is the equivalent of calling C with the optional parameter C set to 1, so the disk is added read-only, with the format being detected automatically." }; { defaults with name = "config"; style = RErr, [String "qemuparam"; OptString "qemuvalue"], []; config_only = true; blocking = false; shortdesc = "add qemu parameters"; longdesc = "\ This can be used to add arbitrary qemu command line parameters 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. The first character of C string must be a C<-> (dash). C can be NULL." }; { defaults with name = "set_qemu"; style = RErr, [OptString "qemu"], []; fish_alias = ["qemu"]; config_only = true; blocking = false; shortdesc = "set the qemu binary"; longdesc = "\ Set the qemu binary that we will use. The default is chosen when the library was compiled by the configure script. You can also override this by setting the C environment variable. Setting C to C restores the default qemu binary. Note that you should call this function as early as possible after creating the handle. This is because some pre-launch operations depend on testing qemu features (by running C). If the qemu binary changes, we don't retest features, and so you might see inconsistent results. Using the environment variable C is safest of all since that picks the qemu binary at the same time as the handle is created." }; { defaults with name = "get_qemu"; style = RConstString "qemu", [], []; blocking = false; tests = [ InitNone, Always, TestRun ( [["get_qemu"]]) ]; shortdesc = "get the qemu binary"; longdesc = "\ Return the current qemu binary. This is always non-NULL. If it wasn't set already, then this will return the default qemu binary name." }; { defaults with name = "set_path"; style = RErr, [OptString "searchpath"], []; fish_alias = ["path"]; config_only = true; blocking = false; shortdesc = "set the search path"; longdesc = "\ Set the path that libguestfs searches for kernel and initrd.img. The default is C<$libdir/guestfs> unless overridden by setting C environment variable. Setting C to C restores the default path." }; { defaults with name = "get_path"; style = RConstString "path", [], []; blocking = false; tests = [ InitNone, Always, TestRun ( [["get_path"]]) ]; shortdesc = "get the search path"; longdesc = "\ Return the current search path. This is always non-NULL. If it wasn't set already, then this will return the default path." }; { defaults with name = "set_append"; style = RErr, [OptString "append"], []; fish_alias = ["append"]; config_only = true; blocking = false; shortdesc = "add options to kernel command line"; longdesc = "\ This function is used to add additional options to the guest kernel command line. The default is C unless overridden by setting C environment variable. Setting C to C means I additional options are passed (libguestfs always adds a few of its own)." }; { defaults with name = "get_append"; style = RConstOptString "append", [], []; blocking = false; (* This cannot be tested with the current framework. The * function can return NULL in normal operations, which the * test framework interprets as an error. *) tests = []; shortdesc = "get the additional kernel options"; longdesc = "\ Return the additional kernel options which are added to the guest kernel command line. If C then no options are added." }; { defaults with name = "set_autosync"; style = RErr, [Bool "autosync"], []; fish_alias = ["autosync"]; blocking = false; shortdesc = "set autosync mode"; longdesc = "\ If C is true, this enables autosync. Libguestfs will make a best effort attempt to make filesystems consistent and synchronized when the handle is closed (also if the program exits without closing handles). This is enabled by default (since libguestfs 1.5.24, previously it was disabled by default)." }; { defaults with name = "get_autosync"; style = RBool "autosync", [], []; blocking = false; tests = [ InitNone, Always, TestOutputTrue ( [["get_autosync"]]) ]; shortdesc = "get autosync mode"; longdesc = "\ Get the autosync flag." }; { defaults with name = "set_verbose"; style = RErr, [Bool "verbose"], []; fish_alias = ["verbose"]; blocking = false; shortdesc = "set verbose mode"; longdesc = "\ If C is true, this turns on verbose messages. Verbose messages are disabled unless the environment variable C is defined and set to C<1>. Verbose messages are normally sent to C, unless you register a callback to send them somewhere else (see C)." }; { defaults with name = "get_verbose"; style = RBool "verbose", [], []; blocking = false; shortdesc = "get verbose mode"; longdesc = "\ This returns the verbose messages flag." }; { defaults with name = "is_ready"; style = RBool "ready", [], []; blocking = false; tests = [ InitNone, Always, TestOutputTrue ( [["is_ready"]]) ]; shortdesc = "is ready to accept commands"; longdesc = "\ This returns true iff this handle is ready to accept commands (in the C state). For more information on states, see L." }; { defaults with name = "is_config"; style = RBool "config", [], []; blocking = false; tests = [ InitNone, Always, TestOutputFalse ( [["is_config"]]) ]; shortdesc = "is in configuration state"; longdesc = "\ This returns true iff this handle is being configured (in the C state). For more information on states, see L." }; { defaults with name = "is_launching"; style = RBool "launching", [], []; blocking = false; tests = [ InitNone, Always, TestOutputFalse ( [["is_launching"]]) ]; shortdesc = "is launching subprocess"; longdesc = "\ This returns true iff this handle is launching the subprocess (in the C state). For more information on states, see L." }; { defaults with name = "is_busy"; style = RBool "busy", [], []; in_docs = false; blocking = false; tests = [ InitNone, Always, TestOutputFalse ( [["is_busy"]]) ]; shortdesc = "is busy processing a command"; longdesc = "\ This always returns false. Do not use this function. For more information on states, see L." }; { defaults with name = "get_state"; style = RInt "state", [], []; blocking = false; shortdesc = "get the current state"; longdesc = "\ This returns the current state as an opaque integer. This is only useful for printing debug and internal error messages. For more information on states, see L." }; { defaults with name = "set_memsize"; style = RErr, [Int "memsize"], []; fish_alias = ["memsize"]; config_only = true; blocking = false; shortdesc = "set memory allocated to the qemu subprocess"; longdesc = "\ 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." }; { defaults with name = "get_memsize"; style = RInt "memsize", [], []; blocking = false; tests = [ InitNone, Always, TestOutputIntOp ( [["get_memsize"]], ">=", 256) ]; shortdesc = "get memory allocated to the qemu subprocess"; longdesc = "\ 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." }; { defaults with name = "get_pid"; style = RInt "pid", [], []; fish_alias = ["pid"]; blocking = false; tests = []; shortdesc = "get PID of qemu subprocess"; longdesc = "\ Return the process ID of the qemu subprocess. If there is no qemu subprocess, then this will return an error. This is an internal call used for debugging and testing." }; { defaults with name = "version"; style = RStruct ("version", "version"), [], []; blocking = false; tests = [ InitNone, Always, TestOutputStruct ( [["version"]], [CompareWithInt ("major", 1)]) ]; shortdesc = "get the library version number"; longdesc = "\ Return the libguestfs version number that the program is linked against. Note that because of dynamic linking this is not necessarily the version of libguestfs that you compiled against. You can compile the program, and then at runtime dynamically link against a completely different C library. This call was added in version C<1.0.58>. In previous versions of libguestfs there was no way to get the version number. From C code you can use dynamic linker functions to find out if this symbol exists (if it doesn't, then it's an earlier version). The call returns a structure with four elements. The first three (C, C and C) are numbers and correspond to the usual version triplet. The fourth element (C) is a string and is normally empty, but may be used for distro-specific information. To construct the original version string: C<$major.$minor.$release$extra> See also: L. I Don't use this call to test for availability of features. In enterprise distributions we backport features from later versions into earlier versions, making this an unreliable way to test for features. Use C instead." }; { defaults with name = "set_selinux"; style = RErr, [Bool "selinux"], []; fish_alias = ["selinux"]; config_only = true; blocking = false; shortdesc = "set SELinux enabled or disabled at appliance boot"; longdesc = "\ This sets the selinux flag that is passed to the appliance at boot time. The default is C (disabled). Note that if SELinux is enabled, it is always in Permissive mode (C). For more information on the architecture of libguestfs, see L." }; { defaults with name = "get_selinux"; style = RBool "selinux", [], []; blocking = false; shortdesc = "get SELinux enabled flag"; longdesc = "\ This returns the current setting of the selinux flag which is passed to the appliance at boot time. See C. For more information on the architecture of libguestfs, see L." }; { defaults with name = "set_trace"; style = RErr, [Bool "trace"], []; fish_alias = ["trace"]; blocking = false; tests = [ InitNone, Always, TestOutputFalse ( [["set_trace"; "false"]; ["get_trace"]]) ]; shortdesc = "enable or disable command traces"; longdesc = "\ If the command trace flag is set to 1, then libguestfs calls, parameters and return values are traced. If you want to trace C API calls into libguestfs (and other libraries) then possibly a better way is to use the external ltrace(1) command. Command traces are disabled unless the environment variable C is defined and set to C<1>. Trace messages are normally sent to C, unless you register a callback to send them somewhere else (see C)." }; { defaults with name = "get_trace"; style = RBool "trace", [], []; blocking = false; shortdesc = "get command trace enabled flag"; longdesc = "\ Return the command trace flag." }; { defaults with name = "set_direct"; style = RErr, [Bool "direct"], []; fish_alias = ["direct"]; config_only = true; blocking = false; shortdesc = "enable or disable direct appliance mode"; longdesc = "\ If the direct appliance mode flag is enabled, then stdin and stdout are passed directly through to the appliance once it is launched. One consequence of this is that log messages aren't caught by the library and handled by C, but go straight to stdout. You probably don't want to use this unless you know what you are doing. The default is disabled." }; { defaults with name = "get_direct"; style = RBool "direct", [], []; blocking = false; shortdesc = "get direct appliance mode flag"; longdesc = "\ Return the direct appliance mode flag." }; { defaults with name = "set_recovery_proc"; style = RErr, [Bool "recoveryproc"], []; fish_alias = ["recovery-proc"]; config_only = true; blocking = false; shortdesc = "enable or disable the recovery process"; longdesc = "\ If this is called with the parameter C then C does not create a recovery process. The purpose of the recovery process is to stop runaway qemu processes in the case where the main program aborts abruptly. This only has any effect if called before C, and the default is true. About the only time when you would want to disable this is if the main process will fork itself into the background (\"daemonize\" itself). In this case the recovery process thinks that the main program has disappeared and so kills qemu, which is not very helpful." }; { defaults with name = "get_recovery_proc"; style = RBool "recoveryproc", [], []; blocking = false; shortdesc = "get recovery process enabled flag"; longdesc = "\ Return the recovery process enabled flag." }; { defaults with name = "add_drive_with_if"; style = RErr, [String "filename"; String "iface"], []; deprecated_by = Some "add_drive"; config_only = true; blocking = false; shortdesc = "add a drive specifying the QEMU block emulation to use"; longdesc = "\ This is the same as C but it allows you to specify the QEMU interface emulation to use at run time." }; { defaults with name = "add_drive_ro_with_if"; style = RErr, [String "filename"; String "iface"], []; blocking = false; deprecated_by = Some "add_drive"; config_only = true; shortdesc = "add a drive read-only specifying the QEMU block emulation to use"; longdesc = "\ This is the same as C but it allows you to specify the QEMU interface emulation to use at run time." }; { defaults with name = "file_architecture"; style = RString "arch", [Pathname "filename"], []; tests = [ InitISOFS, Always, TestOutput ( [["file_architecture"; "/bin-i586-dynamic"]], "i386"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/bin-sparc-dynamic"]], "sparc"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/bin-win32.exe"]], "i386"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/bin-win64.exe"]], "x86_64"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/bin-x86_64-dynamic"]], "x86_64"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/lib-i586.so"]], "i386"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/lib-sparc.so"]], "sparc"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/lib-win32.dll"]], "i386"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/lib-win64.dll"]], "x86_64"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/lib-x86_64.so"]], "x86_64"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/initrd-x86_64.img"]], "x86_64"); InitISOFS, Always, TestOutput ( [["file_architecture"; "/initrd-x86_64.img.gz"]], "x86_64"); ]; shortdesc = "detect the architecture of a binary file"; longdesc = "\ This detects the architecture of the binary C, and returns it if known. Currently defined architectures are: =over 4 =item \"i386\" This string is returned for all 32 bit i386, i486, i586, i686 binaries irrespective of the precise processor requirements of the binary. =item \"x86_64\" 64 bit x86-64. =item \"sparc\" 32 bit SPARC. =item \"sparc64\" 64 bit SPARC V9 and above. =item \"ia64\" Intel Itanium. =item \"ppc\" 32 bit Power PC. =item \"ppc64\" 64 bit Power PC. =back Libguestfs may return other architecture strings in future. The function works on at least the following types of files: =over 4 =item * many types of Un*x and Linux binary =item * many types of Un*x and Linux shared library =item * Windows Win32 and Win64 binaries =item * Windows Win32 and Win64 DLLs Win32 binaries and DLLs return C. Win64 binaries and DLLs return C. =item * Linux kernel modules =item * Linux new-style initrd images =item * some non-x86 Linux vmlinuz kernels =back What it can't do currently: =over 4 =item * static libraries (libfoo.a) =item * Linux old-style initrd as compressed ext2 filesystem (RHEL 3) =item * x86 Linux vmlinuz kernels x86 vmlinuz images (bzImage format) consist of a mix of 16-, 32- and compressed code, and are horribly hard to unpack. If you want to find the architecture of a kernel, use the architecture of the associated initrd or kernel module(s) instead. =back" }; { defaults with name = "inspect_os"; style = RStringList "roots", [], []; shortdesc = "inspect disk and return list of operating systems found"; longdesc = "\ This function uses other libguestfs functions and certain heuristics to inspect the disk(s) (usually disks belonging to a virtual machine), looking for operating systems. The list returned is empty if no operating systems were found. If one operating system was found, then this returns a list with a single element, which is the name of the root filesystem of this operating system. It is also possible for this function to return a list containing more than one element, indicating a dual-boot or multi-boot virtual machine, with each element being the root filesystem of one of the operating systems. You can pass the root string(s) returned to other C functions in order to query further information about each operating system, such as the name and version. This function uses other libguestfs features such as C and C in order to mount and unmount filesystems and look at the contents. This should be called with no disks currently mounted. The function may also use Augeas, so any existing Augeas handle will be closed. This function cannot decrypt encrypted disks. The caller must do that first (supplying the necessary keys) if the disk is encrypted. Please read L for more details. See also C." }; { defaults with name = "inspect_get_type"; style = RString "name", [Device "root"], []; shortdesc = "get type of inspected operating system"; longdesc = "\ This returns the type of the inspected operating system. Currently defined types are: =over 4 =item \"linux\" Any Linux-based operating system. =item \"windows\" Any Microsoft Windows operating system. =item \"freebsd\" FreeBSD. =item \"netbsd\" NetBSD. =item \"openbsd\" OpenBSD. =item \"hurd\" GNU/Hurd. =item \"dos\" MS-DOS, FreeDOS and others. =item \"unknown\" The operating system type could not be determined. =back Future versions of libguestfs may return other strings here. The caller should be prepared to handle any string. Please read L for more details." }; { defaults with name = "inspect_get_arch"; style = RString "arch", [Device "root"], []; shortdesc = "get architecture of inspected operating system"; longdesc = "\ This returns the architecture of the inspected operating system. The possible return values are listed under C. If the architecture could not be determined, then the string C is returned. Please read L for more details." }; { defaults with name = "inspect_get_distro"; style = RString "distro", [Device "root"], []; shortdesc = "get distro of inspected operating system"; longdesc = "\ This returns the distro (distribution) of the inspected operating system. Currently defined distros are: =over 4 =item \"archlinux\" Arch Linux. =item \"buildroot\" Buildroot-derived distro, but not one we specifically recognize. =item \"centos\" CentOS. =item \"cirros\" Cirros. =item \"debian\" Debian. =item \"fedora\" Fedora. =item \"freedos\" FreeDOS. =item \"gentoo\" Gentoo. =item \"linuxmint\" Linux Mint. =item \"mageia\" Mageia. =item \"mandriva\" Mandriva. =item \"meego\" MeeGo. =item \"openbsd\" OpenBSD. =item \"opensuse\" OpenSUSE. =item \"pardus\" Pardus. =item \"redhat-based\" Some Red Hat-derived distro. =item \"rhel\" Red Hat Enterprise Linux. =item \"scientificlinux\" Scientific Linux. =item \"slackware\" Slackware. =item \"sles\" SuSE Linux Enterprise Server or Desktop. =item \"suse-based\" Some openSuSE-derived distro. =item \"ttylinux\" ttylinux. =item \"ubuntu\" Ubuntu. =item \"unknown\" The distro could not be determined. =item \"windows\" Windows does not have distributions. This string is returned if the OS type is Windows. =back Future versions of libguestfs may return other strings here. The caller should be prepared to handle any string. Please read L for more details." }; { defaults with name = "inspect_get_major_version"; style = RInt "major", [Device "root"], []; shortdesc = "get major version of inspected operating system"; longdesc = "\ This returns the major version number of the inspected operating system. Windows uses a consistent versioning scheme which is I reflected in the popular public names used by the operating system. Notably the operating system known as \"Windows 7\" is really version 6.1 (ie. major = 6, minor = 1). You can find out the real versions corresponding to releases of Windows by consulting Wikipedia or MSDN. If the version could not be determined, then C<0> is returned. Please read L for more details." }; { defaults with name = "inspect_get_minor_version"; style = RInt "minor", [Device "root"], []; shortdesc = "get minor version of inspected operating system"; longdesc = "\ This returns the minor version number of the inspected operating system. If the version could not be determined, then C<0> is returned. Please read L for more details. See also C." }; { defaults with name = "inspect_get_product_name"; style = RString "product", [Device "root"], []; shortdesc = "get product name of inspected operating system"; longdesc = "\ 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 parsed by programs. If the product name could not be determined, then the string C is returned. Please read L for more details." }; { defaults with name = "inspect_get_mountpoints"; style = RHashtable "mountpoints", [Device "root"], []; shortdesc = "get mountpoints of inspected operating system"; longdesc = "\ 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 made by reading configuration files such as C. I that this may return filesystems which are non-existent or not mountable and callers should be prepared to handle or ignore failures if they try to mount them. Each element in the returned hashtable has a key which is the path of the mountpoint (eg. C) and a value which is the filesystem that would be mounted there (eg. C). Non-mounted devices such as swap devices are I returned in this list. For operating systems like Windows which still use drive letters, this call will only return an entry for the first drive \"mounted on\" C. For information about the mapping of drive letters to partitions, see C. Please read L for more details. See also C." }; { defaults with name = "inspect_get_filesystems"; style = RStringList "filesystems", [Device "root"], []; shortdesc = "get filesystems associated with inspected operating system"; longdesc = "\ 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 non-mounted devices like swap partitions. In the case of a multi-boot virtual machine, it is possible for a filesystem to be shared between operating systems. Please read L for more details. See also C." }; { defaults with name = "set_network"; style = RErr, [Bool "network"], []; fish_alias = ["network"]; config_only = true; blocking = false; shortdesc = "set enable network flag"; longdesc = "\ If C is true, then the network is enabled in the libguestfs appliance. The default is false. This affects whether commands are able to access the network (see L). You must call this before calling C, otherwise it has no effect." }; { defaults with name = "get_network"; style = RBool "network", [], []; blocking = false; shortdesc = "get enable network flag"; longdesc = "\ This returns the enable network flag." }; { defaults with name = "list_filesystems"; style = RHashtable "fses", [], []; shortdesc = "list filesystems"; longdesc = "\ This inspection command looks for filesystems on partitions, block devices and logical volumes, returning a list of devices containing filesystems and their type. The return value is a hash, where the keys are the devices containing filesystems, and the values are the filesystem types. For example: \"/dev/sda1\" => \"ntfs\" \"/dev/sda2\" => \"ext2\" \"/dev/vg_guest/lv_root\" => \"ext4\" \"/dev/vg_guest/lv_swap\" => \"swap\" The value can have the special value \"unknown\", meaning the content of the device is undetermined or empty. \"swap\" means a Linux swap partition. This command runs other libguestfs commands, which might include C and C, and therefore you should use this soon after launch and only when nothing is mounted. Not all of the filesystems returned will be mountable. In particular, swap partitions are returned in the list. Also this command does not check that each filesystem found is valid and mountable, and some filesystems might be mountable but require special options. Filesystems may not all belong to a single logical operating system (use C to look for OSes)." }; { defaults with name = "add_drive"; style = RErr, [String "filename"], [OBool "readonly"; OString "format"; OString "iface"; OString "name"; OString "label"]; once_had_no_optargs = true; blocking = false; fish_alias = ["add"]; shortdesc = "add an image to examine or modify"; longdesc = "\ This function adds a disk image called C to the handle. C may be a regular host file or a host device. When this function is called before C (the usual case) then the first time you call this function, the disk appears in the API as C, the second time as C, and so on. In libguestfs E 1.20 you can also call this function after launch (with some restrictions). This is called \"hotplugging\". When hotplugging, you must specify a C