Displaying 20 results from an estimated 28 matches for "of_float".
2017 Sep 21
18
[PATCH v2 00/18] Replace many more uses of the Str module with PCRE.
v1 was here:
https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html
This is a more complete evolution of the earlier patch. It replaces
most important uses of Str with PCRE throughout the code. It also
extends the bindings with some useful features like case-insensitive
regexps.
The main places I *didn't* touch are the generator (GObject uses Str
extensively); and
2017 Sep 22
27
[PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
v1:
https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html
v2:
https://www.redhat.com/archives/libguestfs/2017-September/msg00158.html
v3 is almost identical to v2, but I have added 4 extra commits to
almost finish the job of replacing Str everywhere possible (note it's
not possible to replace Str in common/mlstdutils or the generator
because those are pure OCaml).
As
2015 Jul 13
2
[PATCH 1/2] utils: import parse_size from libguestfs
..."10G". *)
+let parse_size =
+ let const_re = Str.regexp "^\\([.0-9]+\\)\\([bKMG]\\)$" in
+ fun field ->
+ let matches rex = Str.string_match rex field 0 in
+ let sub i = Str.matched_group i field in
+ let size_scaled f = function
+ | "b" -> Int64.of_float f
+ | "K" -> Int64.of_float (f *. 1024.)
+ | "M" -> Int64.of_float (f *. 1024. *. 1024.)
+ | "G" -> Int64.of_float (f *. 1024. *. 1024. *. 1024.)
+ | _ -> assert false
+ in
+
+ if matches const_re then (
+ size_scaled (float_o...
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...d_object key yv with
- | JSON_parser_object o -> o
+ | JSON.Dict fields -> fields
| _ -> assert false (* object_find_object already errors out. *)
let object_get_number key yv =
match object_find key yv with
- | JSON_parser_number n -> n
- | JSON_parser_double d -> Int64.of_float d
+ | JSON.Int n -> n
+ | JSON.Float f -> Int64.of_float f
| _ -> error (f_"the value for the key ā%sā is not an integer") key
let objects_get_string key yvs =
@@ -74,7 +65,7 @@ let objects_get_string key yvs =
| [] -> None
| x :: xs ->
(match objec...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2:
- Added back the null value.
- Reran the tests.
Rich.
2017 Jan 03
0
[PATCH 1/5] builder: extract Yajl helper functions to yajl.ml
...;)
-
-let object_get_object key yv =
- match object_find_object key yv with
- | Yajl_object o -> o
- | _ -> assert false (* object_find_object already errors out. *)
-
-let object_get_number key yv =
- match object_find key yv with
- | Yajl_number n -> n
- | Yajl_double d -> Int64.of_float d
- | _ -> error (f_"the value for the key '%s' is not an integer") key
-
-let objects_get_string key yvs =
- let rec loop = function
- | [] -> None
- | x :: xs ->
- (match object_find_optional key x with
- | Some (Yajl_string s) -> Some s
- | So...
2015 Feb 27
5
[PATCH 0/4] firstboot: assorted enhancements
This patchset attempts to address a number of shortcomings in the
firstboot infrastructure I came across while working with v2v conversion
of various Windows VMs.
Roman Kagan (4):
firstboot: consolidate line ending conversion
firstboot: enhance firstboot driver script for Windows
firstboot: make script naming descriptive
convert_windows: split firstboot into steps
2009 Sep 07
1
Usage of OCaml/R binding.
...external to_float : sexp -> float = "float_of_sexp"
> external to_string : sexp -> string = "string_of_sexp"
> external of_bool : bool -> sexp = "sexp_of_bool"
> external of_int : int -> sexp = "sexp_of_int"
> external of_float : float -> sexp = "sexp_of_float"
> external of_string : string -> sexp = "sexp_of_string"
> external to_bool_array : sexp -> bool array = "bool_array_of_sexp"
> external to_int_array : sexp -> int array = "int_array_of_sexp"...
2009 Sep 07
1
Usage of OCaml/R binding.
...external to_float : sexp -> float = "float_of_sexp"
> external to_string : sexp -> string = "string_of_sexp"
> external of_bool : bool -> sexp = "sexp_of_bool"
> external of_int : int -> sexp = "sexp_of_int"
> external of_float : float -> sexp = "sexp_of_float"
> external of_string : string -> sexp = "sexp_of_string"
> external to_bool_array : sexp -> bool array = "bool_array_of_sexp"
> external to_int_array : sexp -> int array = "int_array_of_sexp"...
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...=
match object_find_object key yv with
- | Yajl_object o -> o
+ | JSON_parser_object o -> o
| _ -> assert false (* object_find_object already errors out. *)
let object_get_number key yv =
match object_find key yv with
- | Yajl_number n -> n
- | Yajl_double d -> Int64.of_float d
+ | JSON_parser_number n -> n
+ | JSON_parser_double d -> Int64.of_float d
| _ -> error (f_"the value for the key ā%sā is not an integer") key
let objects_get_string key yvs =
@@ -74,7 +74,7 @@ let objects_get_string key yvs =
| [] -> None
| x :: xs ->...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of:
https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
2012 Sep 21
3
[PATCH] sysprep: handle distro specific sysv scripts
...is not supported" distro
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12
2015 Feb 27
0
[PATCH 1/4] firstboot: consolidate line ending conversion
..." in
+
+ g#write (firstboot_dir // "firstboot.bat") (unix2dos firstboot_script);
(* Open the SYSTEM hive. *)
let systemroot = g#inspect_get_windows_systemroot root in
@@ -284,7 +283,7 @@ let add_firstboot_script (g : Guestfs.guestfs) root i content =
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%04d-%Ld-%s.bat" firstboot_dir i t r in
- g#write filename content
+ g#write filename (unix2dos content)
| _ ->
error (f_"guest type %s/%s is not supported") typ distro...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to
bake qemu-img measure output into our API.
This patch series runs qemu-img measure behind the scenes, but then
parses the output and sums it to a single number which we print.
Doing that required a bit of reworking, moving the Jansson [JSON
parser] bindings from virt-builder into the common directory and
a couple of other
2016 May 22
0
[PATCH 2/2] ocaml tools: Use a common debug function.
...) mpstats
) in
- if verbose () then
- printf "estimate_target_size: fs_free = %Ld [%s]\n%!"
- fs_free (human_size fs_free);
+ debug "estimate_target_size: fs_free = %Ld [%s]"
+ fs_free (human_size fs_free);
let scaled_saving = Int64.of_float (Int64.to_float fs_free *. ratio) in
- if verbose () then
- printf "estimate_target_size: scaled_saving = %Ld [%s]\n%!"
- scaled_saving (human_size scaled_saving);
+ debug "estimate_target_size: scaled_saving = %Ld [%s]"
+ scaled_saving (human_size sca...
2016 May 22
4
ocaml tools: Use a common debug function.
Add a Common_utils.debug function for printing messages
only when in verbose mode.
Rich.
2015 Aug 12
0
[PATCH 2/2] builder: support Simple Streams v1.0 as index metadata
...et object_get_object key yv =
+ (match object_find_object key yv with
+ | Yajl_object o -> o
+ | _ -> assert false (* object_find_object already errors out. *)
+ )
+
+let object_get_number key yv =
+ (match object_find key yv with
+ | Yajl_number n -> n
+ | Yajl_double d -> Int64.of_float d
+ | _ -> error (f_"the value for the key '%s' is not an integer") key
+ )
+
+let objects_get_string key yvs =
+ let rec loop = function
+ | [] -> None
+ | x :: xs ->
+ (match object_find_optional key x with
+ | Some (Yajl_string s) -> Some s
+...
2015 Sep 07
5
[PATCH 0/4 v3] builder: support for Simple Streams metadata
Hi,
this series adds a basic support for Simple Streams v1.0 metadata
files. This makes it possible to create a repository .conf files with
[cirros]
uri=http://download.cirros-cloud.net
format=simplestreams
to read the latest version of each CirrOS image.
Thanks,
Pino Toscano (4):
builder: add non-int revisions
builder: add simple libyajl binding
build: expose HAVE_YAJL to automake
2015 Sep 07
0
[PATCH 4/4] builder: support Simple Streams v1.0 as index metadata
...;)
+
+let object_get_object key yv =
+ match object_find_object key yv with
+ | Yajl_object o -> o
+ | _ -> assert false (* object_find_object already errors out. *)
+
+let object_get_number key yv =
+ match object_find key yv with
+ | Yajl_number n -> n
+ | Yajl_double d -> Int64.of_float d
+ | _ -> error (f_"the value for the key '%s' is not an integer") key
+
+let objects_get_string key yvs =
+ let rec loop = function
+ | [] -> None
+ | x :: xs ->
+ (match object_find_optional key x with
+ | Some (Yajl_string s) -> Some s
+ | So...
2015 Aug 12
4
[PATCH 0/2 v2] RFC: builder: support for Simple Streams metadata
Hi,
this series adds a basic support for Simple Streams v1.0 metadata
files. This makes it possible to create a repository .conf files with
[cirros]
uri=http://download.cirros-cloud.net
format=simplestreams
to read the latest version of each CirrOS image.
TODO items:
- check the pasted metadata: listing and creating images works,
so most of the current metadata is correct
- possibly wait