[Libguestfs] check-release success (was: Re: [PATCH] common/mlstdutils: Implement StringSet.)

2017-07-21 Thread Richard Jones
0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 make[3]: Leaving directory '/var/tmp/tmpuVz20K/libguestfs/php' make[2]: Leaving directory '/var/tmp/tmpuVz20K/libguestfs/php' make[1]: Leaving directory

[Libguestfs] check-release FAILED (was: Re: [PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.)

2017-07-21 Thread Richard Jones
Checking out sources from https://github.com/libguestfs/libguestfs ... /var/tmp/tmpCbDvGx/libguestfs /var/tmp/tmpCbDvGx Reset branch 'master' Branch master set up to track remote branch master from origin. Your branch is up-to-date with 'origin/master'. Already up-to-date. /var/tmp/tmpCbDvGx

[Libguestfs] check-syntax FAILED (was: Re: [PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.)

2017-07-21 Thread Richard Jones
Checking out sources from https://github.com/libguestfs/libguestfs ... /var/tmp/tmpZ6wS6s/libguestfs /var/tmp/tmpZ6wS6s Reset branch 'master' Branch master set up to track remote branch master from origin. Your branch is up-to-date with 'origin/master'. Already up-to-date. /var/tmp/tmpZ6wS6s

[Libguestfs] check-release success (was: Re: [PATCH] common/mlutils: Remove bogus suffix parameter from Mkdtemp.temp_dir.)

2017-07-21 Thread Richard Jones
0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 make[3]: Leaving directory '/var/tmp/tmp8tedKZ/libguestfs/php' make[2]: Leaving directory '/var/tmp/tmp8tedKZ/libguestfs/php' make[1]: Leaving directory

[Libguestfs] [PATCH v3 REPOST 0/5] threads: Add support for thread-safe handle.

2017-07-21 Thread Richard W.M. Jones
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html This series was posted about 4 weeks ago: v3: https://www.redhat.com/archives/libguestfs/2017-June/msg00287.html There is no

[Libguestfs] [PATCH v3 REPOST 1/5] threads: Add a lock (a recursive mutex) to the handle.

2017-07-21 Thread Richard W.M. Jones
Add a g->lock field. This commit simply initializes and destroys the lock on handle creation/free, and does nothing else. --- lib/guestfs-internal.h | 6 ++ lib/handle.c | 4 2 files changed, 10 insertions(+) diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h index

[Libguestfs] [PATCH v2 22/23] daemon: Reimplement ‘part_get_parttype’, ‘part_get_gpt_type’, ‘part_get_gpt_guid’ APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/parted.c | 176 +- daemon/parted.ml | 74 ++- daemon/parted.mli | 5 ++ generator/actions_core.ml | 3 + 4 files changed, 96 insertions(+), 162 deletions(-) diff --git a/daemon/parted.c

[Libguestfs] [PATCH v2 06/23] daemon: Reimplement ‘is_dir’, ‘is_file’ and ‘is_symlink’ APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
This also demonstrates usage of optional arguments. --- daemon/Makefile.am| 2 ++ daemon/is.c | 41 - daemon/is.ml | 42 ++ daemon/is.mli | 21 +

[Libguestfs] [PATCH v2 08/23] daemon: Reimplement ‘mount’, ‘mount_ro’, ‘mount_options’, ‘mount_vfs’ APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
Some of the oldest and most core APIs, reimplemented. This also moves the strange ‘mount_vfs_nochroot’ function into btrfs.c. --- daemon/Makefile.am| 2 + daemon/btrfs.c| 43 daemon/daemon.h | 6 --- daemon/mount.c| 99

[Libguestfs] [PATCH v2 14/23] daemon: Reimplement ‘list_md_devices’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 2 + daemon/md.c | 125 -- daemon/md.ml | 48 ++ daemon/md.mli | 19 +++ generator/actions_core.ml | 1 + 5 files changed, 101 insertions(+), 94

[Libguestfs] [PATCH v2 10/23] daemon: Reimplement ‘case_sensitive_path’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 2 + daemon/realpath.c | 187 -- daemon/realpath.ml| 82 daemon/realpath.mli | 19 + generator/actions_core.ml | 1 + 5 files changed, 104 insertions(+), 187

[Libguestfs] [PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.

2017-07-21 Thread Richard W.M. Jones
This change allows parts of the daemon to be written in the OCaml programming language. I am using the ‘Main Program in C’ method along with ‘-output-obj’ to create an object file from the OCaml code / runtime, as described here: https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html

[Libguestfs] [PATCH v2 11/23] daemon: Reimplement ‘file_architecture’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
The previously library-side ‘file_architecture’ API is reimplemented in the daemon, in OCaml. There are some significant differences compared to the C implementation: - The C code used libmagic. That is replaced by calling the ‘file’ command (because that is simpler than using the library).

[Libguestfs] [PATCH v2 16/23] daemon: Reimplement ‘list_filesystems’ API in the daemon, in OCaml.

2017-07-21 Thread Richard W.M. Jones
Move the list_filesystems API into the daemon, reimplementing it in OCaml. Since this API makes many other API calls, it runs a lot faster in the daemon. --- daemon/Makefile.am| 2 + daemon/ldm.ml | 3 + daemon/ldm.mli| 2 + daemon/listfs.ml | 159

[Libguestfs] [PATCH v2 17/23] daemon: Reimplement ‘part_list’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/parted.c | 56 --- daemon/parted.ml | 56 +++ daemon/parted.mli | 8 +++ generator/actions_core.ml | 1 + 4 files changed, 65 insertions(+), 56 deletions(-) diff

[Libguestfs] [PATCH v2 12/23] daemon: Reimplement ‘list_ldm_(volumes|partitions)’ APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 2 ++ daemon/ldm.c | 82 --- daemon/ldm.ml | 44 + daemon/ldm.mli| 20 generator/actions_core.ml | 2 ++ 5 files changed, 68 insertions(+), 82

[Libguestfs] [PATCH v2 04/23] daemon: Reimplement several devsparts APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
The reimplemented APIs are: * list_devices * list_partitions * part_to_dev * part_to_partnum * is_whole_device --- daemon/Makefile.am| 2 + daemon/daemon.h | 3 - daemon/devsparts.c| 257 -- daemon/devsparts.ml | 113

[Libguestfs] [PATCH v2 19/23] daemon: Reimplement ‘nr_devices’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/devsparts.c| 15 --- daemon/devsparts.ml | 2 ++ daemon/devsparts.mli | 2 ++ generator/actions_core.ml | 1 + 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 1aacb8e16..12e779326 100644 ---

[Libguestfs] [PATCH v2 15/23] daemon: Reimplement ‘btrfs_subvolume_list’ and ‘btrfs_subvolume_get_default’ in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 2 + daemon/btrfs.c| 175 -- daemon/btrfs.ml | 126 + daemon/btrfs.mli | 26 +++ generator/actions_core.ml | 2 + 5 files changed, 156 insertions(+),

[Libguestfs] [PATCH v2 00/23] Reimplement many daemon APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
v1 was posted here: https://www.redhat.com/archives/libguestfs/2017-July/msg00098.html This series now depends on two small patches which I posted separately: https://www.redhat.com/archives/libguestfs/2017-July/msg00207.html https://www.redhat.com/archives/libguestfs/2017-July/msg00209.html

[Libguestfs] [PATCH v2 18/23] daemon: Reimplement ‘findfs_uuid’ and ‘findfs_label’ APIs in OCaml.

2017-07-21 Thread Richard W.M. Jones
This also reimplements the lv_canonical function in OCaml. We cannot call the original C function because it calls reply_with_perror which would break the OCaml bindings. --- daemon/Makefile.am| 3 +- daemon/findfs.c | 94 ---

[Libguestfs] [PATCH v2 23/23] daemon: Reimplement ‘device_index’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/devsparts.c| 21 - daemon/devsparts.ml | 11 +++ daemon/devsparts.mli | 6 ++ generator/actions_core.ml | 1 + 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/daemon/devsparts.c b/daemon/devsparts.c index

[Libguestfs] [PATCH v2 07/23] daemon: Reimplement ‘readlink’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 2 ++ daemon/link.c | 16 daemon/link.ml| 24 daemon/link.mli | 19 +++ generator/actions_core.ml | 1 + 5 files changed, 46 insertions(+), 16 deletions(-) diff --git

[Libguestfs] [PATCH v2 21/23] daemon: Reimplement ‘realpath’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
--- daemon/Makefile.am| 1 - daemon/realpath.c | 50 --- daemon/realpath.ml| 4 daemon/realpath.mli | 1 + docs/C_SOURCE_FILES | 1 - generator/actions_core.ml | 1 + 6 files changed, 6 insertions(+), 52

[Libguestfs] [PATCH v2 02/23] daemon: Reimplement ‘file’ API in OCaml.

2017-07-21 Thread Richard W.M. Jones
‘file’ is a small, self-contained API which runs a single command, so it's a good test case for reimplementing APIs. --- daemon/Makefile.am| 2 ++ daemon/file.c | 80 --- daemon/file.ml| 59

[Libguestfs] [PATCH v2 05/23] daemon: Add unit tests of the ‘Utils’ module.

2017-07-21 Thread Richard W.M. Jones
--- .gitignore | 1 + daemon/Makefile.am | 43 ++- daemon/daemon_utils_tests.ml | 48 daemon/dummy.c | 2 ++ docs/C_SOURCE_FILES | 1 + 5 files changed, 94

[Libguestfs] [PATCH v10 05/10] generator: daemon: Implement RStringList (RMountable, _) and RHashtable (RPlainString, RMountable, _).

2017-07-21 Thread Richard W.M. Jones
Implement returning these two types from OCaml daemon functions. --- daemon/daemon-c.c | 52 daemon/daemon-c.h | 2 ++ generator/daemon.ml | 13 +++-- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git

[Libguestfs] [PATCH v10 03/10] daemon: utils: New functions unix_canonical_path, utf16le_to_utf8 and tests.

2017-07-21 Thread Richard W.M. Jones
These utility functions will be used in the OCaml inspection code. --- daemon/daemon_utils_tests.ml | 15 +++ daemon/utils.ml | 100 +++ daemon/utils.mli | 12 ++ 3 files changed, 127 insertions(+) diff --git

[Libguestfs] [PATCH v10 08/10] daemon: Implement inspection of Linux and other Unix-like operating systems.

2017-07-21 Thread Richard W.M. Jones
This is essentially a line-for-line translation of the C inspection code. --- daemon/Makefile.am | 8 + daemon/inspect.ml| 396 daemon/inspect.mli | 41 ++ daemon/inspect_fs.ml | 363 ++

[Libguestfs] [PATCH v10 01/10] inspection: Deprecate APIs and remove support for inspecting installer CDs.

2017-07-21 Thread Richard W.M. Jones
This just duplicated libosinfo information, and because it was never tested it didn't work most of the time. --- docs/C_SOURCE_FILES| 2 - generator/actions_inspection.ml| 67 --- generator/actions_inspection_deprecated.ml | 61 +++ inspector/Makefile.am

[Libguestfs] [PATCH v10 07/10] daemon: Implement inspection types and utility functions.

2017-07-21 Thread Richard W.M. Jones
Define the types which will be used to communicate between the different parts of the inspection code. The main types are: fscorresponds to ‘struct inspect_fs’ in C code root no direct correspondence with the C code, but in the C code, ‘inspect_fs’ was overloaded to

[Libguestfs] [PATCH v10 06/10] lib: inspect: Remove ‘fs’ parameter from ‘guestfs_int_download_to_tmp’.

2017-07-21 Thread Richard W.M. Jones
After we move inspection code to the daemon, the library will no longer have access to ‘struct inspect_fs’, and so we won't be able to prefix downloads with the "root filesystem number". Just remove this prefix (it's internal only). However it does mean that this function can no longer cache

[Libguestfs] [PATCH v10 09/10] daemon: Implement inspection of Windows.

2017-07-21 Thread Richard W.M. Jones
Mostly a line-for-line translation of the C inspection code. --- daemon/Makefile.am| 2 + daemon/inspect_fs.ml | 6 + daemon/inspect_fs_windows.ml | 491 ++ daemon/inspect_fs_windows.mli | 24 +++ 4 files changed, 523

Re: [Libguestfs] [PATCH v9 04/11] daemon: Implement umount_all in OCaml.

2017-07-21 Thread Richard W.M. Jones
On Thu, Jul 20, 2017 at 05:16:40PM +0200, Pino Toscano wrote: > On Monday, 17 July 2017 18:55:24 CEST Richard W.M. Jones wrote: > > Unlike previous ‘daemon: Reimplement ...’ patches, this does not > > reimplement the umount_all API completely (yet, but this > > implementation could be completed in

[Libguestfs] check-release success (was: Re: [PATCH v3 REPOST 5/5] threads: Add a test.)

2017-07-21 Thread Richard Jones
0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 make[3]: Leaving directory '/var/tmp/tmp2lYq06/libguestfs/php' make[2]: Leaving directory '/var/tmp/tmp2lYq06/libguestfs/php' make[1]: Leaving directory

[Libguestfs] [PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.

2017-07-21 Thread Richard W.M. Jones
This is like the Perl chomp function, it removes a single \n from the end of a string if present, else leaves the string alone. I believe I found the only (two) places where such a function is used, but there may be a few more lurking. --- common/mlstdutils/std_utils.ml | 7 +++

Re: [Libguestfs] [PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.

2017-07-21 Thread Pino Toscano
On Friday, 21 July 2017 15:56:17 CEST Richard W.M. Jones wrote: > This is like the Perl chomp function, it removes a single \n from the > end of a string if present, else leaves the string alone. > > I believe I found the only (two) places where such a function is used, > but there may be a few

Re: [Libguestfs] [PATCH 19/27] daemon: Reimplement ‘list_filesystems’ API in the daemon, in OCaml.

2017-07-21 Thread Richard W.M. Jones
On Thu, Jul 20, 2017 at 05:13:34PM +0200, Pino Toscano wrote: > > + (* Use vfs-type to check for filesystems on partitions, but > > + * ignore MBR partition type 42 used by LDM. > > + *) > > + let ret = > > +ret @ > > + filter_map ( > > +fun part -> > > + if not

[Libguestfs] [PATCH] common/mlstdutils: Implement StringSet.

2017-07-21 Thread Richard W.M. Jones
--- builder/sources.ml | 2 -- common/mlstdutils/Makefile.am| 4 ++- common/mlstdutils/stringSet.ml | 19 common/mlstdutils/stringSet.mli | 46 dib/elements.ml

[Libguestfs] [PATCH] common/mlutils: Remove bogus suffix parameter from Mkdtemp.temp_dir.

2017-07-21 Thread Richard W.M. Jones
The C function mkdtemp(3) requires that the string ends with 6 'X' characters, so appending a non-empty suffix causes the function to raise EINVAL. Luckily we only ever called this function with the last parameter "". --- builder/builder.ml | 2 +- builder/sigchecker.ml