search for: magic_config_key

Displaying 20 results from an estimated 128 matches for "magic_config_key".

2018 Sep 07
7
[PATCH nbdkit 0/6] plugins: Implement magic config key.
Remove the need to use file= (and in future other) parameters for many plugins. eg. Using the file plugin becomes: nbdkit file disk.img Rich.
2018 Sep 08
8
[PATCH nbdkit v2 0/6] plugins: Implement magic config key.
v1 was here: https://www.redhat.com/archives/libguestfs/2018-September/msg00024.html v2: - As discussed in the patch review, tighten up the characters permitted in keys. - Update documentation to note that relative paths can be made safe by prefixing with ./ and absolute paths do not need any extra steps. - I pushed patch 1/6 from the v1 series since it was just a trivial
2018 Sep 10
7
[PATCH nbdkit v3 0/6] plugins: Implement magic config key.
v1: https://www.redhat.com/archives/libguestfs/2018-September/msg00024.html v2: https://www.redhat.com/archives/libguestfs/2018-September/msg00034.html v3: - Fixed is_config_key zero length test. - Fixed is_config_key so it uses strspn and is not O(n^2). - Changed >= 1.7 to >= 1.8 in the documentation. Rich.
2020 Feb 18
4
[PATCH nbdkit 2/2] server: Avoid modifying argv by saving keys in a list and freeing on exit.
Unfortunately you cannot restore argv by setting *p = '=' :-( The reason is we advertize that plugins are allowed to save they ‘const char *key’ pointer passed to them in .config, but assigning *p = '=' changes the key string from "key" back to "key=value". Surprisingly only test-eval.sh actually broke, but other plugins are undoubtedly affected. My alternate
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...*thread_model) (void); int (*can_fast_zero) (void *handle); + + int (*ready_to_serve) (void); }; extern void nbdkit_set_error (int err); diff --git a/server/filters.c b/server/filters.c index 1ac4a5f..ed00d11 100644 --- a/server/filters.c +++ b/server/filters.c @@ -190,6 +190,29 @@ plugin_magic_config_key (struct backend *b) return b->next->magic_config_key (b->next); } +static int +next_ready_to_serve (void *nxdata) +{ + struct backend *b = nxdata; + b->ready_to_serve (b); + return 0; +} + +static void +filter_ready_to_serve (struct backend *b) +{ + struct backend_filter *f =...
2020 Feb 25
6
[PATCH nbdkit 0/5] server: Add .get_ready callback.
I like this change. I think we were overloading the config_complete method before to do two different things (complete configuration; do any allocation/housekeeping necessary before we can start serving). The only questions in my mind are whether we want this before 1.18, and whether the name ("get_ready") is a good one. Rich.
2019 Aug 16
0
[nbdkit PATCH 1/2] rust: Implement can_cache
...lt;extents> + +These are not yet supported. + +=back + =head1 SEE ALSO L<nbdkit(1)>, diff --git a/plugins/rust/src/lib.rs b/plugins/rust/src/lib.rs index a3dbf43e..25af2fe6 100644 --- a/plugins/rust/src/lib.rs +++ b/plugins/rust/src/lib.rs @@ -93,6 +93,15 @@ pub struct Plugin { pub magic_config_key: *const c_char, pub can_multi_conn: Option<extern fn (h: *mut c_void) -> c_int>, + + // Slots for extents functions, which needs more integration. + _can_extents: Option<extern fn ()>, + _extents: Option<extern fn ()>, + + pub can_cache: Option<extern fn (h...
2020 Feb 12
5
[PATCH nbdkit 1/3] server: Rename global backend pointer to "top".
...ot;\n"); } - backend->free (backend); + top->free (top); exit (EXIT_SUCCESS); } @@ -615,16 +615,16 @@ main (int argc, char *argv[]) * first parameter is bare it is prefixed with the key "script", and * any other bare parameters are errors. */ - magic_config_key = backend->magic_config_key (backend); + magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { p = strchr (argv[optind], '='); if (p && is_config_key (argv[optind], p - argv[optind])) { /* key=value */ *p = '\0&...
2019 Jan 05
0
[PATCH nbdkit v2 06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
...rves the same data over multiple connections. */ +static int +floppy_can_multi_conn (void *handle) +{ + return 1; +} + /* Read data from the file. */ static int floppy_pread (void *handle, void *buf, uint32_t count, uint64_t offset) @@ -192,6 +199,7 @@ static struct nbdkit_plugin plugin = { .magic_config_key = "dir", .open = floppy_open, .get_size = floppy_get_size, + .can_multi_conn = floppy_can_multi_conn, .pread = floppy_pread, .errno_is_preserved = 1, }; diff --git a/plugins/iso/iso.c b/plugins/iso/iso.c index 7ed5e7a..7431b48 100644 ---...
2018 Sep 08
0
[PATCH nbdkit v2 2/6] main: Tighten up characters permitted in config keys.
...tic gid_t parsegroup (const char *); static unsigned int get_socket_activation (void); +static int is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ int exit_with_parent; /* --exit-with-parent */ @@ -694,7 +695,7 @@ main (int argc, char *argv[]) magic_config_key = backend->magic_config_key (backend); for (i = 0; optind < argc; ++i, ++optind) { p = strchr (argv[optind], '='); - if (p) { /* key=value */ + if (p && is_config_key (argv[optind], p - argv[optind])) { /* key=value */ *p = '\0';...
2018 Sep 10
0
[PATCH nbdkit v3 2/6] main: Tighten up characters permitted in config keys.
...tic gid_t parsegroup (const char *); static unsigned int get_socket_activation (void); +static int is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ int exit_with_parent; /* --exit-with-parent */ @@ -694,7 +695,7 @@ main (int argc, char *argv[]) magic_config_key = backend->magic_config_key (backend); for (i = 0; optind < argc; ++i, ++optind) { p = strchr (argv[optind], '='); - if (p) { /* key=value */ + if (p && is_config_key (argv[optind], p - argv[optind])) { /* key=value */ *p = '\0';...
2020 Feb 13
2
[nbdkit PATCH] vddk: Make 'file=' a magic key
...erve.\n" \ "Many optional parameters are supported, see nbdkit-vddk-plugin(3)." static void @@ -901,6 +901,7 @@ static struct nbdkit_plugin plugin = { .config = vddk_config, .config_complete = vddk_config_complete, .config_help = vddk_config_help, + .magic_config_key = "file", .dump_plugin = vddk_dump_plugin, .open = vddk_open, .close = vddk_close, diff --git a/tests/test-vddk.sh b/tests/test-vddk.sh index d99ebf88..6933f716 100755 --- a/tests/test-vddk.sh +++ b/tests/test-vddk.sh @@ -48,8 +48,7 @@ grep ^vddk_d...
2019 Aug 16
7
[nbdkit PATCH 0/2] rust: Implement some missing v2 callbacks
Similar to what I just did for OCaml (this IS an API break, requiring recompilation of any existing Rust plugin), and done because I want to add fast_zero support to both languages as part of my upcoming fast zero series. Figuring out how to get extents working was hard enough that I punted that, still. Eric Blake (2): rust: Implement can_cache rust: Add support for dynamic .thread_model
2020 Feb 22
2
Re: Plans for nbdkit 1.18 release?
Eric: Did you want to take this one any further? It might be one that we save for > 1.18: https://www.redhat.com/archives/libguestfs/2020-February/thread.html#00206 Another thing I've been thinking about for some time is splitting .config_complete into .config_complete + .get_ready (new name TBD). At the moment .config_complete is both the place where we finish processing config, and
2020 Feb 22
1
Re: Plans for nbdkit 1.18 release?
...-git a/server/internal.h b/server/internal.h index eaec31ba..d8a589f2 100644 --- a/server/internal.h +++ b/server/internal.h @@ -344,6 +344,7 @@ struct backend { void (*config) (struct backend *, const char *key, const char *value); void (*config_complete) (struct backend *); const char *(*magic_config_key) (struct backend *); + void (*get_ready) (struct backend *); int (*preconnect) (struct backend *, int readonly); void *(*open) (struct backend *, int readonly); int (*prepare) (struct backend *, void *handle, int readonly); diff --git a/server/filters.c b/server/filters.c index 8985ebeb.....
2020 Aug 25
0
[nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...d of main(). + * need to create a key from argv[i] = "key=value" we must intern + * the keys, which are then freed at the end of main(). */ - char **keys = calloc (argc, sizeof (char *)); - if (keys == NULL) { - perror ("calloc"); - exit (EXIT_FAILURE); - } - magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { size_t n; @@ -647,12 +641,11 @@ main (int argc, char *argv[]) p = strchr (argv[optind], '='); n = p - argv[optind]; if (p && is_config_key (argv[optind], n)) { /* Is it key=value?...
2020 Aug 27
0
[nbdkit PATCH v2 4/8] api: Add nbdkit_str[n]dup_intern helper
...d of main(). + * need to create a key from argv[i] = "key=value" we must intern + * the keys, which are then freed at the end of main(). */ - char **keys = calloc (argc, sizeof (char *)); - if (keys == NULL) { - perror ("calloc"); - exit (EXIT_FAILURE); - } - magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { size_t n; @@ -647,12 +641,10 @@ main (int argc, char *argv[]) p = strchr (argv[optind], '='); n = p - argv[optind]; if (p && is_config_key (argv[optind], n)) { /* Is it key=value?...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...nt, and nbdkit also may not need this list. This may have performance benefits, and may make the code nicer. > + > =back > > =head2 Missing callbacks > @@ -382,9 +397,7 @@ C<version>, > C<longname>, > C<description>, > C<config_help>, > -C<magic_config_key>, > -C<can_extents>, > -C<extents>. > +C<magic_config_key>. > > These are not yet supported. > > diff --git a/plugins/python/python.c b/plugins/python/python.c > index 398473f5..585cd9e6 100644 > --- a/plugins/python/python.c > +++ b/plugins/pytho...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...def extents(h, count, offset, flags): + # return a list of (offset, length, type) tuples: + return [ (off1, len1, type1), (off2, len2, type2), ... ] + =back =head2 Missing callbacks @@ -382,9 +397,7 @@ C<version>, C<longname>, C<description>, C<config_help>, -C<magic_config_key>, -C<can_extents>, -C<extents>. +C<magic_config_key>. These are not yet supported. diff --git a/plugins/python/python.c b/plugins/python/python.c index 398473f5..585cd9e6 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -1020,6 +1020,79 @@ py_can_cache...
2019 Oct 11
3
[PATCH NOT WORKING nbdkit v2 0/2] vddk: Restructure plugin to allow greater parallelism.
This is my second attempt at this. The first version (also not working) was here: https://www.redhat.com/archives/libguestfs/2019-October/msg00062.html In part 1/2 I introduce a new .ready_to_serve plugin method which is called after forking and just before accepting any client connection. The idea would be that plugins could start background threads here. However this doesn't work well in