Displaying 20 results from an estimated 29 matches for "string_vector_append".
2023 Jan 28
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...vector *env)
assert (env->len == 0);
- /* Reserve slots env[0] and env[1]. */
+ /* Reserve slots env[0]..env[2] */
+ if (string_vector_reserve (env, 3) == -1)
+ goto err;
p = strdup ("LISTEN_PID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
if (p == NULL)
goto err;
- if (string_vector_append (env, p) == -1) {
- free (p);
- goto err;
- }
+ string_vector_append (env, p);
p = strdup ("LISTEN_FDS=1");
if (p == NULL)
goto err;
- if (string_vector_append (env, p) == -1) {
- free (p);
+ string_vector_append (env, p);
+ p = strdup ("LISTEN_FDNAMES=nbd&qu...
2023 Jan 31
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...;
>
> - /* Reserve slots env[0] and env[1]. */
> + /* Reserve slots env[0]..env[2] */
> + if (string_vector_reserve (env, 3) == -1)
> + goto err;
> p = strdup ("LISTEN_PID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
> if (p == NULL)
> goto err;
> - if (string_vector_append (env, p) == -1) {
> - free (p);
> - goto err;
> - }
> + string_vector_append (env, p);
> p = strdup ("LISTEN_FDS=1");
> if (p == NULL)
> goto err;
> - if (string_vector_append (env, p) == -1) {
> - free (p);
> + string_vector_append (e...
2023 Jan 30
2
[PATCH libnbd v2 4/4] generator/states-connect-socket-activation.c: Set LISTEN_FDNAMES
...slots in env. */
+ if (string_vector_reserve (env, using_name ? 3 : 2) == -1)
goto err;
p = strdup ("LISTEN_PID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
if (p == NULL)
@@ -61,11 +69,20 @@ prepare_socket_activation_environment (string_vector *env)
if (p == NULL)
goto err;
string_vector_append (env, p);
+ if (using_name) {
+ if (asprintf (&p, "LISTEN_FDNAMES=%s", h->sa_name) == -1)
+ goto err;
+ string_vector_append (env, p);
+ }
- /* Append the current environment, but remove LISTEN_PID, LISTEN_FDS. */
+ /* Append the current environment, but remove the...
2020 Jun 02
0
[PATCH nbdkit 2/5] vddk: Move reexec code to a new file.
...se original argv: %m");
+ return;
+ }
+ len += r;
+ } while (len == buflen);
+ nbdkit_debug ("original command line occupies %zu bytes", len);
+
+ /* Split cmdline into argv, then append one more arg. */
+ buflen = len;
+ len = 0;
+ while (len < buflen) {
+ if (string_vector_append (&argv, buf + len) == -1) {
+ argv_realloc_fail:
+ nbdkit_debug ("argv: realloc: %m");
+ return;
+ }
+ len += strlen (buf + len) + 1;
+ }
+ if (!env)
+ env = "";
+ nbdkit_debug ("adding reexeced_=%s", env);
+ if (asprintf (&reexeced, &...
2023 Jan 30
4
[PATCH libnbd v2 0/4] Pass LISTEN_FDNAMES with systemd socket activation
This is an alternative approach to
https://listman.redhat.com/archives/libguestfs/2023-January/030535.html
After discussing this with Dan Berrange we came to the conclusion that
you really might want to set LISTEN_FDNAMES to arbitrary short strings
(or not set it). Especially when talking to qemu-storage-daemon which
would allow you to use these names on the command line.
Rich.
2020 Jun 02
9
[PATCH nbdkit 0/5] vddk: Fix password parameter.
Probably needs a bit of cleanup, but seems like it is generally the
right direction.
One thing I've noticed is that the expect test randomly (but rarely)
hangs :-( I guess something is racey but I don't know what at the
moment.
Rich.
2023 Jan 31
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...[0] and env[1]. */
> > + /* Reserve slots env[0]..env[2] */
> > + if (string_vector_reserve (env, 3) == -1)
> > + goto err;
> > p = strdup ("LISTEN_PID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
> > if (p == NULL)
> > goto err;
> > - if (string_vector_append (env, p) == -1) {
> > - free (p);
> > - goto err;
> > - }
> > + string_vector_append (env, p);
> > p = strdup ("LISTEN_FDS=1");
> > if (p == NULL)
> > goto err;
> > - if (string_vector_append (env, p) == -1) {
> > -...
2020 Jun 02
0
[PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
...ytes", len);
+ if (r == 0)
+ break;
+ buf.size += r;
+ }
+ close (fd);
+ nbdkit_debug ("original command line occupies %zu bytes", buf.size);
/* Split cmdline into argv, then append one more arg. */
- buflen = len;
- len = 0;
- while (len < buflen) {
- if (string_vector_append (&argv, buf + len) == -1) {
+ for (len = 0; len < buf.size; len += strlen (buf.ptr + len) + 1) {
+ if (string_vector_append (&argv, buf.ptr + len) == -1) {
argv_realloc_fail:
nbdkit_debug ("argv: realloc: %m");
return;
}
- len += strlen (buf + len...
2023 Mar 25
4
[libnbd PATCH v5 0/4] pass LISTEN_FDNAMES with systemd socket activation
V4 was here (incorrectly versioned on the mailing list as v3):
<http://mid.mail-archive.com/20230323121016.1442655-1-lersek at redhat.com>.
See the Notes section on each patch for the v5 updates.
Laszlo Ersek (2):
socket activation: generalize environment construction
socket activation: set LISTEN_FDNAMES
Richard W.M. Jones (2):
common/include: Copy ascii-ctype functions from nbdkit
2020 Oct 27
6
[PATCH libnbd 0/5] info: --map: Coalesce adjacent extents of the same type.
This adds coalescing of adjacent extents of the same type, as
mentioned by Eric Blake in the commit message here:
https://github.com/libguestfs/libnbd/commit/46072f6611f80245846a445766da071e457b00cd
The patch series is rather long because it detours through adding the
<vector.h> library from nbdkit into libnbd and replacing ad hoc uses
of realloc, char ** etc in various places.
Rich.
2020 Apr 15
0
[PATCH nbdkit 1/9] common: Add a generic implementation of vectors.
...r (i = 0; i < 10; ++i)
+ assert (v.ptr[i] == i);
+ free (v.ptr);
+}
+
+static void
+test_string_vector (void)
+{
+ string_vector v = empty_vector;
+ size_t i;
+
+ for (i = 0; i < 10; ++i) {
+ char *s;
+
+ assert (asprintf (&s, "number %zu", i) >= 0);
+ assert (string_vector_append (&v, s) == 0);
+ }
+ /* NULL-terminate the strings. */
+ assert (string_vector_append (&v, NULL) == 0);
+
+ /* Now print them. */
+ for (i = 0; v.ptr[i] != NULL; ++i)
+ printf ("%s\n", v.ptr[i]);
+ assert (i == 10);
+
+ /* And free them. We can use the generated iter fu...
2020 Jul 14
3
[PATCH nbdkit RFC 0/2] curl: Implement authorization scripts.
This is an RFC only, at the very least it lacks tests.
This implements a rather complex new feature in nbdkit-curl-plugin
allowing you to specify an external shell script that can be used to
fetch an authorization token for services which requires a token or
cookie for access, especially if that token must be renewed
periodically. The motivation can be seen in the changes to the docs
in patch 2.
2020 Jun 02
0
[PATCH nbdkit 5/5] vddk: Munge password parameters when we reexec (RHBZ#1842440).
...ys/types.h>
#define NBDKIT_API_VERSION 2
#include <nbdkit-plugin.h>
@@ -122,7 +123,47 @@ perform_reexec (const char *env, const char *prepend)
/* Split cmdline into argv, then append one more arg. */
for (len = 0; len < buf.size; len += strlen (buf.ptr + len) + 1) {
- if (string_vector_append (&argv, buf.ptr + len) == -1) {
+ char *arg = buf.ptr + len; /* Next \0-terminated argument. */
+
+ /* password parameter requires special handling for reexec. For
+ * password=- and password=-FD, after reexec we might try to
+ * reread these, but stdin has gone away and FD has...
2020 Apr 19
2
[PATCH nbdkit 1/2] vddk: Use new vector library to allocate the argv list.
...NULL;
@@ -301,25 +313,22 @@ perform_reexec (const char *env, const char *prepend)
buflen = len;
len = 0;
while (len < buflen) {
- char **tmp = realloc (argv, sizeof *argv * (argc + 3));
-
- if (!tmp) {
- nbdkit_debug ("failure to parse original argv: %m");
+ if (string_vector_append (&argv, buf + len) == -1) {
+ argv_realloc_fail:
+ nbdkit_debug ("argv: realloc: %m");
return;
}
- argv = tmp;
- argv[argc++] = buf + len;
len += strlen (buf + len) + 1;
}
if (!env)
env = "";
- nbdkit_debug ("original argc == %...
2023 Mar 28
1
[nbdkit PATCH 1/2] common/utils: document empty_vector compound literal assignment
...alizing with ?empty_vector?, or assigning the compound literal
+ * ?(string_vector)empty_vector?, sets ?.ptr = NULL? and ?.len = 0?.
*
* DEFINE_VECTOR_TYPE also defines utility functions. For the full
* list see the definition below, but useful functions include:
*
* ?name?_append (eg. ?string_vector_append?)
* - Append a new element at the end. This operation is cheap.
*
* ?name?_insert (eg. ?string_vector_insert?)
* - Insert a new element at the beginning, middle or end. This
* operation is more expensive because existing elements may need
2023 Mar 19
3
[libnbd PATCH v4 0/2] lib/utils: introduce async-signal-safe execvpe()
This is version 4 of the following sub-series:
[libnbd PATCH v3 09/29] lib/utils: introduce async-signal-safe execvpe()
[libnbd PATCH v3 10/29] lib/utils: add unit tests for async-signal-safe execvpe()
http://mid.mail-archive.com/20230215141158.2426855-10-lersek at redhat.com
http://mid.mail-archive.com/20230215141158.2426855-11-lersek at redhat.com
The Notes section on each patch records the
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
...{
- char **new_dirs;
char *dir;
if (strcmp (key, "dir") == 0) {
@@ -143,15 +140,11 @@ iso_config (const char *key, const char *value)
if (dir == NULL)
return -1;
- new_dirs = realloc (dirs, sizeof (char *) * (nr_dirs + 1));
- if (new_dirs == NULL) {
+ if (string_vector_append (&dirs, dir) == -1) {
nbdkit_error ("realloc: %m");
free (dir);
return -1;
}
- dirs = new_dirs;
- dirs[nr_dirs] = dir;
- nr_dirs++;
}
else if (strcmp (key, "params") == 0) {
params = value;
@@ -170,7 +163,7 @@ iso_config (const c...
2023 Mar 28
3
[nbdkit PATCH 0/2] various
I originally meant to post only the "vector.h" patch, but then
(independently) nbdkit wouldn't build. Hence the other (rust plugin)
patch.
Laszlo
Laszlo Ersek (2):
common/utils: document empty_vector compound literal assignment
plugins/rust: restrict predicates-{tree,core} to {1.0.7,1.0.5}
common/utils/vector.h | 8 +++++++-
plugins/rust/Cargo.toml | 2 ++
2 files changed,
2020 Jul 07
2
[nbdkit PATCH] nbd: Add vsock-cid= transport option
...= "10809";
+ if (nbdkit_parse_uint32_t ("vsock_cid", raw_cid, &cid) == -1 ||
+ nbdkit_parse_uint32_t ("port", port, &vport) == -1)
+ return -1;
+#endif
+ }
else if (command.size > 0) {
/* Add NULL sentinel to the command. */
if (string_vector_append (&command, NULL) == -1) {
@@ -320,7 +349,8 @@ nbdplug_after_fork (void)
"[uri=]<URI> URI of an NBD socket to connect to (if supported).\n" \
"socket=<SOCKNAME> The Unix socket to connect to.\n" \
"hostname=<HOST> The hos...
2023 Mar 23
20
[libnbd PATCH v3 00/19] pass LISTEN_FDNAMES with systemd socket activation
V3 was here:
<http://mid.mail-archive.com/20230215141158.2426855-1-lersek at redhat.com>.
See the Notes section on each patch for the v4 updates.
The series is nearly ready for merging: every patch has at least one R-b
tag, except "socket activation: avoid manipulating the sign bit".
The series builds, and passes "make check" and "make check-valgrind", at