Displaying 11 results from an estimated 11 matches for "guestfs_int_string_is_valid".
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to
have a common function to do this. This is such a function.
The main advantage is it includes unit tests which the previous
functions did not.
Rich.
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
...ize_t len = strlen (term);
-
- if (len == 0 || len > 16)
- return false;
-
- while (len > 0) {
- char c = *term++;
- len--;
- if (!c_isalnum (c) && c != '-' && c != '_')
- return false;
- }
-
- return true;
-}
+#define VALID_TERM(term) \
+ guestfs_int_string_is_valid ((term), 1, 16, true, true, "-_")
#if defined(__powerpc64__)
#define SERIAL_CONSOLE "console=hvc0 console=ttyS0"
@@ -196,7 +181,7 @@ guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev,
guestfs_int_add_string (g, &argv, "guestfs_network=...
2017 Aug 31
2
The issue about code coverage for libguestfs
...e unix -linkpkg \
-warn-error A -I .. mlguestfs.cmxa create_disk.ml -o create_disk
ocamlfind ocamlopt -cclib -L../../lib/.libs -package unix -linkpkg \
-warn-error A -I .. mlguestfs.cmxa debug_logging.ml -o debug_logging
../libmlguestfs.a(libguestfsocaml_a-utils.o): In function `guestfs_int_string_is_valid':
utils.c:(.text+0xb99): undefined reference to `c_isalpha'
utils.c:(.text+0xbbf): undefined reference to `c_isdigit'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
make[2]: *** [debug_logging] Error 2
make[2]: *** Waiting f...
2017 Jan 03
1
Re: [PATCH] lib: Use a common function to validate strings.
...tfs-internal-frontend.h | 3 ++
> src/unit-tests.c | 40 +++++++++++++++++++++++++
> src/utils.c | 50 +++++++++++++++++++++++++++++--
> 6 files changed, 110 insertions(+), 74 deletions(-)
>
Look reasonable, just a couple of notes.
> +bool
> +guestfs_int_string_is_valid (const char *str,
> + size_t min_length, size_t max_length,
> + bool alpha, bool digit, const char *extra)
min_length and max_length could be signed (ssize_t), with -1 (and even
0) indicating no actual limit. IMHO that could be slightly...
2017 Sep 01
2
Re: The issue about code coverage for libguestfs
...-ftest-coverage -lgcov"; export LDFLAGS
>
> > +sed -i 's/^CFLAGS = -fprofile-arcs -ftest-coverage -g -O0/CFLAGS = /g'
> > /home/mockbuild/rpmbuild/BUILD/libguestfs-1.36.5/ocaml/Makefile
>
> > ../libmlguestfs.a(libguestfsocaml_a-utils.o): In function
> > `guestfs_int_string_is_valid':
> > utils.c:(.text+0xb99): undefined reference to `c_isalpha'
> > utils.c:(.text+0xbbf): undefined reference to `c_isdigit'
>
> I suppose that we need to link the OCaml bindings to -lgnu, which
> your patch attempts:
>
> > +libguestfsocaml_a_LIBADD = \...
2017 May 17
7
[PATCH 1/5] s390x: launch: libvirt: Use <console> device sclp for appliance debug messages (RHBZ#1376547).
Thanks: Cole Robinson, Dan Horak, Thomas Huth.
---
lib/launch-libvirt.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index f66c8e0ef..4adb2cfb3 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -1359,6 +1359,7 @@ construct_libvirt_xml_devices (guestfs_h *g,
return -1;
}
+#ifndef __s390x__
/*
2017 May 17
0
[PATCH 3/5] s390x: appliance: Use /dev/ttysclp0 for serial console.
---
lib/appliance-kcmdline.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/appliance-kcmdline.c b/lib/appliance-kcmdline.c
index 4dde7a865..a394e6e67 100644
--- a/lib/appliance-kcmdline.c
+++ b/lib/appliance-kcmdline.c
@@ -40,11 +40,19 @@
guestfs_int_string_is_valid ((term), 1, 16, \
VALID_FLAG_ALPHA|VALID_FLAG_DIGIT, "-_")
-#if defined(__powerpc64__)
+#ifdef __powerpc64__
#define SERIAL_CONSOLE "console=hvc0 console=ttyS0"
-#elif defined(__arm__) || defined(__aarch64__)
+#endif
+
+#if defined(__arm__) ||...
2017 Jun 08
1
[PATCH] lib: create: Allow any [[:alnum:]]+ string as a backingfmt parameter.
...++ b/lib/create.c
@@ -241,6 +241,14 @@ is_power_of_2 (unsigned v)
return v && ((v & (v - 1)) == 0);
}
+/**
+ * Check for valid backing format. Allow any C<^[[:alnum]]+$>
+ * (in C locale), but limit the length to something reasonable.
+ */
+#define VALID_FORMAT(format) \
+ guestfs_int_string_is_valid ((format), 1, 16, \
+ VALID_FLAG_ALPHA|VALID_FLAG_DIGIT, "")
+
static int
disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size,
const char *backingfile,
@@ -267,12 +275,7 @@ disk_create_qcow2 (guestfs_h *g, const char...
2017 Aug 31
0
Re: The issue about code coverage for libguestfs
...LAGS
> +LDFLAGS="-fprofile-arcs -ftest-coverage -lgcov"; export LDFLAGS
> +sed -i 's/^CFLAGS = -fprofile-arcs -ftest-coverage -g -O0/CFLAGS = /g' /home/mockbuild/rpmbuild/BUILD/libguestfs-1.36.5/ocaml/Makefile
> ../libmlguestfs.a(libguestfsocaml_a-utils.o): In function `guestfs_int_string_is_valid':
> utils.c:(.text+0xb99): undefined reference to `c_isalpha'
> utils.c:(.text+0xbbf): undefined reference to `c_isdigit'
I suppose that we need to link the OCaml bindings to -lgnu, which
your patch attempts:
> +libguestfsocaml_a_LIBADD = \
> + $(top_builddir)/gnulib/lib/l...
2017 Jan 20
5
[PATCH 0/5] Rename src/ to lib/ and move common code to common/
This patch series moves some files and directories around but is only
code motion (or supposed to be).
A new directory, common/, is created for all of the common code which
is currently shared in random ways between parts of the project.
And src/ becomes lib/ (the largest change, but mostly mechanical).
In full this series makes the following changes:
src/libprotocol -> common/protocol
2017 Jan 25
10
[PATCH v2 0/7] Rename src/ to lib/ and move common code to common/
Previous patch series was posted here:
https://www.redhat.com/archives/libguestfs/2017-January/msg00059.html
v2 simply extends this patch series to cover the extra directories
common/edit, common/progress, common/windows and common/parallel.
The only remaining item is to consider whether we should rename mllib
to something else, mlcommon was my suggestion.
Rich.