[Libguestfs] [PATCH v12 05/11] daemon: Implement umount_all in OCaml.
Pino Toscano
ptoscano at redhat.com
Tue Sep 19 14:28:04 UTC 2017
On Wednesday, 9 August 2017 19:23:40 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 future and then replace the C
> one). However it is necessary to have a version of umount_all which
> we can call from the OCaml inspection code.
> ---
Even if this is already committed, better leave some comments than
never ...
> daemon/mount.ml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> daemon/mount.mli | 2 ++
> 2 files changed, 63 insertions(+)
>
> diff --git a/daemon/mount.ml b/daemon/mount.ml
> index 3391ffc11..fbf4ddc39 100644
> --- a/daemon/mount.ml
> +++ b/daemon/mount.ml
> + List.iter (
> + fun line ->
> + let line = String.nsplit " " line in
> + (* The field of interest is the 5th field. Whitespace is escaped
> + * with octal sequences like \040 (for space).
> + * See fs/seq_file.c:mangle_path.
> + *)
Would it be possible to output to debug the mount entry, like done in
the C version?
> + if List.length line >= 5 then (
> + let mp = List.nth line 4 in
> + let mp = proc_unmangle_path mp in
> +
> + (* Allow a mount directory like "/sysroot" or "/sysroot/..." *)
> + if (sysroot_len > 0 && String.is_prefix mp sysroot) ||
> + (String.is_prefix mp sysroot &&
> + String.length mp > sysroot_len &&
> + mp.[sysroot_len] = '/') then
This condition is puzzling, although so are the 2 if's in the C
version; also it is not an exact 1:1 conversion, since the first half
of the "or" ought to be "sysroot_len > 0 && mp = sysroot".
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170919/a4b4cb1b/attachment.sig>
More information about the Libguestfs
mailing list