Displaying 20 results from an estimated 27 matches for "tag_val".
2018 Aug 20
1
[PATCH] common/mltools: getopt: add Getopt.OptString
...e (value argsv, value specsv, value anon_funv, valu
has_arg = 1;
break;
+ case 8: /* OptString of string * (string option -> unit) */
+ has_arg = 2;
+ break;
+
default:
error (EXIT_FAILURE, 0,
"internal error: unhandled Tag_val (actionv) = %d",
@@ -286,8 +290,11 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
caml_raise_out_of_memory ();
optstring = newstring;
optstring[optstring_len++] = key[0];
- if (has_arg)
+ if (has_arg > 0) {...
2018 Aug 21
0
[PATCH 1/2] common/mltools: getopt: add Getopt.OptString
...e (value argsv, value specsv, value anon_funv, valu
has_arg = 1;
break;
+ case 8: /* OptString of string * (string option -> unit) */
+ has_arg = 2;
+ break;
+
default:
error (EXIT_FAILURE, 0,
"internal error: unhandled Tag_val (actionv) = %d",
@@ -286,8 +290,11 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
caml_raise_out_of_memory ();
optstring = newstring;
optstring[optstring_len++] = key[0];
- if (has_arg)
+ if (has_arg > 0) {...
2018 Aug 21
4
[PATCH 0/2] RFC: add output selection for --machine-readable
Hi,
this is a first approach (hence RFC, since it misses tests &
documentation) in selecting the output for --machine-readable.
The possible choices are:
* --machine-readable: to stdout, like before
* --machine-readable=file:name-of-file: to the specified file
* --machine-readable=stream:stdout: explicitly to stdout
* --machine-readable=stream:stderr: explicitly to stderr
This makes it
2016 Jul 15
0
[PATCH 1/3] mllib: Fix parsing of integers on the command line and use correct int type.
...tions(+), 3 deletions(-)
diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c
index 1f129a7..afb8793 100644
--- a/mllib/getopt-c.c
+++ b/mllib/getopt-c.c
@@ -247,7 +247,8 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
actionv = Field (specv, 1);
switch (Tag_val (actionv)) {
- int num;
+ long num;
+ int nchars;
case 0: /* Unit of (unit -> unit) */
v = Field (actionv, 0);
@@ -274,7 +275,8 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
break;
case 5: /* Int of string * (int ->...
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...cs_len; ++i) {
+ size_t len, j;
+ const char *param = NULL;
+ int columns = 0;
+
+ specv = Field (specsv, i);
+ keysv = Field (specv, 0);
+ actionv = Field (specv, 1);
+ docv = Field (specv, 2);
+ len = Wosize_val (keysv);
+
+ if (len == 0)
+ continue;
+
+ switch (Tag_val (actionv)) {
+ case 0: /* Unit of (unit -> unit) */
+ case 1: /* Set of bool ref */
+ case 2: /* Clear of bool ref */
+ break;
+
+ case 3: /* String of string * (string -> unit) */
+ case 4: /* Set_string of string * string ref */
+ case 5: /* Int of string * (int...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...st char *key = String_val (Field (keysv, j));
+ size_t key_len = strlen (key);
+ int has_arg = 0;
+
+ /* We assume that the key is valid, with the checks done in the
+ * OCaml Getopt.parse_argv. */
+ ++key;
+ if (key[0] == '-')
+ ++key;
+
+ switch (Tag_val (actionv)) {
+ case 0: /* Unit of (unit -> unit) */
+ case 1: /* Set of bool ref */
+ case 2: /* Clear of bool ref */
+ has_arg = 0;
+ break;
+
+ case 3: /* String of string * (string -> unit) */
+ case 4: /* Set_string of string * string ref */
+...
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...cs_len; ++i) {
+ size_t len, j;
+ const char *param = NULL;
+ int columns = 0;
+
+ specv = Field (specsv, i);
+ keysv = Field (specv, 0);
+ actionv = Field (specv, 1);
+ docv = Field (specv, 2);
+ len = Wosize_val (keysv);
+
+ if (len == 0)
+ continue;
+
+ switch (Tag_val (actionv)) {
+ case 0: /* Unit of (unit -> unit) */
+ case 1: /* Set of bool ref */
+ case 2: /* Clear of bool ref */
+ break;
+
+ case 3: /* String of string * (string -> unit) */
+ case 4: /* Set_string of string * string ref */
+ case 5: /* Int of string * (int...
2018 Sep 19
0
[PATCH 2/2] Introduce a --key option in tools that accept keys
...*ks = NULL;
- inspect_do_decrypt (g);
+ while (keysv != Val_emptylist) {
+ struct key_store_key key;
+
+ elemv = Field (keysv, 0);
+ key.device = strdup (String_val (Field (elemv, 0)));
+ if (!key.device)
+ caml_raise_out_of_memory ();
+
+ v = Field (elemv, 1);
+ switch (Tag_val (v)) {
+ case 0: /* KeyString of string */
+ key.type = key_string;
+ key.string.s = strdup (String_val (Field (v, 0)));
+ if (!key.string.s)
+ caml_raise_out_of_memory ();
+ break;
+ case 1: /* KeyFileName of string */
+ key.type = key_file;
+ key.file....
2016 Jul 18
4
[PATCH 1/3] mllib: Getopt: point to man page as additional help
On error, point also to the man page of the current tool in addition to
'$TOOL --help'.
---
mllib/getopt-c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c
index bf40f91..3efd5d3 100644
--- a/mllib/getopt-c.c
+++ b/mllib/getopt-c.c
@@ -69,8 +69,8 @@ cleanup_option_list (void *ptr)
static void __attribute__((noreturn))
2018 Aug 23
3
[PATCH v2 0/2] add output selection for --machine-readable
Hi,
this adds the possibility to select the output for --machine-readable
in OCaml tools.
The possible choices are:
* --machine-readable: to stdout, like before
* --machine-readable=file:name-of-file: to the specified file
* --machine-readable=stream:stdout: explicitly to stdout
* --machine-readable=stream:stderr: explicitly to stderr
This makes it possible to add additional output for
2018 Sep 19
5
[PATCH 0/2] RFC: --key option for tools
Hi,
the following series adds a --key option in the majority of tools: this
makes it possible to pass LUKS credentials programmatically, avoid the
need to manually input them, or unsafely pass them via stdin.
Thanks,
Pino Toscano (2):
mltools: create a cmdline_options struct
Introduce a --key option in tools that accept keys
builder/cmdline.ml | 2 +-
2016 Jul 15
5
[PATCH 0/3] mllib: Various fixes and changes to Getopt module.
The second patch is obviously not complete yet - for discussion only.
Rich.
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...but I could not get the
+ * official way to work, and this way does work. See
+ * http://caml.inria.fr/pub/ml-archives/caml-list/2006/05/097f63cfb39a80418f95c70c3c520aa8.en.html
+ * http://caml.inria.fr/pub/ml-archives/caml-list/2009/06/797e2f797f57b8ea2a2c0e431a2df312.en.html
+ */
+ if (Tag_val (Field (exn, 0)) == String_tag)
+ /* For End_of_file and a few other constant exceptions. */
+ exn_name = String_val (Field (exn, 0));
+ else
+ /* For most exceptions. */
+ exn_name = String_val (Field (Field (exn, 0), 0));
+
+ if (verbose)
+ fprintf (stderr, "ocaml_exn: '...
2010 Jun 28
8
[PATCH] add xl ocaml bindings
...t;cur_vcpus = Int_val(Field(v, 4));
+ c_val->max_memkb = Int64_val(Field(v, 5));
+ c_val->target_memkb = Int64_val(Field(v, 6));
+ c_val->video_memkb = Int64_val(Field(v, 7));
+ c_val->shadow_memkb = Int64_val(Field(v, 8));
+ c_val->kernel = String_val(Field(v, 9));
+ c_val->hvm = Tag_val(Field(v, 10)) == 0;
+ infopriv = Field(Field(v, 10), 0);
+ if (c_val->hvm) {
+ c_val->u.hvm.pae = Bool_val(Field(infopriv, 0));
+ c_val->u.hvm.apic = Bool_val(Field(infopriv, 1));
+ c_val->u.hvm.acpi = Bool_val(Field(infopriv, 2));
+ c_val->u.hvm.nx = Bool_val(Field(infopriv, 3))...
2017 Jul 21
0
[PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...but I could not get the
+ * official way to work, and this way does work. See
+ * http://caml.inria.fr/pub/ml-archives/caml-list/2006/05/097f63cfb39a80418f95c70c3c520aa8.en.html
+ * http://caml.inria.fr/pub/ml-archives/caml-list/2009/06/797e2f797f57b8ea2a2c0e431a2df312.en.html
+ */
+ if (Tag_val (Field (exn, 0)) == String_tag)
+ /* For End_of_file and a few other constant exceptions. */
+ exn_name = String_val (Field (exn, 0));
+ else
+ /* For most exceptions. */
+ exn_name = String_val (Field (Field (exn, 0), 0));
+
+ if (verbose)
+ fprintf (stderr, "ocaml_exn: '...
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
.../* Points to the two-element tuple. */
+ name = String_val (Field (v, 0));
+ strncpy (params[i].field, name, VIR_DOMAIN_SCHED_FIELD_LENGTH);
+ params[i].field[VIR_DOMAIN_SCHED_FIELD_LENGTH-1] = '\0';
+ v = Field (v, 1); /* Points to the sched_param_value block. */
+ switch (Tag_val (v)) {
+ case 0:
+ params[i].type = VIR_DOMAIN_SCHED_FIELD_INT;
+ params[i].value.i = Int32_val (Field (v, 0));
+ break;
+ case 1:
+ params[i].type = VIR_DOMAIN_SCHED_FIELD_UINT;
+ params[i].value.ui = Int32_val (Field (v, 0));
+ break;
+ case 2:
+ params...
2019 Dec 16
3
[v2v PATCH 0/2] Move libvirt-ocaml copy to v2v repo
libvirt-ocaml is used only by virt-v2v, so move it to this repository,
instead of having it around in the common submodule.
The removal from common will happen later.
Pino Toscano (2):
common: Bundle the libvirt-ocaml library for use by virt-v2v
build: switch embedded copy of libvirt-ocaml
.gitignore | 2 +
3rdparty/libvirt-ocaml/Makefile.am |
2018 Aug 30
8
[PATCH 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not
2018 Nov 27
8
[PATCH v2 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not
2019 Jan 30
8
[PATCH v3 0/7] RFC: switch v2v to ocaml-libvirt
Hi,
this is a mostly done attempt to switch to ocaml-libvirt, embedding the
latest version of it from git. This way, it is possible to improve the
way v2v connects to libvirt for both input, and output modules, and
interacts with libvirt (e.g. no more virsh calls needed in virt-v2v).
As side effect, virt-v2v now requires libvirt, as keeping it optional
would create too much burden.
I could not