[Libguestfs] [PATCH 04/27] daemon: Reimplement ‘vfs_type’ API in OCaml.

Pino Toscano ptoscano at redhat.com
Wed Jul 19 13:15:40 UTC 2017


On Friday, 14 July 2017 15:39:12 CEST Richard W.M. Jones wrote:
> +and get_blkid_tag device tag =
> +  let r, out, err =
> +    commandr "blkid"
> +             [(* Adding -c option kills all caching, even on RHEL 5. *)
> +               "-c"; "/dev/null";
> +               "-o"; "value"; "-s"; tag; device] in
> +  match r with
> +  | 0 ->                        (* success *)
> +     String.trimr out
> +
> +  | 2 ->                        (* means tag not found, we return "" *)
> +     ""
> +
> +  | _ ->
> +     failwithf "blkid: %s: %s" tag err

Could you please add the device in the error message, like done in
the C implementation?

> @@ -641,13 +674,14 @@ extern void ocaml_exn_to_reply_with_error (const char *func, value exn);
>         | RBool _ -> assert false
>         | RConstString _ -> assert false
>         | RConstOptString _ -> assert false
> -       | RString _ ->
> +       | RString (RPlainString, _) ->
>            pr "  char *ret = strdup (String_val (retv));\n";
>            pr "  if (ret == NULL) {\n";
>            pr "    reply_with_perror (\"strdup\");\n";
>            pr "    CAMLreturnT (char *, NULL);\n";
>            pr "  }\n";
>            pr "  CAMLreturnT (char *, ret); /* caller frees */\n"
> +       | RString _ -> assert false

Could you please move these changes in patch #2?

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170719/b21e3b30/attachment.sig>


More information about the Libguestfs mailing list