search for: string_vector

Displaying 20 results from an estimated 41 matches for "string_vector".

2023 Mar 28
1
[nbdkit PATCH 1/2] common/utils: document empty_vector compound literal assignment
We usually zero-initialize vectors like string_vector names = empty_vector; Allocating and zeroing separately is frequently useful however. Document the pattern string_vector names; names = (string_vector)empty_vector; where "(string_vector)empty_vector" is a compound literal. Link: http://mid.mail-archive.com/20230221183810.vjilfbmj...
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,
2023 Jan 30
2
[PATCH libnbd v2 4/4] generator/states-connect-socket-activation.c: Set LISTEN_FDNAMES
..., and + * replaces them with new variables. + * + * env[0] is "LISTEN_PID=..." which is filled in by CONNECT_SA.START + * + * env[1] is "LISTEN_FDS=1" + * + * env[2] (if used) is "LISTEN_FDNAMES=" + h->sa_name */ static int -prepare_socket_activation_environment (string_vector *env) +prepare_socket_activation_environment (struct nbd_handle *h, + string_vector *env) { char *p; size_t i; + const bool using_name = h->sa_name != NULL; assert (env->len == 0); - /* Reserve slots env[0]..env[1] */ - if (string_vector_...
2023 Feb 15
1
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
On Wed, Feb 15, 2023 at 03:11:34PM +0100, Laszlo Ersek wrote: > The "name##_iter" function is used 11 times in libnbd; in all those cases, > "name" is "string_vector", and the "f" callback is "free": > > string_vector_iter (..., (void *) free); > > Casting "free" to (void*) is ugly. (Well-defined by POSIX, but still.) Tangentially related: casting function pointers in general may get harder as more compilers m...
2020 Jun 02
0
[PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
...BRARY_PATH on reexec */ +/* Extensible buffer (string). */ +DEFINE_VECTOR_TYPE(buffer, char); + +#define CLEANUP_FREE_BUFFER \ + __attribute__((cleanup (cleanup_free_buffer))) + +static void +cleanup_free_buffer (buffer *v) +{ + free (v->ptr); +} + +/* List of strings. */ DEFINE_VECTOR_TYPE(string_vector, char *); #define CLEANUP_FREE_STRING_VECTOR \ @@ -68,11 +81,13 @@ cleanup_free_string_vector (string_vector *v) static void perform_reexec (const char *env, const char *prepend) { + static const char cmdline_file[] = "/proc/self/cmdline"; + static const char exe_file[] = "/p...
2023 Jan 28
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...N_FDS or LISTEN_FDNAMES, and replaces + * them with new variables. + * + * env[0] is "LISTEN_PID=..." which is filled in by CONNECT_SA.START + * + * env[1] is "LISTEN_FDS=1" + * + * env[2] is "LISTEN_FDNAMES=nbd" */ static int prepare_socket_activation_environment (string_vector *env) @@ -53,26 +55,29 @@ prepare_socket_activation_environment (string_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=xxxxxxxx...
2020 Jun 02
0
[PATCH nbdkit 2/5] vddk: Move reexec code to a new file.
...<unistd.h> +#include <fcntl.h> + +#define NBDKIT_API_VERSION 2 +#include <nbdkit-plugin.h> + +#include "cleanup.h" +#include "vector.h" + +#include "vddk.h" + +char *reexeced; /* orig LD_LIBRARY_PATH on reexec */ + +DEFINE_VECTOR_TYPE(string_vector, char *); + +#define CLEANUP_FREE_STRING_VECTOR \ + __attribute__((cleanup (cleanup_free_string_vector))) + +static void +cleanup_free_string_vector (string_vector *v) +{ + string_vector_iter (v, (void *) free); + free (v->ptr); +} + +/* Perform a re-exec that temporarily modifies LD_LIBRARY_...
2023 Feb 22
2
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
...o Ersek wrote: > >> On 2/15/23 21:27, Eric Blake wrote: > >>> On Wed, Feb 15, 2023 at 03:11:34PM +0100, Laszlo Ersek wrote: > >>>> The "name##_iter" function is used 11 times in libnbd; in all those cases, > >>>> "name" is "string_vector", and the "f" callback is "free": > >>>> > >>>> string_vector_iter (..., (void *) free); > >>>> > >>>> Casting "free" to (void*) is ugly. (Well-defined by POSIX, but still.) > >>> > >&...
2023 Jan 31
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...m with new variables. > + * > + * env[0] is "LISTEN_PID=..." which is filled in by CONNECT_SA.START > + * > + * env[1] is "LISTEN_FDS=1" > + * > + * env[2] is "LISTEN_FDNAMES=nbd" > */ > static int > prepare_socket_activation_environment (string_vector *env) > @@ -53,26 +55,29 @@ prepare_socket_activation_environment (string_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; >...
2020 Aug 25
0
[nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...struct nbdkit_extents; NBDKIT_EXTERN_DECL (int, nbdkit_add_extent, diff --git a/server/internal.h b/server/internal.h index 8c8448e6..9993d92a 100644 --- a/server/internal.h +++ b/server/internal.h @@ -237,6 +237,7 @@ reset_handle (struct handle *h) h->can_cache = -1; } +DEFINE_VECTOR_TYPE(string_vector, char *); struct connection { pthread_mutex_t request_lock; pthread_mutex_t read_lock; @@ -258,8 +259,9 @@ struct connection { bool structured_replies; bool meta_context_base_allocation; + string_vector interns; char *exportname_from_set_meta_context; - char *exportname; + const...
2020 Aug 27
0
[nbdkit PATCH v2 4/8] api: Add nbdkit_str[n]dup_intern helper
...struct nbdkit_extents; NBDKIT_EXTERN_DECL (int, nbdkit_add_extent, diff --git a/server/internal.h b/server/internal.h index e2a68513..f11f897e 100644 --- a/server/internal.h +++ b/server/internal.h @@ -237,6 +237,7 @@ reset_handle (struct handle *h) h->can_cache = -1; } +DEFINE_VECTOR_TYPE(string_vector, char *); struct connection { pthread_mutex_t request_lock; pthread_mutex_t read_lock; @@ -258,8 +259,9 @@ struct connection { bool structured_replies; bool meta_context_base_allocation; + string_vector interns; char *exportname_from_set_meta_context; - char *exportname; + const...
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
These plugins have in common that they store either a list of allocated strings or a list of constant strings. Define either string_vector or const_string_vector as appropriate and use it to store these lists. --- plugins/iso/Makefile.am | 1 + plugins/split/Makefile.am | 1 + plugins/floppy/virtual-floppy.h | 7 +++-- plugins/floppy/directory-lfn.c | 35 +++++++++------------- plugins/floppy/virtual-floppy.c | 11 +...
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
1
Re: [PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
On 4/15/20 11:16 AM, Richard W.M. Jones wrote: > These plugins have in common that they store either a list of > allocated strings or a list of constant strings. Define either > string_vector or const_string_vector as appropriate and use it to > store these lists. > --- The commit message mentions strings... > +++ b/plugins/floppy/virtual-floppy.h > @@ -37,6 +37,7 @@ > #include <sys/stat.h> > > #include "regions.h" > +#include "vect...
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
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 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
2023 Jan 31
1
[PATCH libnbd] generator: Pass LISTEN_FDNAMES=nbd with systemd socket activation
...+ * env[0] is "LISTEN_PID=..." which is filled in by CONNECT_SA.START > > + * > > + * env[1] is "LISTEN_FDS=1" > > + * > > + * env[2] is "LISTEN_FDNAMES=nbd" > > */ > > static int > > prepare_socket_activation_environment (string_vector *env) > > @@ -53,26 +55,29 @@ prepare_socket_activation_environment (string_vector *env) > > > > assert (env->len == 0); > > > > - /* Reserve slots env[0] and env[1]. */ > > + /* Reserve slots env[0]..env[2] */ > > + if (string_vector_reserve (env,...
2023 Mar 23
1
[libnbd PATCH v3 07/19] socket activation: replace execvp() call with fork-safe variant
...-git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c index 752ee73bb62f..a214ffd5a6e4 100644 --- a/generator/states-connect-socket-activation.c +++ b/generator/states-connect-socket-activation.c @@ -94,22 +94,23 @@ prepare_socket_activation_environment (string_vector *env) string_vector_empty (env); return -1; } STATE_MACHINE { CONNECT_SA.START: enum state next; char *tmpdir; char *sockpath; int s; struct sockaddr_un addr; + struct execvpe execvpe_ctx; string_vector env; pid_t pid; assert (!h->sock); assert (h->ar...
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.