Re: [Libguestfs] [PATCH] dib: Rewrite match statement as ordinary if statement.

Pino Toscano
2016-04-21T16:35:14Z

On Thursday 21 April 2016 12:05:56 Richard W.M. Jones
wrote:
> Just stylistic change, no functional change.
> ---

In principle it is fine, although I left it that way in case the UUID
is set also for other filesystems (upstream still supports ext only
for this).  No problems either way.

>  dib/dib.ml | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/dib/dib.ml b/dib/dib.ml
> index 06a1f67..35ae6b7 100644
> --- a/dib/dib.ml
> +++ b/dib/dib.ml
> @@ -781,9 +781,8 @@ let main () >      ) @ mkfs_options @ [
"-t"; cmdline.fs_type; blockdev ] in
>    ignore (g#debug "sh" (Array.of_list ([ "mkfs" ] @
mkfs_options)));
>    g#set_label blockdev root_label;
> -  (match cmdline.fs_type with
> -  | x when String.is_prefix x "ext" -> g#set_uuid blockdev
rootfs_uuid
> -  | _ -> ());
> +  if String.is_prefix cmdline.fs_type "ext" then
> +    g#set_uuid blockdev rootfs_uuid;
>    g#mount blockdev "/";
>    g#mkmountpoint "/tmp";
>    mount_aux ();
>

--
Pino Toscano