search for: usage_msgv

Displaying 14 results from an estimated 14 matches for "usage_msgv".

Did you mean: usage_msg
2016 Jul 11
0
Re: [PATCH v2] OCaml tools: add and use a Getopt module
...t; + if (Is_exception_result (rv)) > + fprintf (stderr, > + "libguestfs: uncaught OCaml exception in getopt callback: %s", Does this need \n? > + case 0: > + if (STREQ (longopts[option_index].name, "help")) { > + show_help (specsv, usage_msgv); > + } > + /* specv_index set already -- nothing to do. */ > + break; > + > + case 'h': > + show_help (specsv, usage_msgv); > + break; Is this right? Several commands (eg. virt-df) take a -h option which isn't for help. The new code s...
2016 Jul 18
2
[PATCH] mllib: Getopt: fix integer parsing
...T_MIN || num >= INT_MAX) { + fprintf (stderr, _("%s: %s: integer out of range\n"), + guestfs_int_program_name, arg); + show_error (EXIT_FAILURE); + } + + return (int) num; +} + value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv) { @@ -274,21 +296,13 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu break; case 5: /* Int of string * (int -> unit) */ - if (sscanf (optarg, "%d", &num) != 1) { - fprintf (stderr, _("'%s' is not a numeri...
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...t;caml/memory.h> +#include <caml/mlvalues.h> +#include <caml/callback.h> +#include <caml/printexc.h> + +#include <guestfs.h> +#include "guestfs-internal-frontend.h" + +extern value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv); + +#define Val_none Val_int(0) + +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_FREE_OPTION_LIST __attribute__((cleanup(cleanup_option_list))) + +static void +cleanup_option_list (void *ptr) +{ + struct option *opts = * (struct option **) ptr; + struct option *p = opts; + + while (p->name...
2016 Jul 18
0
Re: [PATCH] mllib: Getopt: fix integer parsing
...These bounds are not tight enough. On 32 bit they should check the range of a 31 bit signed int, and on 64 bit, a 63 bit signed int. Rich. > + } > + > + return (int) num; > +} > + > value > guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv) > { > @@ -274,21 +296,13 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu > break; > > case 5: /* Int of string * (int -> unit) */ > - if (sscanf (optarg, "%d", &num) != 1) { > - fprintf (stderr, _...
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...t;caml/memory.h> +#include <caml/mlvalues.h> +#include <caml/callback.h> +#include <caml/printexc.h> + +#include <guestfs.h> +#include "guestfs-internal-frontend.h" + +extern value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv); + +#define Val_none Val_int(0) + +static void +xwrite (int fd, const void *v_buf, size_t len) +{ + int r; + const char *buf = v_buf; + + while (len > 0) { + r = write (fd, buf, len); + if (r == -1) + error (EXIT_FAILURE, errno, "write"); + buf += r; + len -= r; +...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...caml/fail.h> +#include <caml/memory.h> +#include <caml/mlvalues.h> +#include <caml/callback.h> +#include <caml/printexc.h> + +#include "guestfs-internal-frontend.h" + +extern value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv); + +#define Val_none Val_int(0) + +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_FREE_OPTION_LIST __attribute__((cleanup(cleanup_option_list))) + +static void +cleanup_option_list (void *ptr) +{ + struct option *opts = * (struct option **) ptr; + struct option *p = opts; + + while (p->name...
2017 Jun 15
0
[PATCH v6 11/41] utils: Rename ‘guestfs-internal-frontend.h’ to ‘utils.h’.
...getopt-c.c +++ b/mllib/getopt-c.c @@ -40,7 +40,7 @@ #include <caml/callback.h> #include <caml/printexc.h> -#include "guestfs-internal-frontend.h" +#include "utils.h" extern value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv); diff --git a/mllib/uri-c.c b/mllib/uri-c.c index ffb55306b..592d09939 100644 --- a/mllib/uri-c.c +++ b/mllib/uri-c.c @@ -31,7 +31,7 @@ #include <caml/mlvalues.h> #include <guestfs.h> -#include "guestfs-internal-frontend.h" +#include "utils.h" #include "...
2017 Jun 19
0
[PATCH v7 12/13] utils: Rename ‘guestfs-internal-frontend.h’ to ‘guestfs-utils.h’.
....c +++ b/mllib/getopt-c.c @@ -40,7 +40,7 @@ #include <caml/callback.h> #include <caml/printexc.h> -#include "guestfs-internal-frontend.h" +#include "guestfs-utils.h" extern value guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv); diff --git a/mllib/uri-c.c b/mllib/uri-c.c index ffb55306b..3e539c50e 100644 --- a/mllib/uri-c.c +++ b/mllib/uri-c.c @@ -31,7 +31,7 @@ #include <caml/mlvalues.h> #include <guestfs.h> -#include "guestfs-internal-frontend.h" +#include "guestfs-utils.h" #includ...
2016 Jun 27
0
Re: [PATCH] RFC: OCaml tools: add and use a Getopt module
...ons] to them. > > diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c > new file mode 100644 > index 0000000..d44448f > --- /dev/null > +++ b/mllib/getopt-c.c > @@ -0,0 +1,398 @@ > +value > +guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, value usage_msgv) I'm not convinced that this function is safe against OCaml GC compaction. In particular there are problems such as: ... > + for (j = 0; j < len; ++j) { > + const char *key = String_val (Field (keysv, j)); key now points to a string on the OCaml heap, and then ... > +...
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 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought. We have lots of utility functions, spread all over the repository, with not a lot of structure. This moves many of them under common/ and structures them so there are clear dependencies. This doesn't complete the job by any means. Other items I had on my to-do list for this change were: - Split up mllib/common_utils into: -
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of: https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html [PATCH 00/12] Refactor utility functions. plus: https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html [PATCH v3 00/19] Allow APIs to be implemented in OCaml. with the second patches rebased on top of the utility refactoring, and some other adjustments and extensions. This passes
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5: https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html Since v5, this now implements inspection almost completely for Linux and Windows guests. Rich.
2017 Jun 21
45
[PATCH v8 00/42] Refactor utilities and reimplement inspection.
v7 was: https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html https://www.redhat.com/archives/libguestfs/2017-June/msg00184.html I believe this addresses all comments received so far. Also it now passes a test where I compared about 100 disk images processed with old and new virt-inspector binaries. The output is identical in all cases except one which is caused by a bug in blkid