generator: Group and move APIs from actions.ml into actions_*.ml.

Group the APIs logically and move them into new modules:

Actions_core:
  Core APIs and anything that doesn't fit into another group, eg. launch.
  (With some more effort this could be split further.)

Actions_augeas:
  Augeas APIs, eg. aug-init.

Actions_debug:
  Debug APIs.

Actions_hivex:
  Hivex APIs, eg. hivex-open.

Actions_inspection:
  Inspection APIs, eg. inspect-get-type.

Actions_properties:
  Handle properties, eg. set-hv, get-hv.

Actions_tsk:
  SleuthKit APIs, eg. filesystem-walk.

*_deprecated:
  All of the above modules have deprecated variants, where we
  place the deprecated actions.
This commit is contained in:
Richard W.M. Jones
2017-02-18 10:32:33 +00:00
parent 736ee3586f
commit 97773d2bbe
24 changed files with 13681 additions and 13138 deletions

View File

@@ -349,7 +349,7 @@ To add a new API action there are two changes:
=item 1.
You need to add a description of the call (name, parameters, return
type, tests, documentation) to F<generator/actions.ml>.
type, tests, documentation) to F<generator/actions_*.ml>.
There are two sorts of API action, depending on whether the call goes
through to the daemon in the appliance, or is serviced entirely by the
@@ -395,12 +395,12 @@ the OCaml description.
You can supply zero or as many tests as you want per API call. The
tests can either be added as part of the API description
(F<generator/actions.ml>), or in some rarer cases you may want to drop
(F<generator/actions_*.ml>), or in some rarer cases you may want to drop
a script into C<tests/*/>. Note that adding a script to C<tests/*/>
is slower, so if possible use the first method.
The following describes the test environment used when you add an API
test in F<actions.ml>.
test in F<actions_*.ml>.
The test environment has 4 block devices:

View File

@@ -21,8 +21,28 @@ include $(top_srcdir)/subdir-rules.mk
sources = \
actions.ml \
actions.mli \
actions_augeas.ml \
actions_augeas.mli \
actions_core.ml \
actions_core.mli \
actions_core_deprecated.ml \
actions_core_deprecated.mli \
actions_debug.ml \
actions_debug.mli \
actions_hivex.ml \
actions_hivex.mli \
actions_inspection.ml \
actions_inspection.mli \
actions_inspection_deprecated.ml \
actions_inspection_deprecated.mli \
actions_internal_tests.ml \
actions_internal_tests.mli \
actions_properties.ml \
actions_properties.mli \
actions_properties_deprecated.ml \
actions_properties_deprecated.mli \
actions_tsk.ml \
actions_tsk.mli \
bindtests.ml \
bindtests.mli \
c.ml \
@@ -94,7 +114,17 @@ objects = \
common_utils.cmo \
types.cmo \
utils.cmo \
actions_augeas.cmo \
actions_core.cmo \
actions_core_deprecated.cmo \
actions_debug.cmo \
actions_hivex.cmo \
actions_inspection.cmo \
actions_inspection_deprecated.cmo \
actions_internal_tests.cmo \
actions_properties.cmo \
actions_properties_deprecated.cmo \
actions_tsk.cmo \
actions.cmo \
structs.cmo \
optgroups.cmo \

View File

@@ -2,7 +2,7 @@ This program generates a large amount of code and documentation for
all the daemon actions.
To add a new action there are only two files you need to change,
'actions.ml' to describe the interface, and daemon/<somefile>.c to
'actions_*.ml' to describe the interface, and daemon/<somefile>.c to
write the implementation.
After editing these files, build it (make -C generator) to regenerate
@@ -27,7 +27,7 @@ everything is exported.
Some notable files in this directory:
actions.ml The libguestfs API.
actions_*.ml The libguestfs API.
structs.ml Structures returned by the API.
c.ml Generate C API.
<lang>.ml Generate bindings for <lang>.

File diff suppressed because it is too large Load Diff

278
generator/actions_augeas.ml Normal file
View File

@@ -0,0 +1,278 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* Augeas APIs. *)
let daemon_functions = [
{ defaults with
name = "aug_init"; added = (0, 0, 7);
style = RErr, [Pathname "root"; Int "flags"], [];
proc_nr = Some 16;
tests = [
InitBasicFS, Always, TestResultString (
[["mkdir"; "/etc"];
["write"; "/etc/hostname"; "test.example.org"];
["aug_init"; "/"; "0"];
["aug_get"; "/files/etc/hostname/hostname"]], "test.example.org"), [["aug_close"]]
];
shortdesc = "create a new Augeas handle";
longdesc = "\
Create a new Augeas handle for editing configuration files.
If there was any previous Augeas handle associated with this
guestfs session, then it is closed.
You must call this before using any other C<guestfs_aug_*>
commands.
C<root> is the filesystem root. C<root> must not be NULL,
use F</> instead.
The flags are the same as the flags defined in
E<lt>augeas.hE<gt>, the logical I<or> of the following
integers:
=over 4
=item C<AUG_SAVE_BACKUP> = 1
Keep the original file with a C<.augsave> extension.
=item C<AUG_SAVE_NEWFILE> = 2
Save changes into a file with extension C<.augnew>, and
do not overwrite original. Overrides C<AUG_SAVE_BACKUP>.
=item C<AUG_TYPE_CHECK> = 4
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<LIBGUESTFS_MEMSIZE>
environment variable or call C<guestfs_set_memsize>.
=item C<AUG_NO_STDINC> = 8
Do not use standard load path for modules.
=item C<AUG_SAVE_NOOP> = 16
Make save a no-op, just record what would have been changed.
=item C<AUG_NO_LOAD> = 32
Do not load the tree in C<guestfs_aug_init>.
=back
To close the handle, you can call C<guestfs_aug_close>.
To find out more about Augeas, see L<http://augeas.net/>." };
{ defaults with
name = "aug_close"; added = (0, 0, 7);
style = RErr, [], [];
proc_nr = Some 26;
shortdesc = "close the current Augeas handle";
longdesc = "\
Close the current Augeas handle and free up any resources
used by it. After calling this, you have to call
C<guestfs_aug_init> again before you can use any other
Augeas functions." };
{ defaults with
name = "aug_defvar"; added = (0, 0, 7);
style = RInt "nrnodes", [String "name"; OptString "expr"], [];
proc_nr = Some 17;
shortdesc = "define an Augeas variable";
longdesc = "\
Defines an Augeas variable C<name> whose value is the result
of evaluating C<expr>. If C<expr> is NULL, then C<name> is
undefined.
On success this returns the number of nodes in C<expr>, or
C<0> if C<expr> evaluates to something which is not a nodeset." };
{ defaults with
name = "aug_defnode"; added = (0, 0, 7);
style = RStruct ("nrnodescreated", "int_bool"), [String "name"; String "expr"; String "val"], [];
proc_nr = Some 18;
shortdesc = "define an Augeas node";
longdesc = "\
Defines a variable C<name> whose value is the result of
evaluating C<expr>.
If C<expr> evaluates to an empty nodeset, a node is created,
equivalent to calling C<guestfs_aug_set> C<expr>, C<value>.
C<name> will be the nodeset containing that single node.
On success this returns a pair containing the
number of nodes in the nodeset, and a boolean flag
if a node was created." };
{ defaults with
name = "aug_get"; added = (0, 0, 7);
style = RString "val", [String "augpath"], [];
proc_nr = Some 19;
shortdesc = "look up the value of an Augeas path";
longdesc = "\
Look up the value associated with C<path>. If C<path>
matches exactly one node, the C<value> is returned." };
{ defaults with
name = "aug_set"; added = (0, 0, 7);
style = RErr, [String "augpath"; String "val"], [];
proc_nr = Some 20;
tests = [
InitBasicFS, Always, TestResultString (
[["mkdir"; "/etc"];
["write"; "/etc/hostname"; "test.example.org"];
["aug_init"; "/"; "0"];
["aug_set"; "/files/etc/hostname/hostname"; "replace.example.com"];
["aug_get"; "/files/etc/hostname/hostname"]], "replace.example.com"), [["aug_close"]]
];
shortdesc = "set Augeas path to value";
longdesc = "\
Set the value associated with C<path> to C<val>.
In the Augeas API, it is possible to clear a node by setting
the value to NULL. Due to an oversight in the libguestfs API
you cannot do that with this call. Instead you must use the
C<guestfs_aug_clear> call." };
{ defaults with
name = "aug_insert"; added = (0, 0, 7);
style = RErr, [String "augpath"; String "label"; Bool "before"], [];
proc_nr = Some 21;
tests = [
InitBasicFS, Always, TestResultString (
[["mkdir"; "/etc"];
["write"; "/etc/hosts"; ""];
["aug_init"; "/"; "0"];
["aug_insert"; "/files/etc/hosts"; "1"; "false"];
["aug_set"; "/files/etc/hosts/1/ipaddr"; "127.0.0.1"];
["aug_set"; "/files/etc/hosts/1/canonical"; "foobar"];
["aug_clear"; "/files/etc/hosts/1/canonical"];
["aug_set"; "/files/etc/hosts/1/canonical"; "localhost"];
["aug_save"];
["cat"; "/etc/hosts"]], "\n127.0.0.1\tlocalhost\n"), [["aug_close"]]
];
shortdesc = "insert a sibling Augeas node";
longdesc = "\
Create a new sibling C<label> for C<path>, inserting it into
the tree before or after C<path> (depending on the boolean
flag C<before>).
C<path> must match exactly one existing node in the tree, and
C<label> must be a label, ie. not contain F</>, C<*> or end
with a bracketed index C<[N]>." };
{ defaults with
name = "aug_rm"; added = (0, 0, 7);
style = RInt "nrnodes", [String "augpath"], [];
proc_nr = Some 22;
shortdesc = "remove an Augeas path";
longdesc = "\
Remove C<path> and all of its children.
On success this returns the number of entries which were removed." };
{ defaults with
name = "aug_mv"; added = (0, 0, 7);
style = RErr, [String "src"; String "dest"], [];
proc_nr = Some 23;
shortdesc = "move Augeas node";
longdesc = "\
Move the node C<src> to C<dest>. C<src> must match exactly
one node. C<dest> is overwritten if it exists." };
{ defaults with
name = "aug_match"; added = (0, 0, 7);
style = RStringList "matches", [String "augpath"], [];
proc_nr = Some 24;
shortdesc = "return Augeas nodes which match augpath";
longdesc = "\
Returns a list of paths which match the path expression C<path>.
The returned paths are sufficiently qualified so that they match
exactly one node in the current tree." };
{ defaults with
name = "aug_save"; added = (0, 0, 7);
style = RErr, [], [];
proc_nr = Some 25;
shortdesc = "write all pending Augeas changes to disk";
longdesc = "\
This writes all pending changes to disk.
The flags which were passed to C<guestfs_aug_init> affect exactly
how files are saved." };
{ defaults with
name = "aug_load"; added = (0, 0, 7);
style = RErr, [], [];
proc_nr = Some 27;
shortdesc = "load files into the tree";
longdesc = "\
Load files into the tree.
See C<aug_load> in the Augeas documentation for the full gory
details." };
{ defaults with
name = "aug_ls"; added = (0, 0, 8);
style = RStringList "matches", [String "augpath"], [];
proc_nr = Some 28;
tests = [
InitBasicFS, Always, TestResult (
[["mkdir"; "/etc"];
["write"; "/etc/hosts"; "127.0.0.1 localhost"];
["aug_init"; "/"; "0"];
["aug_ls"; "/files/etc/hosts/1"]],
"is_string_list (ret, 2, \"/files/etc/hosts/1/canonical\", \"/files/etc/hosts/1/ipaddr\")"), [["aug_close"]]
];
shortdesc = "list Augeas nodes under augpath";
longdesc = "\
This is just a shortcut for listing C<guestfs_aug_match>
C<path/*> and sorting the resulting nodes into alphabetical order." };
{ defaults with
name = "aug_clear"; added = (1, 3, 4);
style = RErr, [String "augpath"], [];
proc_nr = Some 239;
shortdesc = "clear Augeas path";
longdesc = "\
Set the value associated with C<path> to C<NULL>. This
is the same as the L<augtool(1)> C<clear> command." };
{ defaults with
name = "aug_transform"; added = (1, 35, 2);
style = RErr, [String "lens"; String "file"], [ OBool "remove"];
proc_nr = Some 469;
shortdesc = "add/remove an Augeas lens transformation";
longdesc = "\
Add an Augeas transformation for the specified C<lens> so it can
handle C<file>.
If C<remove> is true (C<false> by default), then the transformation
is removed." };
]

View File

@@ -0,0 +1,21 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val daemon_functions : Types.action list

10067
generator/actions_core.ml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list
val daemon_functions : Types.action list

View File

@@ -0,0 +1,793 @@
(* libguestfs
* Copyright (C) 2009-2017 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 Utils
open Types
(* "Core" APIs. All the APIs in this file are deprecated. *)
let non_daemon_functions = [
{ defaults with
name = "wait_ready"; added = (0, 0, 3);
style = RErr, [], [];
visibility = VStateTest;
deprecated_by = Some "launch";
blocking = false;
shortdesc = "wait until the hypervisor launches (no op)";
longdesc = "\
This function is a no op.
In versions of the API E<lt> 1.0.71 you had to call this function
just after calling C<guestfs_launch> to wait for the launch
to complete. However this is no longer necessary because
C<guestfs_launch> 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"; added = (0, 0, 3);
style = RErr, [], [];
deprecated_by = Some "shutdown";
shortdesc = "kill the hypervisor";
longdesc = "\
This kills the hypervisor.
Do not call this. See: C<guestfs_shutdown> instead." };
{ defaults with
name = "add_cdrom"; added = (0, 0, 3);
style = RErr, [String "filename"], [];
deprecated_by = Some "add_drive_ro"; 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.
The image is added as read-only drive, so this function is equivalent
of C<guestfs_add_drive_ro>." };
{ defaults with
name = "add_drive_with_if"; added = (1, 0, 84);
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<guestfs_add_drive> but it allows you
to specify the QEMU interface emulation to use at run time." };
{ defaults with
name = "add_drive_ro_with_if"; added = (1, 0, 84);
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<guestfs_add_drive_ro> but it allows you
to specify the QEMU interface emulation to use at run time." };
{ defaults with
name = "lstatlist"; added = (1, 0, 77);
style = RStructList ("statbufs", "stat"), [Pathname "path"; FilenameList "names"], [];
deprecated_by = Some "lstatnslist";
shortdesc = "lstat on multiple files";
longdesc = "\
This call allows you to perform the C<guestfs_lstat> operation
on multiple files, where all files are in the directory C<path>.
C<names> is the list of files from this directory.
On return you get a list of stat structs, with a one-to-one
correspondence to the C<names> list. If any name did not exist
or could not be lstat'd, then the C<st_ino> field of that structure
is set to C<-1>.
This call is intended for programs that want to efficiently
list a directory contents without making many round-trips.
See also C<guestfs_lxattrlist> for a similarly efficient call
for getting extended attributes." };
]
let daemon_functions = [
{ defaults with
name = "sfdisk"; added = (0, 0, 8);
style = RErr, [Device "device";
Int "cyls"; Int "heads"; Int "sectors";
StringList "lines"], [];
proc_nr = Some 43;
deprecated_by = Some "part_add";
shortdesc = "create partitions on a block device";
longdesc = "\
This is a direct interface to the L<sfdisk(8)> program for creating
partitions on block devices.
C<device> should be a block device, for example F</dev/sda>.
C<cyls>, C<heads> and C<sectors> are the number of cylinders, heads
and sectors on the device, which are passed directly to sfdisk as
the I<-C>, I<-H> and I<-S> parameters. If you pass C<0> for any
of these, then the corresponding parameter is omitted. Usually for
'large' disks, you can just pass C<0> for these, but for small
(floppy-sized) disks, sfdisk (or rather, the kernel) cannot work
out the right geometry and you will need to tell it.
C<lines> is a list of lines that we feed to C<sfdisk>. For more
information refer to the L<sfdisk(8)> manpage.
To create a single partition occupying the whole disk, you would
pass C<lines> as a single element list, when the single element being
the string C<,> (comma).
See also: C<guestfs_sfdisk_l>, C<guestfs_sfdisk_N>,
C<guestfs_part_init>" };
{ defaults with
name = "blockdev_setbsz"; added = (1, 9, 3);
style = RErr, [Device "device"; Int "blocksize"], [];
proc_nr = Some 61;
deprecated_by = Some "mkfs";
shortdesc = "set blocksize of block device";
longdesc = "\
This call does nothing and has never done anything
because of a bug in blockdev. B<Do not use it.>
If you need to set the filesystem block size, use the
C<blocksize> option of C<guestfs_mkfs>." };
{ defaults with
name = "tgz_in"; added = (1, 0, 3);
style = RErr, [FileIn "tarball"; Pathname "directory"], [];
proc_nr = Some 71;
deprecated_by = Some "tar_in";
cancellable = true;
tests = [
InitScratchFS, Always, TestResultString (
[["mkdir"; "/tgz_in"];
["tgz_in"; "$srcdir/../../test-data/files/helloworld.tar.gz"; "/tgz_in"];
["cat"; "/tgz_in/hello"]], "hello\n"), []
];
shortdesc = "unpack compressed tarball to directory";
longdesc = "\
This command uploads and unpacks local file C<tarball> (a
I<gzip compressed> tar file) into F<directory>." };
{ defaults with
name = "tgz_out"; added = (1, 0, 3);
style = RErr, [Pathname "directory"; FileOut "tarball"], [];
proc_nr = Some 72;
deprecated_by = Some "tar_out";
cancellable = true;
shortdesc = "pack directory into compressed tarball";
longdesc = "\
This command packs the contents of F<directory> and downloads
it to local file C<tarball>." };
{ defaults with
name = "set_e2label"; added = (1, 0, 15);
style = RErr, [Device "device"; String "label"], [];
proc_nr = Some 80;
deprecated_by = Some "set_label";
tests = [
InitBasicFS, Always, TestResultString (
[["set_e2label"; "/dev/sda1"; "testlabel"];
["get_e2label"; "/dev/sda1"]], "testlabel"), []
];
shortdesc = "set the ext2/3/4 filesystem label";
longdesc = "\
This sets the ext2/3/4 filesystem label of the filesystem on
C<device> to C<label>. Filesystem labels are limited to
16 characters.
You can use either C<guestfs_tune2fs_l> or C<guestfs_get_e2label>
to return the existing label on a filesystem." };
{ defaults with
name = "get_e2label"; added = (1, 0, 15);
style = RString "label", [Device "device"], [];
proc_nr = Some 81;
deprecated_by = Some "vfs_label";
shortdesc = "get the ext2/3/4 filesystem label";
longdesc = "\
This returns the ext2/3/4 filesystem label of the filesystem on
C<device>." };
{ defaults with
name = "set_e2uuid"; added = (1, 0, 15);
style = RErr, [Device "device"; String "uuid"], [];
proc_nr = Some 82;
deprecated_by = Some "set_uuid";
tests = [
InitBasicFS, Always, TestResultString (
[["set_e2uuid"; "/dev/sda1"; stable_uuid];
["get_e2uuid"; "/dev/sda1"]], stable_uuid), [];
InitBasicFS, Always, TestResultString (
[["set_e2uuid"; "/dev/sda1"; "clear"];
["get_e2uuid"; "/dev/sda1"]], ""), [];
(* We can't predict what UUIDs will be, so just check
the commands run. *)
InitBasicFS, Always, TestRun (
[["set_e2uuid"; "/dev/sda1"; "random"]]), [];
InitBasicFS, Always, TestRun (
[["set_e2uuid"; "/dev/sda1"; "time"]]), []
];
shortdesc = "set the ext2/3/4 filesystem UUID";
longdesc = "\
This sets the ext2/3/4 filesystem UUID of the filesystem on
C<device> to C<uuid>. The format of the UUID and alternatives
such as C<clear>, C<random> and C<time> are described in the
L<tune2fs(8)> manpage.
You can use C<guestfs_vfs_uuid> to return the existing UUID
of a filesystem." };
{ defaults with
name = "get_e2uuid"; added = (1, 0, 15);
style = RString "uuid", [Device "device"], [];
proc_nr = Some 83;
deprecated_by = Some "vfs_uuid";
tests = [
(* We can't predict what UUID will be, so just check
the command run; regression test for RHBZ#597112. *)
InitNone, Always, TestRun (
[["mke2journal"; "1024"; "/dev/sdc"];
["get_e2uuid"; "/dev/sdc"]]), []
];
shortdesc = "get the ext2/3/4 filesystem UUID";
longdesc = "\
This returns the ext2/3/4 filesystem UUID of the filesystem on
C<device>." };
{ defaults with
name = "sfdisk_N"; added = (1, 0, 26);
style = RErr, [Device "device"; Int "partnum";
Int "cyls"; Int "heads"; Int "sectors";
String "line"], [];
proc_nr = Some 99;
deprecated_by = Some "part_add";
shortdesc = "modify a single partition on a block device";
longdesc = "\
This runs L<sfdisk(8)> option to modify just the single
partition C<n> (note: C<n> counts from 1).
For other parameters, see C<guestfs_sfdisk>. You should usually
pass C<0> for the cyls/heads/sectors parameters.
See also: C<guestfs_part_add>" };
{ defaults with
name = "sfdisk_l"; added = (1, 0, 26);
style = RString "partitions", [Device "device"], [];
proc_nr = Some 100;
deprecated_by = Some "part_list";
shortdesc = "display the partition table";
longdesc = "\
This displays the partition table on C<device>, in the
human-readable output of the L<sfdisk(8)> command. It is
not intended to be parsed.
See also: C<guestfs_part_list>" };
{ defaults with
name = "e2fsck_f"; added = (1, 0, 29);
style = RErr, [Device "device"], [];
proc_nr = Some 108;
deprecated_by = Some "e2fsck";
shortdesc = "check an ext2/ext3 filesystem";
longdesc = "\
This runs C<e2fsck -p -f device>, ie. runs the ext2/ext3
filesystem checker on C<device>, noninteractively (I<-p>),
even if the filesystem appears to be clean (I<-f>)." };
{ defaults with
name = "mkswap_L"; added = (1, 0, 55);
style = RErr, [String "label"; Device "device"], [];
proc_nr = Some 131;
deprecated_by = Some "mkswap";
tests = [
InitEmpty, Always, TestRun (
[["part_disk"; "/dev/sda"; "mbr"];
["mkswap_L"; "hello"; "/dev/sda1"]]), []
];
shortdesc = "create a swap partition with a label";
longdesc = "\
Create a swap partition on C<device> with label C<label>.
Note that you cannot attach a swap label to a block device
(eg. F</dev/sda>), just to a partition. This appears to be
a limitation of the kernel or swap tools." };
{ defaults with
name = "mkswap_U"; added = (1, 0, 55);
style = RErr, [String "uuid"; Device "device"], [];
proc_nr = Some 132;
deprecated_by = Some "mkswap";
optional = Some "linuxfsuuid";
tests = [
InitEmpty, Always, TestRun (
[["part_disk"; "/dev/sda"; "mbr"];
["mkswap_U"; stable_uuid; "/dev/sda1"]]), []
];
shortdesc = "create a swap partition with an explicit UUID";
longdesc = "\
Create a swap partition on C<device> with UUID C<uuid>." };
{ defaults with
name = "sfdiskM"; added = (1, 0, 55);
style = RErr, [Device "device"; StringList "lines"], [];
proc_nr = Some 139;
deprecated_by = Some "part_add";
shortdesc = "create partitions on a block device";
longdesc = "\
This is a simplified interface to the C<guestfs_sfdisk>
command, where partition sizes are specified in megabytes
only (rounded to the nearest cylinder) and you don't need
to specify the cyls, heads and sectors parameters which
were rarely if ever used anyway.
See also: C<guestfs_sfdisk>, the L<sfdisk(8)> manpage
and C<guestfs_part_disk>" };
{ defaults with
name = "zfile"; added = (1, 0, 59);
style = RString "description", [String "meth"; Pathname "path"], [];
proc_nr = Some 140;
deprecated_by = Some "file";
shortdesc = "determine file type inside a compressed file";
longdesc = "\
This command runs F<file> after first decompressing C<path>
using C<method>.
C<method> must be one of C<gzip>, C<compress> or C<bzip2>.
Since 1.0.63, use C<guestfs_file> instead which can now
process compressed files." };
{ defaults with
name = "egrep"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 152;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["egrep"; "abc"; "/test-grep.txt"]],
"is_string_list (ret, 2, \"abc\", \"abc123\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<egrep> program and returns the
matching lines." };
{ defaults with
name = "fgrep"; added = (1, 0, 66);
style = RStringList "lines", [String "pattern"; Pathname "path"], [];
proc_nr = Some 153;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["fgrep"; "abc"; "/test-grep.txt"]],
"is_string_list (ret, 2, \"abc\", \"abc123\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<fgrep> program and returns the
matching lines." };
{ defaults with
name = "grepi"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 154;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["grepi"; "abc"; "/test-grep.txt"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<grep -i> program and returns the
matching lines." };
{ defaults with
name = "egrepi"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 155;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["egrepi"; "abc"; "/test-grep.txt"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<egrep -i> program and returns the
matching lines." };
{ defaults with
name = "fgrepi"; added = (1, 0, 66);
style = RStringList "lines", [String "pattern"; Pathname "path"], [];
proc_nr = Some 156;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["fgrepi"; "abc"; "/test-grep.txt"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<fgrep -i> program and returns the
matching lines." };
{ defaults with
name = "zgrep"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 157;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zgrep"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 2, \"abc\", \"abc123\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zgrep> program and returns the
matching lines." };
{ defaults with
name = "zegrep"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 158;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zegrep"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 2, \"abc\", \"abc123\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zegrep> program and returns the
matching lines." };
{ defaults with
name = "zfgrep"; added = (1, 0, 66);
style = RStringList "lines", [String "pattern"; Pathname "path"], [];
proc_nr = Some 159;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zfgrep"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 2, \"abc\", \"abc123\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zfgrep> program and returns the
matching lines." };
{ defaults with
name = "zgrepi"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 160;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zgrepi"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zgrep -i> program and returns the
matching lines." };
{ defaults with
name = "zegrepi"; added = (1, 0, 66);
style = RStringList "lines", [String "regex"; Pathname "path"], [];
proc_nr = Some 161;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zegrepi"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zegrep -i> program and returns the
matching lines." };
{ defaults with
name = "zfgrepi"; added = (1, 0, 66);
style = RStringList "lines", [String "pattern"; Pathname "path"], [];
proc_nr = Some 162;
protocol_limit_warning = true;
deprecated_by = Some "grep";
tests = [
InitISOFS, Always, TestResult (
[["zfgrepi"; "abc"; "/test-grep.txt.gz"]],
"is_string_list (ret, 3, \"abc\", \"abc123\", \"ABC\")"), []
];
shortdesc = "return lines matching a pattern";
longdesc = "\
This calls the external C<zfgrep -i> program and returns the
matching lines." };
{ defaults with
name = "fallocate"; added = (1, 0, 66);
style = RErr, [Pathname "path"; Int "len"], [];
proc_nr = Some 169;
deprecated_by = Some "fallocate64";
tests = [
InitScratchFS, Always, TestResult (
[["fallocate"; "/fallocate"; "1000000"];
["stat"; "/fallocate"]], "ret->size == 1000000"), []
];
shortdesc = "preallocate a file in the guest filesystem";
longdesc = "\
This command preallocates a file (containing zero bytes) named
C<path> of size C<len> bytes. If the file exists already, it
is overwritten.
Do not confuse this with the guestfish-specific
C<alloc> command which allocates a file in the host and
attaches it as a device." };
{ defaults with
name = "setcon"; added = (1, 0, 67);
style = RErr, [String "context"], [];
proc_nr = Some 185;
optional = Some "selinux";
deprecated_by = Some "selinux_relabel";
shortdesc = "set SELinux security context";
longdesc = "\
This sets the SELinux security context of the daemon
to the string C<context>.
See the documentation about SELINUX in L<guestfs(3)>." };
{ defaults with
name = "getcon"; added = (1, 0, 67);
style = RString "context", [], [];
proc_nr = Some 186;
optional = Some "selinux";
deprecated_by = Some "selinux_relabel";
shortdesc = "get SELinux security context";
longdesc = "\
This gets the SELinux security context of the daemon.
See the documentation about SELINUX in L<guestfs(3)>,
and C<guestfs_setcon>" };
{ defaults with
name = "mkfs_b"; added = (1, 0, 68);
style = RErr, [String "fstype"; Int "blocksize"; Device "device"], [];
proc_nr = Some 187;
deprecated_by = Some "mkfs";
tests = [
InitEmpty, Always, TestResultString (
[["part_disk"; "/dev/sda"; "mbr"];
["mkfs_b"; "ext2"; "4096"; "/dev/sda1"];
["mount"; "/dev/sda1"; "/"];
["write"; "/new"; "new file contents"];
["cat"; "/new"]], "new file contents"), [];
InitEmpty, Always, TestRun (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["mkfs_b"; "vfat"; "32768"; "/dev/sda1"]]), [];
InitEmpty, Always, TestLastFail (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["mkfs_b"; "vfat"; "32769"; "/dev/sda1"]]), [];
InitEmpty, Always, TestLastFail (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["mkfs_b"; "vfat"; "33280"; "/dev/sda1"]]), [];
InitEmpty, IfAvailable "ntfsprogs", TestRun (
[["part_disk"; "/dev/sda"; "mbr"];
["mkfs_b"; "ntfs"; "32768"; "/dev/sda1"]]), []
];
shortdesc = "make a filesystem with block size";
longdesc = "\
This call is similar to C<guestfs_mkfs>, but it allows you to
control the block size of the resulting filesystem. Supported
block sizes depend on the filesystem type, but typically they
are C<1024>, C<2048> or C<4096> only.
For VFAT and NTFS the C<blocksize> parameter is treated as
the requested cluster size." };
{ defaults with
name = "mke2journal"; added = (1, 0, 68);
style = RErr, [Int "blocksize"; Device "device"], [];
proc_nr = Some 188;
deprecated_by = Some "mke2fs";
tests = [
InitEmpty, Always, TestResultString (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
["mke2journal"; "4096"; "/dev/sda1"];
["mke2fs_J"; "ext2"; "4096"; "/dev/sda2"; "/dev/sda1"];
["mount"; "/dev/sda2"; "/"];
["write"; "/new"; "new file contents"];
["cat"; "/new"]], "new file contents"), []
];
shortdesc = "make ext2/3/4 external journal";
longdesc = "\
This creates an ext2 external journal on C<device>. It is equivalent
to the command:
mke2fs -O journal_dev -b blocksize device" };
{ defaults with
name = "mke2journal_L"; added = (1, 0, 68);
style = RErr, [Int "blocksize"; String "label"; Device "device"], [];
proc_nr = Some 189;
deprecated_by = Some "mke2fs";
tests = [
InitEmpty, Always, TestResultString (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
["mke2journal_L"; "4096"; "JOURNAL"; "/dev/sda1"];
["mke2fs_JL"; "ext2"; "4096"; "/dev/sda2"; "JOURNAL"];
["mount"; "/dev/sda2"; "/"];
["write"; "/new"; "new file contents"];
["cat"; "/new"]], "new file contents"), []
];
shortdesc = "make ext2/3/4 external journal with label";
longdesc = "\
This creates an ext2 external journal on C<device> with label C<label>." };
{ defaults with
name = "mke2journal_U"; added = (1, 0, 68);
style = RErr, [Int "blocksize"; String "uuid"; Device "device"], [];
proc_nr = Some 190;
deprecated_by = Some "mke2fs";
optional = Some "linuxfsuuid";
tests = [
InitEmpty, Always, TestResultString (
[["part_init"; "/dev/sda"; "mbr"];
["part_add"; "/dev/sda"; "p"; "64"; "204799"];
["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
["mke2journal_U"; "4096"; stable_uuid; "/dev/sda1"];
["mke2fs_JU"; "ext2"; "4096"; "/dev/sda2"; stable_uuid];
["mount"; "/dev/sda2"; "/"];
["write"; "/new"; "new file contents"];
["cat"; "/new"]], "new file contents"), []
];
shortdesc = "make ext2/3/4 external journal with UUID";
longdesc = "\
This creates an ext2 external journal on C<device> with UUID C<uuid>." };
{ defaults with
name = "mke2fs_J"; added = (1, 0, 68);
style = RErr, [String "fstype"; Int "blocksize"; Device "device"; Device "journal"], [];
proc_nr = Some 191;
deprecated_by = Some "mke2fs";
shortdesc = "make ext2/3/4 filesystem with external journal";
longdesc = "\
This creates an ext2/3/4 filesystem on C<device> with
an external journal on C<journal>. It is equivalent
to the command:
mke2fs -t fstype -b blocksize -J device=<journal> <device>
See also C<guestfs_mke2journal>." };
{ defaults with
name = "mke2fs_JL"; added = (1, 0, 68);
style = RErr, [String "fstype"; Int "blocksize"; Device "device"; String "label"], [];
proc_nr = Some 192;
deprecated_by = Some "mke2fs";
shortdesc = "make ext2/3/4 filesystem with external journal";
longdesc = "\
This creates an ext2/3/4 filesystem on C<device> with
an external journal on the journal labeled C<label>.
See also C<guestfs_mke2journal_L>." };
{ defaults with
name = "mke2fs_JU"; added = (1, 0, 68);
style = RErr, [String "fstype"; Int "blocksize"; Device "device"; String "uuid"], [];
proc_nr = Some 193;
deprecated_by = Some "mke2fs";
optional = Some "linuxfsuuid";
shortdesc = "make ext2/3/4 filesystem with external journal";
longdesc = "\
This creates an ext2/3/4 filesystem on C<device> with
an external journal on the journal with UUID C<uuid>.
See also C<guestfs_mke2journal_U>." };
{ defaults with
name = "dd"; added = (1, 0, 80);
style = RErr, [Dev_or_Path "src"; Dev_or_Path "dest"], [];
proc_nr = Some 217;
deprecated_by = Some "copy_device_to_device";
tests = [
InitScratchFS, Always, TestResult (
[["mkdir"; "/dd"];
["write"; "/dd/src"; "hello, world"];
["dd"; "/dd/src"; "/dd/dest"];
["read_file"; "/dd/dest"]],
"compare_buffers (ret, size, \"hello, world\", 12) == 0"), []
];
shortdesc = "copy from source to destination using dd";
longdesc = "\
This command copies from one source device or file C<src>
to another destination device or file C<dest>. Normally you
would use this to copy to or from a device or partition, for
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<guestfs_copy_device_to_device>)." };
{ defaults with
name = "txz_in"; added = (1, 3, 2);
style = RErr, [FileIn "tarball"; Pathname "directory"], [];
proc_nr = Some 229;
deprecated_by = Some "tar_in";
optional = Some "xz"; cancellable = true;
tests = [
InitScratchFS, Always, TestResultString (
[["mkdir"; "/txz_in"];
["txz_in"; "$srcdir/../../test-data/files/helloworld.tar.xz"; "/txz_in"];
["cat"; "/txz_in/hello"]], "hello\n"), []
];
shortdesc = "unpack compressed tarball to directory";
longdesc = "\
This command uploads and unpacks local file C<tarball> (an
I<xz compressed> tar file) into F<directory>." };
{ defaults with
name = "txz_out"; added = (1, 3, 2);
style = RErr, [Pathname "directory"; FileOut "tarball"], [];
proc_nr = Some 230;
deprecated_by = Some "tar_out";
optional = Some "xz"; cancellable = true;
shortdesc = "pack directory into compressed tarball";
longdesc = "\
This command packs the contents of F<directory> and downloads
it to local file C<tarball> (as an xz compressed tar archive)." };
{ defaults with
name = "llz"; added = (1, 17, 6);
style = RString "listing", [Pathname "directory"], [];
proc_nr = Some 305;
deprecated_by = Some "lgetxattrs";
shortdesc = "list the files in a directory (long format with SELinux contexts)";
longdesc = "\
List the files in F<directory> in the format of 'ls -laZ'.
This command is mostly useful for interactive sessions. It
is I<not> intended that you try to parse the output string." };
]

View File

@@ -0,0 +1,22 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list
val daemon_functions : Types.action list

View File

@@ -0,0 +1,69 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* Debug APIs. *)
let non_daemon_functions = [
{ defaults with
name = "debug_drives"; added = (1, 13, 22);
style = RStringList "cmdline", [], [];
visibility = VDebug;
blocking = false;
shortdesc = "debug the drives (internal use only)";
longdesc = "\
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." };
]
let daemon_functions = [
{ defaults with
name = "debug"; added = (1, 0, 11);
style = RString "result", [String "subcmd"; StringList "extraargs"], [];
proc_nr = Some 76;
visibility = VDebug;
shortdesc = "debugging and internals";
longdesc = "\
The C<guestfs_debug> command exposes some internals of
C<guestfsd> (the guestfs daemon) that runs inside the
hypervisor.
There is no comprehensive help for this command. You have
to look at the file F<daemon/debug.c> in the libguestfs source
to find out what you can do." };
{ defaults with
name = "debug_upload"; added = (1, 3, 5);
style = RErr, [FileIn "filename"; String "tmpname"; Int "mode"], [];
proc_nr = Some 241;
visibility = VDebug;
cancellable = true;
shortdesc = "upload a file to the appliance (internal use only)";
longdesc = "\
The C<guestfs_debug_upload> command uploads a file to
the libguestfs appliance.
There is no comprehensive help for this command. You have
to look at the file F<daemon/debug.c> in the libguestfs source
to find out what it is for." };
]

View File

@@ -0,0 +1,22 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list
val daemon_functions : Types.action list

254
generator/actions_hivex.ml Normal file
View File

@@ -0,0 +1,254 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* Hivex APIs. *)
let non_daemon_functions = [
{ defaults with
name = "hivex_value_utf8"; added = (1, 19, 35);
style = RString "databuf", [Int64 "valueh"], [];
optional = Some "hivex";
shortdesc = "return the data field from the (key, datatype, data) tuple";
longdesc = "\
This calls C<guestfs_hivex_value_value> (which returns the
data field from a hivex value tuple). It then assumes that
the field is a UTF-16LE string and converts the result to
UTF-8 (or if this is not possible, it returns an error).
This is useful for reading strings out of the Windows registry.
However it is not foolproof because the registry is not
strongly-typed and fields can contain arbitrary or unexpected
data." };
]
let daemon_functions = [
{ defaults with
name = "hivex_open"; added = (1, 19, 35);
style = RErr, [Pathname "filename"], [OBool "verbose"; OBool "debug"; OBool "write"; OBool "unsafe"];
proc_nr = Some 350;
optional = Some "hivex";
tests = [
InitScratchFS, Always, TestRun (
[["upload"; "$srcdir/../../test-data/files/minimal"; "/hivex_open"];
["hivex_open"; "/hivex_open"; ""; ""; "false"; ""];
["hivex_root"]; (* in this hive, it returns 0x1020 *)
["hivex_node_name"; "0x1020"];
["hivex_node_children"; "0x1020"];
["hivex_node_values"; "0x1020"]]), [["hivex_close"]]
];
shortdesc = "open a Windows Registry hive file";
longdesc = "\
Open the Windows Registry hive file named F<filename>.
If there was any previous hivex handle associated with this
guestfs session, then it is closed.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_close"; added = (1, 19, 35);
style = RErr, [], [];
proc_nr = Some 351;
optional = Some "hivex";
shortdesc = "close the current hivex handle";
longdesc = "\
Close the current hivex handle.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_root"; added = (1, 19, 35);
style = RInt64 "nodeh", [], [];
proc_nr = Some 352;
optional = Some "hivex";
shortdesc = "return the root node of the hive";
longdesc = "\
Return the root node of the hive.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_name"; added = (1, 19, 35);
style = RString "name", [Int64 "nodeh"], [];
proc_nr = Some 353;
optional = Some "hivex";
shortdesc = "return the name of the node";
longdesc = "\
Return the name of C<nodeh>.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_children"; added = (1, 19, 35);
style = RStructList ("nodehs", "hivex_node"), [Int64 "nodeh"], [];
proc_nr = Some 354;
optional = Some "hivex";
shortdesc = "return list of nodes which are subkeys of node";
longdesc = "\
Return the list of nodes which are subkeys of C<nodeh>.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_get_child"; added = (1, 19, 35);
style = RInt64 "child", [Int64 "nodeh"; String "name"], [];
proc_nr = Some 355;
optional = Some "hivex";
shortdesc = "return the named child of node";
longdesc = "\
Return the child of C<nodeh> with the name C<name>, if it exists.
This can return C<0> meaning the name was not found.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_parent"; added = (1, 19, 35);
style = RInt64 "parent", [Int64 "nodeh"], [];
proc_nr = Some 356;
optional = Some "hivex";
shortdesc = "return the parent of node";
longdesc = "\
Return the parent node of C<nodeh>.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_values"; added = (1, 19, 35);
style = RStructList ("valuehs", "hivex_value"), [Int64 "nodeh"], [];
proc_nr = Some 357;
optional = Some "hivex";
shortdesc = "return list of values attached to node";
longdesc = "\
Return the array of (key, datatype, data) tuples attached to C<nodeh>.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_get_value"; added = (1, 19, 35);
style = RInt64 "valueh", [Int64 "nodeh"; String "key"], [];
proc_nr = Some 358;
optional = Some "hivex";
shortdesc = "return the named value";
longdesc = "\
Return the value attached to C<nodeh> which has the
name C<key>, if it exists. This can return C<0> meaning
the key was not found.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_value_key"; added = (1, 19, 35);
style = RString "key", [Int64 "valueh"], [];
proc_nr = Some 359;
optional = Some "hivex";
shortdesc = "return the key field from the (key, datatype, data) tuple";
longdesc = "\
Return the key (name) field of a (key, datatype, data) tuple.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_value_type"; added = (1, 19, 35);
style = RInt64 "datatype", [Int64 "valueh"], [];
proc_nr = Some 360;
optional = Some "hivex";
shortdesc = "return the data type from the (key, datatype, data) tuple";
longdesc = "\
Return the data type field from a (key, datatype, data) tuple.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_value_value"; added = (1, 19, 35);
style = RBufferOut "databuf", [Int64 "valueh"], [];
proc_nr = Some 361;
optional = Some "hivex";
shortdesc = "return the data field from the (key, datatype, data) tuple";
longdesc = "\
Return the data field of a (key, datatype, data) tuple.
This is a wrapper around the L<hivex(3)> call of the same name.
See also: C<guestfs_hivex_value_utf8>." };
{ defaults with
name = "hivex_commit"; added = (1, 19, 35);
style = RErr, [OptString "filename"], [];
proc_nr = Some 362;
optional = Some "hivex";
tests = [
InitScratchFS, Always, TestRun (
[["upload"; "$srcdir/../../test-data/files/minimal"; "/hivex_commit1"];
["hivex_open"; "/hivex_commit1"; ""; ""; "true"; ""];
["hivex_commit"; "NULL"]]), [["hivex_close"]];
InitScratchFS, Always, TestResultTrue (
[["upload"; "$srcdir/../../test-data/files/minimal"; "/hivex_commit2"];
["hivex_open"; "/hivex_commit2"; ""; ""; "true"; ""];
["hivex_commit"; "/hivex_commit2_copy"];
["is_file"; "/hivex_commit2_copy"; "false"]]), [["hivex_close"]]
];
shortdesc = "commit (write) changes back to the hive";
longdesc = "\
Commit (write) changes to the hive.
If the optional F<filename> parameter is null, then the changes
are written back to the same hive that was opened. If this is
not null then they are written to the alternate filename given
and the original hive is left untouched.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_add_child"; added = (1, 19, 35);
style = RInt64 "nodeh", [Int64 "parent"; String "name"], [];
proc_nr = Some 363;
optional = Some "hivex";
shortdesc = "add a child node";
longdesc = "\
Add a child node to C<parent> named C<name>.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_delete_child"; added = (1, 19, 35);
style = RErr, [Int64 "nodeh"], [];
proc_nr = Some 364;
optional = Some "hivex";
shortdesc = "delete a node (recursively)";
longdesc = "\
Delete C<nodeh>, recursively if necessary.
This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_set_value"; added = (1, 19, 35);
style = RErr, [Int64 "nodeh"; String "key"; Int64 "t"; BufferIn "val"], [];
proc_nr = Some 365;
optional = Some "hivex";
shortdesc = "set or replace a single value in a node";
longdesc = "\
Set or replace a single value under the node C<nodeh>. The
C<key> is the name, C<t> is the type, and C<val> is the data.
This is a wrapper around the L<hivex(3)> call of the same name." };
]

View File

@@ -0,0 +1,22 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list
val daemon_functions : Types.action list

View File

@@ -0,0 +1,810 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* Inspection APIs. *)
let non_daemon_functions = [
{ defaults with
name = "inspect_os"; added = (1, 5, 3);
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<guestfs_inspect_get_*> 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<guestfs_mount_ro> and C<guestfs_umount_all> 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<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_list_filesystems>." };
{ defaults with
name = "inspect_get_type"; added = (1, 5, 3);
style = RString "name", [Mountable "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 \"minix\"
MINIX.
=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<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_arch"; added = (1, 5, 3);
style = RString "arch", [Mountable "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<guestfs_file_architecture>.
If the architecture could not be determined, then the
string C<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_distro"; added = (1, 5, 3);
style = RString "distro", [Mountable "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 \"alpinelinux\"
Alpine Linux.
=item \"altlinux\"
ALT Linux.
=item \"archlinux\"
Arch Linux.
=item \"buildroot\"
Buildroot-derived distro, but not one we specifically recognize.
=item \"centos\"
CentOS.
=item \"cirros\"
Cirros.
=item \"coreos\"
CoreOS.
=item \"debian\"
Debian.
=item \"fedora\"
Fedora.
=item \"freebsd\"
FreeBSD.
=item \"freedos\"
FreeDOS.
=item \"frugalware\"
Frugalware.
=item \"gentoo\"
Gentoo.
=item \"linuxmint\"
Linux Mint.
=item \"mageia\"
Mageia.
=item \"mandriva\"
Mandriva.
=item \"meego\"
MeeGo.
=item \"netbsd\"
NetBSD.
=item \"openbsd\"
OpenBSD.
=item \"opensuse\"
OpenSUSE.
=item \"oraclelinux\"
Oracle Linux.
=item \"pardus\"
Pardus.
=item \"pldlinux\"
PLD Linux.
=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 \"voidlinux\"
Void Linux.
=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<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_major_version"; added = (1, 5, 3);
style = RInt "major", [Mountable "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<not>
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<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_minor_version"; added = (1, 5, 3);
style = RInt "minor", [Mountable "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<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_major_version>." };
{ defaults with
name = "inspect_get_product_name"; added = (1, 5, 3);
style = RString "product", [Mountable "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<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_mountpoints"; added = (1, 5, 3);
style = RHashtable "mountpoints", [Mountable "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 F</etc/fstab>.
I<In particular note> 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. F</boot>) and a value
which is the filesystem that would be mounted there
(eg. F</dev/sda1>).
Non-mounted devices such as swap devices are I<not>
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\" F</>. For information about the
mapping of drive letters to partitions, see
C<guestfs_inspect_get_drive_mappings>.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_filesystems>." };
{ defaults with
name = "inspect_get_filesystems"; added = (1, 5, 3);
style = RStringList "filesystems", [Mountable "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<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_mountpoints>." };
{ defaults with
name = "inspect_get_windows_systemroot"; added = (1, 5, 25);
style = RString "systemroot", [Mountable "root"], [];
shortdesc = "get Windows systemroot of inspected operating system";
longdesc = "\
This returns the Windows systemroot of the inspected guest.
The systemroot is a directory path such as F</WINDOWS>.
This call assumes that the guest is Windows and that the
systemroot could be determined by inspection. If this is not
the case then an error is returned.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_roots"; added = (1, 7, 3);
style = RStringList "roots", [], [];
shortdesc = "return list of operating systems found by last inspection";
longdesc = "\
This function is a convenient way to get the list of root
devices, as returned from a previous call to C<guestfs_inspect_os>,
but without redoing the whole inspection process.
This returns an empty list if either no root devices were
found or the caller has not called C<guestfs_inspect_os>.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_package_format"; added = (1, 7, 5);
style = RString "packageformat", [Mountable "root"], [];
shortdesc = "get package format used by the operating system";
longdesc = "\
This function and C<guestfs_inspect_get_package_management> return
the package format and package management tool used by the
inspected operating system. For example for Fedora these
functions would return C<rpm> (package format), and
C<yum> or C<dnf> (package management).
This returns the string C<unknown> if we could not determine the
package format I<or> if the operating system does not have
a real packaging system (eg. Windows).
Possible strings include:
C<rpm>, C<deb>, C<ebuild>, C<pisi>, C<pacman>, C<pkgsrc>, C<apk>,
C<xbps>.
Future versions of libguestfs may return other strings.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_package_management"; added = (1, 7, 5);
style = RString "packagemanagement", [Mountable "root"], [];
shortdesc = "get package management tool used by the operating system";
longdesc = "\
C<guestfs_inspect_get_package_format> and this function return
the package format and package management tool used by the
inspected operating system. For example for Fedora these
functions would return C<rpm> (package format), and
C<yum> or C<dnf> (package management).
This returns the string C<unknown> if we could not determine the
package management tool I<or> if the operating system does not have
a real packaging system (eg. Windows).
Possible strings include: C<yum>, C<dnf>, C<up2date>,
C<apt> (for all Debian derivatives),
C<portage>, C<pisi>, C<pacman>, C<urpmi>, C<zypper>, C<apk>, C<xbps>.
Future versions of libguestfs may return other strings.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_list_applications2"; added = (1, 19, 56);
style = RStructList ("applications2", "application2"), [Mountable "root"], [];
shortdesc = "get list of applications installed in the operating system";
longdesc = "\
Return the list of applications installed in the operating system.
I<Note:> This call works differently from other parts of the
inspection API. You have to call C<guestfs_inspect_os>, then
C<guestfs_inspect_get_mountpoints>, then mount up the disks,
before calling this. Listing applications is a significantly
more difficult operation which requires access to the full
filesystem. Also note that unlike the other
C<guestfs_inspect_get_*> calls which are just returning
data cached in the libguestfs handle, this call actually reads
parts of the mounted filesystems during the call.
This returns an empty list if the inspection code was not able
to determine the list of applications.
The application structure contains the following fields:
=over 4
=item C<app2_name>
The name of the application. For Red Hat-derived and Debian-derived
Linux guests, this is the package name.
=item C<app2_display_name>
The display name of the application, sometimes localized to the
install language of the guest operating system.
If unavailable this is returned as an empty string C<\"\">.
Callers needing to display something can use C<app2_name> instead.
=item C<app2_epoch>
For package managers which use epochs, this contains the epoch of
the package (an integer). If unavailable, this is returned as C<0>.
=item C<app2_version>
The version string of the application or package. If unavailable
this is returned as an empty string C<\"\">.
=item C<app2_release>
The release string of the application or package, for package
managers that use this. If unavailable this is returned as an
empty string C<\"\">.
=item C<app2_arch>
The architecture string of the application or package, for package
managers that use this. If unavailable this is returned as an empty
string C<\"\">.
=item C<app2_install_path>
The installation path of the application (on operating systems
such as Windows which use installation paths). This path is
in the format used by the guest operating system, it is not
a libguestfs path.
If unavailable this is returned as an empty string C<\"\">.
=item C<app2_trans_path>
The install path translated into a libguestfs path.
If unavailable this is returned as an empty string C<\"\">.
=item C<app2_publisher>
The name of the publisher of the application, for package
managers that use this. If unavailable this is returned
as an empty string C<\"\">.
=item C<app2_url>
The URL (eg. upstream URL) of the application.
If unavailable this is returned as an empty string C<\"\">.
=item C<app2_source_package>
For packaging systems which support this, the name of the source
package. If unavailable this is returned as an empty string C<\"\">.
=item C<app2_summary>
A short (usually one line) description of the application or package.
If unavailable this is returned as an empty string C<\"\">.
=item C<app2_description>
A longer description of the application or package.
If unavailable this is returned as an empty string C<\"\">.
=back
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_hostname"; added = (1, 7, 9);
style = RString "hostname", [Mountable "root"], [];
shortdesc = "get hostname of the operating system";
longdesc = "\
This function returns the hostname of the operating system
as found by inspection of the guest's configuration files.
If the hostname could not be determined, then the
string C<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_format"; added = (1, 9, 4);
style = RString "format", [Mountable "root"], [];
shortdesc = "get format of inspected operating system";
longdesc = "\
This returns the format of the inspected operating system. You
can use it to detect install images, live CDs and similar.
Currently defined formats are:
=over 4
=item \"installed\"
This is an installed operating system.
=item \"installer\"
The disk image being inspected is not an installed operating system,
but a I<bootable> install disk, live CD, or similar.
=item \"unknown\"
The format of this disk image is not known.
=back
Future versions of libguestfs may return other strings here.
The caller should be prepared to handle any string.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_is_live"; added = (1, 9, 4);
style = RBool "live", [Mountable "root"], [];
shortdesc = "get live flag for install disk";
longdesc = "\
If C<guestfs_inspect_get_format> returns C<installer> (this
is an install disk), then this returns true if a live image
was detected on the disk.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_is_netinst"; added = (1, 9, 4);
style = RBool "netinst", [Mountable "root"], [];
shortdesc = "get netinst (network installer) flag for install disk";
longdesc = "\
If C<guestfs_inspect_get_format> returns C<installer> (this
is an install disk), then this returns true if the disk is
a network installer, ie. not a self-contained install CD but
one which is likely to require network access to complete
the install.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_is_multipart"; added = (1, 9, 4);
style = RBool "multipart", [Mountable "root"], [];
shortdesc = "get multipart flag for install disk";
longdesc = "\
If C<guestfs_inspect_get_format> returns C<installer> (this
is an install disk), then this returns true if the disk is
part of a set.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_product_variant"; added = (1, 9, 13);
style = RString "variant", [Mountable "root"], [];
shortdesc = "get product variant of inspected operating system";
longdesc = "\
This returns the product variant of the inspected operating
system.
For Windows guests, this returns the contents of the Registry key
C<HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion>
C<InstallationType> which is usually a string such as
C<Client> or C<Server> (other values are possible). This
can be used to distinguish consumer and enterprise versions
of Windows that have the same version number (for example,
Windows 7 and Windows 2008 Server are both version 6.1,
but the former is C<Client> and the latter is C<Server>).
For enterprise Linux guests, in future we intend this to return
the product variant such as C<Desktop>, C<Server> and so on. But
this is not implemented at present.
If the product variant could not be determined, then the
string C<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_product_name>,
C<guestfs_inspect_get_major_version>." };
{ defaults with
name = "inspect_get_windows_current_control_set"; added = (1, 9, 17);
style = RString "controlset", [Mountable "root"], [];
shortdesc = "get Windows CurrentControlSet of inspected operating system";
longdesc = "\
This returns the Windows CurrentControlSet of the inspected guest.
The CurrentControlSet is a registry key name such as C<ControlSet001>.
This call assumes that the guest is Windows and that the
Registry could be examined by inspection. If this is not
the case then an error is returned.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_drive_mappings"; added = (1, 9, 17);
style = RHashtable "drives", [Mountable "root"], [];
shortdesc = "get drive letter mappings";
longdesc = "\
This call is useful for Windows which uses a primitive system
of assigning drive letters (like F<C:\\>) to partitions.
This inspection API examines the Windows Registry to find out
how disks/partitions are mapped to drive letters, and returns
a hash table as in the example below:
C => /dev/vda2
E => /dev/vdb1
F => /dev/vdc1
Note that keys are drive letters. For Windows, the key is
case insensitive and just contains the drive letter, without
the customary colon separator character.
In future we may support other operating systems that also used drive
letters, but the keys for those might not be case insensitive
and might be longer than 1 character. For example in OS-9,
hard drives were named C<h0>, C<h1> etc.
For Windows guests, currently only hard drive mappings are
returned. Removable disks (eg. DVD-ROMs) are ignored.
For guests that do not use drive mappings, or if the drive mappings
could not be determined, this returns an empty hash table.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_mountpoints>,
C<guestfs_inspect_get_filesystems>." };
{ defaults with
name = "inspect_get_icon"; added = (1, 11, 12);
style = RBufferOut "icon", [Mountable "root"], [OBool "favicon"; OBool "highquality"];
shortdesc = "get the icon corresponding to this operating system";
longdesc = "\
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<Callers must check for this case>.
Libguestfs will start by looking for a file called
F</etc/favicon.png> or F<C:\\etc\\favicon.png>
and if it has the correct format, the contents of this file will
be returned. You can disable favicons by passing the
optional C<favicon> 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<highquality> 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<Security:> 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<wrestool> program from the C<icoutils> package, and
several programs (C<bmptopnm>, C<pnmtopng>, C<pamcut>)
from the C<netpbm> package. These must be installed separately.
=item *
Operating system icons are usually trademarks. Seek legal
advice before using trademarks in applications.
=back" };
{ defaults with
name = "inspect_get_windows_software_hive"; added = (1, 35, 26);
style = RString "path", [Mountable "root"], [];
shortdesc = "get the path of the Windows software hive";
longdesc = "\
This returns the path to the hive (binary Windows Registry file)
corresponding to HKLM\\SOFTWARE.
This call assumes that the guest is Windows and that the guest
has a software hive file with the right name. If this is not the
case then an error is returned. This call does not check that the
hive is a valid Windows Registry hive.
You can use C<guestfs_hivex_open> to read or write to the hive.
Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "inspect_get_windows_system_hive"; added = (1, 35, 26);
style = RString "path", [Mountable "root"], [];
shortdesc = "get the path of the Windows system hive";
longdesc = "\
This returns the path to the hive (binary Windows Registry file)
corresponding to HKLM\\SYSTEM.
This call assumes that the guest is Windows and that the guest
has a system hive file with the right name. If this is not the
case then an error is returned. This call does not check that the
hive is a valid Windows Registry hive.
You can use C<guestfs_hivex_open> to read or write to the hive.
Please read L<guestfs(3)/INSPECTION> for more details." };
]

View File

@@ -0,0 +1,21 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list

View File

@@ -0,0 +1,124 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* Inspection APIs. *)
let non_daemon_functions = [
{ defaults with
name = "inspect_list_applications"; added = (1, 7, 8);
style = RStructList ("applications", "application"), [Mountable "root"], [];
deprecated_by = Some "inspect_list_applications2";
shortdesc = "get list of applications installed in the operating system";
longdesc = "\
Return the list of applications installed in the operating system.
I<Note:> This call works differently from other parts of the
inspection API. You have to call C<guestfs_inspect_os>, then
C<guestfs_inspect_get_mountpoints>, then mount up the disks,
before calling this. Listing applications is a significantly
more difficult operation which requires access to the full
filesystem. Also note that unlike the other
C<guestfs_inspect_get_*> calls which are just returning
data cached in the libguestfs handle, this call actually reads
parts of the mounted filesystems during the call.
This returns an empty list if the inspection code was not able
to determine the list of applications.
The application structure contains the following fields:
=over 4
=item C<app_name>
The name of the application. For Red Hat-derived and Debian-derived
Linux guests, this is the package name.
=item C<app_display_name>
The display name of the application, sometimes localized to the
install language of the guest operating system.
If unavailable this is returned as an empty string C<\"\">.
Callers needing to display something can use C<app_name> instead.
=item C<app_epoch>
For package managers which use epochs, this contains the epoch of
the package (an integer). If unavailable, this is returned as C<0>.
=item C<app_version>
The version string of the application or package. If unavailable
this is returned as an empty string C<\"\">.
=item C<app_release>
The release string of the application or package, for package
managers that use this. If unavailable this is returned as an
empty string C<\"\">.
=item C<app_install_path>
The installation path of the application (on operating systems
such as Windows which use installation paths). This path is
in the format used by the guest operating system, it is not
a libguestfs path.
If unavailable this is returned as an empty string C<\"\">.
=item C<app_trans_path>
The install path translated into a libguestfs path.
If unavailable this is returned as an empty string C<\"\">.
=item C<app_publisher>
The name of the publisher of the application, for package
managers that use this. If unavailable this is returned
as an empty string C<\"\">.
=item C<app_url>
The URL (eg. upstream URL) of the application.
If unavailable this is returned as an empty string C<\"\">.
=item C<app_source_package>
For packaging systems which support this, the name of the source
package. If unavailable this is returned as an empty string C<\"\">.
=item C<app_summary>
A short (usually one line) description of the application or package.
If unavailable this is returned as an empty string C<\"\">.
=item C<app_description>
A longer description of the application or package.
If unavailable this is returned as an empty string C<\"\">.
=back
Please read L<guestfs(3)/INSPECTION> for more details." };
]

View File

@@ -0,0 +1,21 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list

View File

@@ -0,0 +1,642 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* APIs related to handle properties. *)
let non_daemon_functions = [
{ defaults with
name = "set_hv"; added = (1, 23, 17);
style = RErr, [String "hv"], [];
fish_alias = ["hv"]; config_only = true;
blocking = false;
shortdesc = "set the hypervisor binary";
longdesc = "\
Set the hypervisor binary that we will use. The hypervisor
depends on the backend, but is usually the location of the
qemu/KVM hypervisor. For the uml backend, it is the location
of the C<linux> or C<vmlinux> binary.
The default is chosen when the library was compiled by the
configure script.
You can also override this by setting the C<LIBGUESTFS_HV>
environment variable.
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<qemu -help>).
If the qemu binary changes, we don't retest features, and
so you might see inconsistent results. Using the environment
variable C<LIBGUESTFS_HV> is safest of all since that picks
the qemu binary at the same time as the handle is created." };
{ defaults with
name = "get_hv"; added = (1, 23, 17);
style = RString "hv", [], [];
blocking = false;
tests = [
InitNone, Always, TestRun (
[["get_hv"]]), []
];
shortdesc = "get the hypervisor binary";
longdesc = "\
Return the current hypervisor 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"; added = (0, 0, 3);
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<LIBGUESTFS_PATH> environment variable.
Setting C<path> to C<NULL> restores the default path." };
{ defaults with
name = "get_path"; added = (0, 0, 3);
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"; added = (1, 0, 26);
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
libguestfs appliance kernel command line.
The default is C<NULL> unless overridden by setting
C<LIBGUESTFS_APPEND> environment variable.
Setting C<append> to C<NULL> means I<no> additional options
are passed (libguestfs always adds a few of its own)." };
{ defaults with
name = "get_append"; added = (1, 0, 26);
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.
*)
shortdesc = "get the additional kernel options";
longdesc = "\
Return the additional kernel options which are added to the
libguestfs appliance kernel command line.
If C<NULL> then no options are added." };
{ defaults with
name = "set_autosync"; added = (0, 0, 3);
style = RErr, [Bool "autosync"], [];
fish_alias = ["autosync"];
blocking = false;
shortdesc = "set autosync mode";
longdesc = "\
If C<autosync> 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"; added = (0, 0, 3);
style = RBool "autosync", [], [];
blocking = false;
tests = [
InitNone, Always, TestResultTrue (
[["get_autosync"]]), []
];
shortdesc = "get autosync mode";
longdesc = "\
Get the autosync flag." };
{ defaults with
name = "set_verbose"; added = (0, 0, 3);
style = RErr, [Bool "verbose"], [];
fish_alias = ["verbose"];
blocking = false;
shortdesc = "set verbose mode";
longdesc = "\
If C<verbose> is true, this turns on verbose messages.
Verbose messages are disabled unless the environment variable
C<LIBGUESTFS_DEBUG> is defined and set to C<1>.
Verbose messages are normally sent to C<stderr>, unless you
register a callback to send them somewhere else (see
C<guestfs_set_event_callback>)." };
{ defaults with
name = "get_verbose"; added = (0, 0, 3);
style = RBool "verbose", [], [];
blocking = false;
shortdesc = "get verbose mode";
longdesc = "\
This returns the verbose messages flag." };
{ defaults with
name = "set_memsize"; added = (1, 0, 55);
style = RErr, [Int "memsize"], [];
fish_alias = ["memsize"]; config_only = true;
blocking = false;
shortdesc = "set memory allocated to the hypervisor";
longdesc = "\
This sets the memory size in megabytes allocated to the
hypervisor. This only has any effect if called before
C<guestfs_launch>.
You can also change this by setting the environment
variable C<LIBGUESTFS_MEMSIZE> before the handle is
created.
For more information on the architecture of libguestfs,
see L<guestfs(3)>." };
{ defaults with
name = "get_memsize"; added = (1, 0, 55);
style = RInt "memsize", [], [];
blocking = false;
tests = [
InitNone, Always, TestResult (
[["get_memsize"]], "ret >= 256"), []
];
shortdesc = "get memory allocated to the hypervisor";
longdesc = "\
This gets the memory size in megabytes allocated to the
hypervisor.
If C<guestfs_set_memsize> was not called
on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
then this returns the compiled-in default value for memsize.
For more information on the architecture of libguestfs,
see L<guestfs(3)>." };
{ defaults with
name = "get_pid"; added = (1, 0, 56);
style = RInt "pid", [], [];
fish_alias = ["pid"];
blocking = false;
shortdesc = "get PID of hypervisor";
longdesc = "\
Return the process ID of the hypervisor. If there is no
hypervisor running, then this will return an error.
This is an internal call used for debugging and testing." };
{ defaults with
name = "set_trace"; added = (1, 0, 69);
style = RErr, [Bool "trace"], [];
fish_alias = ["trace"];
blocking = false;
tests = [
InitNone, Always, TestResultFalse (
[["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 L<ltrace(1)> command.
Command traces are disabled unless the environment variable
C<LIBGUESTFS_TRACE> is defined and set to C<1>.
Trace messages are normally sent to C<stderr>, unless you
register a callback to send them somewhere else (see
C<guestfs_set_event_callback>)." };
{ defaults with
name = "get_trace"; added = (1, 0, 69);
style = RBool "trace", [], [];
blocking = false;
shortdesc = "get command trace enabled flag";
longdesc = "\
Return the command trace flag." };
{ defaults with
name = "set_direct"; added = (1, 0, 72);
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<guestfs_set_log_message_callback>,
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"; added = (1, 0, 72);
style = RBool "direct", [], [];
blocking = false;
shortdesc = "get direct appliance mode flag";
longdesc = "\
Return the direct appliance mode flag." };
{ defaults with
name = "set_recovery_proc"; added = (1, 0, 77);
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<false> then
C<guestfs_launch> does not create a recovery process. The
purpose of the recovery process is to stop runaway hypervisor
processes in the case where the main program aborts abruptly.
This only has any effect if called before C<guestfs_launch>,
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
the hypervisor, which is not very helpful." };
{ defaults with
name = "get_recovery_proc"; added = (1, 0, 77);
style = RBool "recoveryproc", [], [];
blocking = false;
shortdesc = "get recovery process enabled flag";
longdesc = "\
Return the recovery process enabled flag." };
{ defaults with
name = "set_network"; added = (1, 5, 4);
style = RErr, [Bool "network"], [];
fish_alias = ["network"]; config_only = true;
blocking = false;
shortdesc = "set enable network flag";
longdesc = "\
If C<network> 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<guestfs(3)/RUNNING COMMANDS>).
You must call this before calling C<guestfs_launch>, otherwise
it has no effect." };
{ defaults with
name = "get_network"; added = (1, 5, 4);
style = RBool "network", [], [];
blocking = false;
shortdesc = "get enable network flag";
longdesc = "\
This returns the enable network flag." };
{ defaults with
name = "set_backend"; added = (1, 21, 26);
style = RErr, [String "backend"], [];
fish_alias = ["backend"]; config_only = true;
blocking = false;
shortdesc = "set the backend";
longdesc = "\
Set the method that libguestfs uses to connect to the backend
guestfsd daemon.
This handle property was previously called the \"attach method\".
See L<guestfs(3)/BACKEND>." };
{ defaults with
name = "get_backend"; added = (1, 21, 26);
style = RString "backend", [], [];
blocking = false;
tests = [
InitNone, Always, TestRun (
[["get_backend"]]), []
];
shortdesc = "get the backend";
longdesc = "\
Return the current backend.
This handle property was previously called the \"attach method\".
See C<guestfs_set_backend> and L<guestfs(3)/BACKEND>." };
{ defaults with
name = "set_pgroup"; added = (1, 11, 18);
style = RErr, [Bool "pgroup"], [];
fish_alias = ["pgroup"]; config_only = true;
blocking = false;
shortdesc = "set process group flag";
longdesc = "\
If C<pgroup> is true, child processes are placed into
their own process group.
The practical upshot of this is that signals like C<SIGINT> (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. Guestfish sets this flag to
true when used interactively, so that C<^C> can cancel
long-running commands gracefully (see C<guestfs_user_cancel>)." };
{ defaults with
name = "get_pgroup"; added = (1, 11, 18);
style = RBool "pgroup", [], [];
blocking = false;
shortdesc = "get process group flag";
longdesc = "\
This returns the process group flag." };
{ defaults with
name = "set_smp"; added = (1, 13, 15);
style = RErr, [Int "smp"], [];
fish_alias = ["smp"]; config_only = true;
blocking = false;
shortdesc = "set number of virtual CPUs in appliance";
longdesc = "\
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<guestfs_launch>." };
{ defaults with
name = "get_smp"; added = (1, 13, 15);
style = RInt "smp", [], [];
blocking = false;
shortdesc = "get number of virtual CPUs in appliance";
longdesc = "\
This returns the number of virtual CPUs assigned to the appliance." };
{ defaults with
name = "set_tmpdir"; added = (1, 19, 58);
style = RErr, [OptString "tmpdir"], [];
fish_alias = ["tmpdir"]; config_only = true;
blocking = false;
shortdesc = "set the temporary directory";
longdesc = "\
Set the directory used by the handle to store temporary files.
The environment variables C<LIBGUESTFS_TMPDIR> and C<TMPDIR>
control the default value: If C<LIBGUESTFS_TMPDIR> is set, then
that is the default. Else if C<TMPDIR> is set, then that is
the default. Else F</tmp> is the default." };
{ defaults with
name = "get_tmpdir"; added = (1, 19, 58);
style = RString "tmpdir", [], [];
blocking = false;
shortdesc = "get the temporary directory";
longdesc = "\
Get the directory used by the handle to store temporary files." };
{ defaults with
name = "set_cachedir"; added = (1, 19, 58);
style = RErr, [OptString "cachedir"], [];
fish_alias = ["cachedir"]; config_only = true;
blocking = false;
shortdesc = "set the appliance cache directory";
longdesc = "\
Set the directory used by the handle to store the appliance
cache, when using a supermin appliance. The appliance is
cached and shared between all handles which have the same
effective user ID.
The environment variables C<LIBGUESTFS_CACHEDIR> and C<TMPDIR>
control the default value: If C<LIBGUESTFS_CACHEDIR> is set, then
that is the default. Else if C<TMPDIR> is set, then that is
the default. Else F</var/tmp> is the default." };
{ defaults with
name = "get_cachedir"; added = (1, 19, 58);
style = RString "cachedir", [], [];
blocking = false;
shortdesc = "get the appliance cache directory";
longdesc = "\
Get the directory used by the handle to store the appliance cache." };
{ defaults with
name = "set_program"; added = (1, 21, 29);
style = RErr, [String "program"], [];
fish_alias = ["program"];
blocking = false;
shortdesc = "set the program name";
longdesc = "\
Set the program name. This is an informative string which the
main program may optionally set in the handle.
When the handle is created, the program name in the handle is
set to the basename from C<argv[0]>. The program name can never
be C<NULL>." };
{ defaults with
name = "get_program"; added = (1, 21, 29);
style = RConstString "program", [], [];
blocking = false;
tests = [
InitNone, Always, TestRun (
[["get_program"]]), []
];
shortdesc = "get the program name";
longdesc = "\
Get the program name. See C<guestfs_set_program>." };
{ defaults with
name = "get_backend_settings"; added = (1, 25, 24);
style = RStringList "settings", [], [];
blocking = false;
tests = [
InitNone, Always, TestRun (
[["get_backend_settings"]]), []
];
shortdesc = "get per-backend settings";
longdesc = "\
Return the current backend settings.
This call returns all backend settings strings. If you want to
find a single backend setting, see C<guestfs_get_backend_setting>.
See L<guestfs(3)/BACKEND>, L<guestfs(3)/BACKEND SETTINGS>." };
{ defaults with
name = "set_backend_settings"; added = (1, 25, 24);
style = RErr, [StringList "settings"], [];
config_only = true;
blocking = false;
shortdesc = "replace per-backend settings strings";
longdesc = "\
Set a list of zero or more settings which are passed through to
the current backend. Each setting is a string which is interpreted
in a backend-specific way, or ignored if not understood by the
backend.
The default value is an empty list, unless the environment
variable C<LIBGUESTFS_BACKEND_SETTINGS> was set when the handle
was created. This environment variable contains a colon-separated
list of settings.
This call replaces all backend settings. If you want to replace
a single backend setting, see C<guestfs_set_backend_setting>.
If you want to clear a single backend setting, see
C<guestfs_clear_backend_setting>.
See L<guestfs(3)/BACKEND>, L<guestfs(3)/BACKEND SETTINGS>." };
{ defaults with
name = "get_backend_setting"; added = (1, 27, 2);
style = RString "val", [String "name"], [];
blocking = false;
shortdesc = "get a single per-backend settings string";
longdesc = "\
Find a backend setting string which is either C<\"name\"> or
begins with C<\"name=\">. If C<\"name\">, this returns the
string C<\"1\">. If C<\"name=\">, this returns the part
after the equals sign (which may be an empty string).
If no such setting is found, this function throws an error.
The errno (see C<guestfs_last_errno>) will be C<ESRCH> in this
case.
See L<guestfs(3)/BACKEND>, L<guestfs(3)/BACKEND SETTINGS>." };
{ defaults with
name = "set_backend_setting"; added = (1, 27, 2);
style = RErr, [String "name"; String "val"], [];
config_only = true;
blocking = false;
shortdesc = "set a single per-backend settings string";
longdesc = "\
Append C<\"name=value\"> to the backend settings string list.
However if a string already exists matching C<\"name\">
or beginning with C<\"name=\">, then that setting is replaced.
See L<guestfs(3)/BACKEND>, L<guestfs(3)/BACKEND SETTINGS>." };
{ defaults with
name = "clear_backend_setting"; added = (1, 27, 2);
style = RInt "count", [String "name"], [];
config_only = true;
blocking = false;
shortdesc = "remove a single per-backend settings string";
longdesc = "\
If there is a backend setting string matching C<\"name\"> or
beginning with C<\"name=\">, then that string is removed
from the backend settings.
This call returns the number of strings which were removed
(which may be 0, 1 or greater than 1).
See L<guestfs(3)/BACKEND>, L<guestfs(3)/BACKEND SETTINGS>." };
{ defaults with
name = "set_identifier"; added = (1, 31, 14);
style = RErr, [String "identifier"], [];
fish_alias = ["identifier"];
blocking = false;
shortdesc = "set the handle identifier";
longdesc = "\
This is an informative string which the caller may optionally
set in the handle. It is printed in various places, allowing
the current handle to be identified in debugging output.
One important place is when tracing is enabled. If the
identifier string is not an empty string, then trace messages
change from this:
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = \"/tmp\"
to this:
libguestfs: trace: ID: get_tmpdir
libguestfs: trace: ID: get_tmpdir = \"/tmp\"
where C<ID> is the identifier string set by this call.
The identifier must only contain alphanumeric ASCII characters,
underscore and minus sign. The default is the empty string.
See also C<guestfs_set_program>, C<guestfs_set_trace>,
C<guestfs_get_identifier>." };
{ defaults with
name = "get_identifier"; added = (1, 31, 14);
style = RConstString "identifier", [], [];
blocking = false;
tests = [
InitNone, Always, TestRun (
[["get_identifier"]]), []
];
shortdesc = "get the handle identifier";
longdesc = "\
Get the handle identifier. See C<guestfs_set_identifier>." };
{ defaults with
name = "get_sockdir"; added = (1, 33, 8);
style = RString "sockdir", [], [];
blocking = false;
shortdesc = "get the temporary directory for sockets";
longdesc = "\
Get the directory used by the handle to store temporary socket files.
This is different from C<guestfs_tmpdir>, as we need shorter paths for
sockets (due to the limited buffers of filenames for UNIX sockets),
and C<guestfs_tmpdir> may be too long for them.
The environment variable C<XDG_RUNTIME_DIR> controls the default
value: If C<XDG_RUNTIME_DIR> is set, then that is the default.
Else F</tmp> is the default." };
]
let daemon_functions = [
]

View File

@@ -0,0 +1,21 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list

View File

@@ -0,0 +1,131 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* APIs related to handle properties.
* All the APIs in this file are deprecated.
*)
let non_daemon_functions = [
{ defaults with
name = "set_qemu"; added = (1, 0, 6);
style = RErr, [OptString "hv"], [];
fish_alias = ["qemu"]; config_only = true;
blocking = false;
deprecated_by = Some "set_hv";
shortdesc = "set the hypervisor binary (usually qemu)";
longdesc = "\
Set the hypervisor binary (usually qemu) 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<LIBGUESTFS_HV>
environment variable.
Setting C<hv> to C<NULL> 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<qemu -help>).
If the qemu binary changes, we don't retest features, and
so you might see inconsistent results. Using the environment
variable C<LIBGUESTFS_HV> is safest of all since that picks
the qemu binary at the same time as the handle is created." };
{ defaults with
name = "get_qemu"; added = (1, 0, 6);
style = RConstString "hv", [], [];
blocking = false;
deprecated_by = Some "get_hv";
tests = [
InitNone, Always, TestRun (
[["get_qemu"]]), []
];
shortdesc = "get the hypervisor binary (usually qemu)";
longdesc = "\
Return the current hypervisor binary (usually qemu).
This is always non-NULL. If it wasn't set already, then this will
return the default qemu binary name." };
{ defaults with
name = "set_selinux"; added = (1, 0, 67);
style = RErr, [Bool "selinux"], [];
fish_alias = ["selinux"]; config_only = true;
blocking = false;
deprecated_by = Some "selinux_relabel";
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<selinux=0> (disabled).
Note that if SELinux is enabled, it is always in
Permissive mode (C<enforcing=0>).
For more information on the architecture of libguestfs,
see L<guestfs(3)>." };
{ defaults with
name = "get_selinux"; added = (1, 0, 67);
style = RBool "selinux", [], [];
blocking = false;
deprecated_by = Some "selinux_relabel";
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<guestfs_set_selinux>.
For more information on the architecture of libguestfs,
see L<guestfs(3)>." };
{ defaults with
name = "set_attach_method"; added = (1, 9, 8);
style = RErr, [String "backend"], [];
fish_alias = ["attach-method"]; config_only = true;
blocking = false;
deprecated_by = Some "set_backend";
shortdesc = "set the backend";
longdesc = "\
Set the method that libguestfs uses to connect to the backend
guestfsd daemon.
See L<guestfs(3)/BACKEND>." };
{ defaults with
name = "get_attach_method"; added = (1, 9, 8);
style = RString "backend", [], [];
blocking = false;
deprecated_by = Some "get_backend";
tests = [
InitNone, Always, TestRun (
[["get_attach_method"]]), []
];
shortdesc = "get the backend";
longdesc = "\
Return the current backend.
See C<guestfs_set_backend> and L<guestfs(3)/BACKEND>." };
]
let daemon_functions = [
]

View File

@@ -0,0 +1,21 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list

246
generator/actions_tsk.ml Normal file
View File

@@ -0,0 +1,246 @@
(* libguestfs
* Copyright (C) 2009-2017 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
(* SleuthKit APIs. *)
let non_daemon_functions = [
{ defaults with
name = "filesystem_walk"; added = (1, 33, 39);
style = RStructList ("dirents", "tsk_dirent"), [Mountable "device";], [];
optional = Some "libtsk";
progress = true; cancellable = true;
shortdesc = "walk through the filesystem content";
longdesc = "\
Walk through the internal structures of a disk partition
(eg. F</dev/sda1>) in order to return a list of all the files
and directories stored within.
It is not necessary to mount the disk partition to run this command.
All entries in the filesystem are returned. This function can list deleted
or unaccessible files. The entries are I<not> sorted.
The C<tsk_dirent> structure contains the following fields.
=over 4
=item 'tsk_inode'
Filesystem reference number of the node. It migh be C<0>
if the node has been deleted.
=item 'tsk_type'
Basic file type information.
See below for a detailed list of values.
=item 'tsk_size'
File size in bytes. It migh be C<-1>
if the node has been deleted.
=item 'tsk_name'
The file path relative to its directory.
=item 'tsk_flags'
Bitfield containing extra information regarding the entry.
It contains the logical OR of the following values:
=over 4
=item 0x0001
If set to C<1>, the file is allocated and visible within the filesystem.
Otherwise, the file has been deleted.
Under certain circumstances, the function C<download_inode>
can be used to recover deleted files.
=item 0x0002
Filesystem such as NTFS and Ext2 or greater, separate the file name
from the metadata structure.
The bit is set to C<1> when the file name is in an unallocated state
and the metadata structure is in an allocated one.
This generally implies the metadata has been reallocated to a new file.
Therefore, information such as file type, file size, timestamps,
number of links and symlink target might not correspond
with the ones of the original deleted entry.
=item 0x0004
The bit is set to C<1> when the file is compressed using filesystem
native compression support (NTFS). The API is not able to detect
application level compression.
=back
=item 'tsk_atime_sec'
=item 'tsk_atime_nsec'
=item 'tsk_mtime_sec'
=item 'tsk_mtime_nsec'
=item 'tsk_ctime_sec'
=item 'tsk_ctime_nsec'
=item 'tsk_crtime_sec'
=item 'tsk_crtime_nsec'
Respectively, access, modification, last status change and creation
time in Unix format in seconds and nanoseconds.
=item 'tsk_nlink'
Number of file names pointing to this entry.
=item 'tsk_link'
If the entry is a symbolic link, this field will contain the path
to the target file.
=back
The C<tsk_type> field will contain one of the following characters:
=over 4
=item 'b'
Block special
=item 'c'
Char special
=item 'd'
Directory
=item 'f'
FIFO (named pipe)
=item 'l'
Symbolic link
=item 'r'
Regular file
=item 's'
Socket
=item 'h'
Shadow inode (Solaris)
=item 'w'
Whiteout inode (BSD)
=item 'u'
Unknown file type
=back" };
{ defaults with
name = "find_inode"; added = (1, 35, 6);
style = RStructList ("dirents", "tsk_dirent"), [Mountable "device"; Int64 "inode";], [];
optional = Some "libtsk";
progress = true; cancellable = true;
shortdesc = "search the entries associated to the given inode";
longdesc = "\
Searches all the entries associated with the given inode.
For each entry, a C<tsk_dirent> structure is returned.
See C<filesystem_walk> for more information about C<tsk_dirent> structures." };
]
let daemon_functions = [
{ defaults with
name = "download_inode"; added = (1, 33, 14);
style = RErr, [Mountable "device"; Int64 "inode"; FileOut "filename"], [];
proc_nr = Some 464;
optional = Some "sleuthkit";
progress = true; cancellable = true;
shortdesc = "download a file to the local machine given its inode";
longdesc = "\
Download a file given its inode from the disk partition
(eg. F</dev/sda1>) and save it as F<filename> on the local machine.
It is not required to mount the disk to run this command.
The command is capable of downloading deleted or inaccessible files." };
{ defaults with
name = "internal_filesystem_walk"; added = (1, 33, 39);
style = RErr, [Mountable "device"; FileOut "filename"], [];
proc_nr = Some 466;
visibility = VInternal;
optional = Some "libtsk";
shortdesc = "walk through the filesystem content";
longdesc = "Internal function for filesystem_walk." };
{ defaults with
name = "download_blocks"; added = (1, 33, 45);
style = RErr, [Mountable "device"; Int64 "start"; Int64 "stop"; FileOut "filename"], [OBool "unallocated"];
proc_nr = Some 468;
optional = Some "sleuthkit";
progress = true; cancellable = true;
shortdesc = "download the given data units from the disk";
longdesc = "\
Download the data units from F<start> address
to F<stop> from the disk partition (eg. F</dev/sda1>)
and save them as F<filename> on the local machine.
The use of this API on sparse disk image formats such as QCOW,
may result in large zero-filled files downloaded on the host.
The size of a data unit varies across filesystem implementations.
On NTFS filesystems data units are referred as clusters
while on ExtX ones they are referred as fragments.
If the optional C<unallocated> flag is true (default is false),
only the unallocated blocks will be extracted.
This is useful to detect hidden data or to retrieve deleted files
which data units have not been overwritten yet." };
{ defaults with
name = "internal_find_inode"; added = (1, 35, 6);
style = RErr, [Mountable "device"; Int64 "inode"; FileOut "filename";], [];
proc_nr = Some 470;
visibility = VInternal;
optional = Some "libtsk";
shortdesc = "search the entries associated to the given inode";
longdesc = "Internal function for find_inode." };
]

22
generator/actions_tsk.mli Normal file
View File

@@ -0,0 +1,22 @@
(* libguestfs
* Copyright (C) 2009-2017 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. *)
val non_daemon_functions : Types.action list
val daemon_functions : Types.action list