[Libguestfs] [PATCH v5 5/7] New API: internal_yara_scan

Richard W.M. Jones rjones at redhat.com
Wed Apr 5 08:54:11 UTC 2017


On Tue, Apr 04, 2017 at 07:39:27PM +0300, Matteo Cafasso wrote:
> diff --git a/generator/structs.ml b/generator/structs.ml
> index c1c9b668e..01aa3d371 100644
> --- a/generator/structs.ml
> +++ b/generator/structs.ml
> @@ -469,6 +469,15 @@ let structs = [
>      ];
>      s_camel_name = "TSKDirent" };
> 
> +  (* Yara detection information. *)
> +  { defaults with
> +    s_name = "yara_detection";
> +    s_cols = [
> +    "name", FString;
> +    "rule", FString;
> +    ];
> +    s_camel_name = "YaraDetection" };
> +
>  ] (* end of structs *)

Using the field names ("name", "rule") is a real problem for OCaml
code, causing compile errors such as:

  OCAMLOPT elements.cmx
File "elements.ml", line 90, characters 72-79:
Error: This expression has type Guestfs.dirent list
       but an expression was expected of type Guestfs.yara_detection list
       Type Guestfs.dirent is not compatible with type Guestfs.yara_detection 

So you need to use a different prefix for these fields, I would
suggest yara_name, yara_rule.

Also please check everything compiles both with and without yara, and
all tools compile.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list