search for: of_int

Displaying 20 results from an estimated 78 matches for "of_int".

2015 Jan 23
0
[PATCH 2/2] mllib: add simple tests for the JSON module
...quot;: false +}" + (JSON.string_of_doc ~fmt:JSON.Indented doc) + +let test_int () = + let doc = [ "test_zero", JSON.Int 0; + "test_pos", JSON.Int 5; + "test_neg", JSON.Int (-5); + "test_pos64", JSON.Int64 (Int64.of_int 10); + "test_neg64", JSON.Int64 (Int64.of_int (-10)); ] in + assert_equal_string + "{ \"test_zero\": 0, \"test_pos\": 5, \"test_neg\": -5, \"test_pos64\": 10, \"test_neg64\": -10 }" + (JSON.string_of_doc doc);...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
...s_tests.ml index 09d5c51..283e9a1 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -27,6 +27,7 @@ let prog = "common_utils_tests" let assert_equal_string = assert_equal ~printer:(fun x -> x) let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") (* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *)...
2019 Feb 25
0
[PATCH 3/3] v2v: add -o json output mode
...= + List.map (fun (x, y) -> x, JSON.String y) + +let push_optional_string lst name = function + | None -> () + | Some v -> List.push_back lst (name, JSON.String v) + +let push_optional_int lst name = function + | None -> () + | Some v -> List.push_back lst (name, JSON.Int (Int64.of_int v)) + +let json_unknown_string = function + | "unknown" -> JSON.Null + | v -> JSON.String v + +let find_target_disk targets { s_disk_id = id } = + try List.find (fun t -> t.target_overlay.ov_source.s_disk_id = id) targets + with Not_found -> assert false + +let create_json...
2019 Mar 29
0
[PATCH v2 3/3] v2v: add -o json output mode
...= + List.map (fun (x, y) -> x, JSON.String y) + +let push_optional_string lst name = function + | None -> () + | Some v -> List.push_back lst (name, JSON.String v) + +let push_optional_int lst name = function + | None -> () + | Some v -> List.push_back lst (name, JSON.Int (Int64.of_int v)) + +let json_unknown_string = function + | "unknown" -> JSON.Null + | v -> JSON.String v + +let find_target_disk targets { s_disk_id = id } = + try List.find (fun t -> t.target_overlay.ov_source.s_disk_id = id) targets + with Not_found -> assert false + +let create_json...
2015 Oct 08
0
[PATCH] v2v: Add xpath_int64 functions, and use them to read memory values.
...@@ let parse_libvirt_xml ?conn xml = | None | Some "" -> error (f_"in the libvirt XML metadata, <name> is missing or empty") | Some s -> s in - let memory = xpath_int_default "/domain/memory/text()" (1024 * 1024) in - let memory = Int64.of_int memory *^ 1024L in + let memory = xpath_int64_default "/domain/memory/text()" (1024L *^ 1024L) in + let memory = memory *^ 1024L in let vcpu = xpath_int_default "/domain/vcpu/text()" 1 in let features = diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index a758e94..cd...
2015 Dec 14
4
[PATCH 0/2] resize: Split out the command line parsing into Cmdline
Some simple refactoring of virt-resize. I originally had the idea that we could turn virt-resize into a library (cf. virt-customize) and use it from virt-builder, but I now don't think that would make any meaningful difference. In particular we'd still have to open the handle the same number of times. These two patches are left over from my work on that. Rich.
2017 Mar 07
0
[PATCH v4 5/9] builder: add Index_parser.write_entry function
...arch = "test_arch"; + signature_uri = None; + checksums = Some [Checksums.SHA256 "256checksum"; Checksums.SHA512 "512checksum"]; + revision = Utils.Rev_int 42; + format = Some "qcow2"; + size = Int64 .of_int 123456; + compressed_size = Some (Int64.of_int 12345); + expand = Some "/dev/sda1"; + lvexpand = Some "/some/lv"; + notes = [ ("", "Notes split\non several lines\n with starting space") ]; + hidden = false; +...
2009 Sep 07
1
Usage of OCaml/R binding.
...external to_int : sexp -> int = "int_of_sexp" > 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" > externa...
2009 Sep 07
1
Usage of OCaml/R binding.
...external to_int : sexp -> int = "int_of_sexp" > 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" > externa...
2019 Mar 29
5
[PATCH v2 0/3] v2v: add -o json output mode
This series adds a new output mode for virt-v2v, called -o json. It produces local files, just like -o local, although the metadata produced is a JSON file with data that v2v collected in the conversion process. This can be useful for converting to unsupported destinations, still based on QEMU/KVM. In addition to a simple different metadata, it offers a way to relocate the disks, with
2017 Sep 18
0
[PATCH v9 4/7] builder: add Index.write_entry function
...file_uri = "image_path"; + arch = "test_arch"; + signature_uri = None; + checksums = Some [Checksums.SHA512 "512checksum"]; + revision = Utils.Rev_int 42; + format = Some "qcow2"; + size = Int64.of_int 123456; + compressed_size = Some (Int64.of_int 12345); + expand = Some "/dev/sda1"; + lvexpand = Some "/some/lv"; + notes = [ ("", "Notes split\non several lines\n\n with starting space ") ]; + hidden = false;...
2017 Oct 27
0
[PATCH v11 6/8] builder: add Index.write_entry function
...file_uri = "image_path"; + arch = "test_arch"; + signature_uri = None; + checksums = Some [Checksums.SHA512 "512checksum"]; + revision = Utils.Rev_int 42; + format = Some "qcow2"; + size = Int64.of_int 123456; + compressed_size = Some (Int64.of_int 12345); + expand = Some "/dev/sda1"; + lvexpand = Some "/some/lv"; + notes = [ ("", "Notes split\non several lines\n\n with starting space ") ]; + hidden = false;...
2017 Oct 05
0
[PATCH v11 4/6] builder: add Index.write_entry function
...file_uri = "image_path"; + arch = "test_arch"; + signature_uri = None; + checksums = Some [Checksums.SHA512 "512checksum"]; + revision = Utils.Rev_int 42; + format = Some "qcow2"; + size = Int64.of_int 123456; + compressed_size = Some (Int64.of_int 12345); + expand = Some "/dev/sda1"; + lvexpand = Some "/some/lv"; + notes = [ ("", "Notes split\non several lines\n\n with starting space ") ]; + hidden = false;...
2019 Feb 25
7
[PATCH 0/3] RFC: v2v: add -o json output mode
This series adds a new output mode for virt-v2v, called -o json. It produces local files, just like -o local, although the metadata produced is a JSON file with data that v2v collected in the conversion process. This can be useful for converting to unsupported destinations, still based on QEMU/KVM. In addition to a simple different metadata, it offers a way to relocate the disks, with
2014 Sep 19
22
[PATCH v2 00/13] virt-resize: add support for resizing MBR logical partitions
Hi Rich, This is v2 series to add support for resizing MBR logical partitions. I found the reason of problem in v1 that parted reports error when adding logical partitions, is that logical partitions are not aligned to 2 sectors. This problem doesn't appear in v2. This is for early review, because of: 1. I'm not sure the splitting of patches is appropriate or not, but it's much
2016 Sep 30
2
[PATCH] customize: Add --append-line.
...e default_newline () in + + let line = line ^ newline in + + (* Do we need to append a newline to the existing file? *) + let last_chars = + let len = String.length newline in + if size <= 0L then newline (* empty file ends in virtual newline *) + else if size >= Int64.of_int len then + g#pread path len (size -^ Int64.of_int len) + else + g#pread path len 0L in + let line = + if last_chars = newline then line + else newline ^ line in + + (* Finally, append. *) + g#write_append path line + ) diff --git a/customize/append_line.mli b/...
2017 Jun 19
16
[PATCH v7 00/13] Refactor utilities
This is just the utilities part of the patch series from: https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html I believe this addresses everything raised in comments on that patch series. Rich.
2017 Jul 14
0
[PATCH 20/27] daemon: Reimplement ‘part_list’ API in OCaml.
...arted print' command" + +let part_list device = + let lines = print_partition_table ~add_m_option:true device in + + List.map ( + fun line -> + try sscanf line "%d:%LdB:%LdB:%LdB" + (fun num start end_ size -> + { part_num = Int32.of_int num; + part_start = start; part_end = end_; part_size = size }) + with Scan_failure err -> + failwithf "could not parse row from output of 'parted print' command: %s: %s" + line err + ) lines diff --git a/daemon/parted.mli b/dae...
2019 Apr 23
0
[PATCH nbdkit v2 1/2] ocaml: Change pread method to avoid leaking heap memory.
...('a -> int32 -> int64 -> flags -> unit) option; diff --git a/tests/test_ocaml_plugin.ml b/tests/test_ocaml_plugin.ml index 842f10e..f27c099 100644 --- a/tests/test_ocaml_plugin.ml +++ b/tests/test_ocaml_plugin.ml @@ -28,9 +28,11 @@ let test_close h = let test_get_size h = Int64.of_int (Bytes.length h.disk) -let test_pread h buf offset _ = - let len = Bytes.length buf in - Bytes.blit h.disk (Int64.to_int offset) buf 0 len +let test_pread h count offset _ = + let count = Int32.to_int count in + let buf = Bytes.create count in + Bytes.blit h.disk (Int64.to_int offset) buf 0...
2017 Jan 12
0
[PATCH] resize: support non-local output disks (RHBZ#1404182)
...e) insize; - debug "%s size %Ld bytes" outfile outsize; + debug "%s size %Ld bytes" (fst outfile) outsize; sectsize, insize, outsize in let max_bootloader = @@ -390,7 +400,7 @@ read the man page virt-resize(1). (fst infile) insize; if outsize < Int64.of_int max_bootloader then error (f_"%s: file is too small to be a disk image (%Ld bytes)") - outfile outsize; + (fst outfile) outsize; (* Get the source partition type. *) let parttype, parttype_string = @@ -983,7 +993,7 @@ read the man page virt-resize(1). (* Try ha...