search for: file_config

Displaying 20 results from an estimated 25 matches for "file_config".

2020 Aug 25
0
[RFC nbdkit PATCH 4/5] file: Utilize nbdkit_string_intern
...|| err == EOPNOTSUPP; } -static void -file_unload (void) -{ - free (filename); - free (directory); -} - /* Called for each key=value passed on the command line. This plugin * only accepts file=<filename> and dir=<dirname>, where exactly * one is required. @@ -111,15 +104,15 @@ file_config (const char *key, const char *value) * existence checks to the last possible moment. */ if (strcmp (key, "file") == 0) { - free (filename); - filename = nbdkit_realpath (value); + CLEANUP_FREE char *tmp = nbdkit_realpath (value); + filename = nbdkit_string_intern (t...
2017 Nov 21
1
[nbdkit PATCH] file: Diagnose a missing file earlier
...ment more than once. Signed-off-by: Eric Blake <eblake@redhat.com> --- plugins/file/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/file/file.c b/plugins/file/file.c index ef5da3d..4a91251 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -117,6 +117,7 @@ file_config (const char *key, const char *value) { if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ + free (filename); filename = nbdkit_absolute_path (value); if (!filename) return -1; @@ -147,6 +148,10 @@ file_config_complete (void)...
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...rectory); + if (dir) + closedir (dir); } /* Called for each key=value passed on the command line. This plugin - * only accepts file=<filename>, which is required. + * only accepts file=<filename> and directory=<dirname>, where exactly + * one is required. */ static int file_config (const char *key, const char *value) @@ -98,6 +105,12 @@ file_config (const char *key, const char *value) if (!filename) return -1; } + else if (strcmp (key, "directory") == 0) { + free (directory); + directory = nbdkit_realpath (value); + if (!directory) + r...
2020 Aug 07
2
[PATCH nbdkit] plugins: file: More standard cache mode names
...enum { cache_default, cache_none } cache_mode = cache_default; +static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback; /* Any callbacks using lseek must be protected by this lock. */ static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER; @@ -140,10 +140,10 @@ file_config (const char *key, const char *value) } } else if (strcmp (key, "cache") == 0) { - if (strcmp (value, "default") == 0) - cache_mode = cache_default; - else if (strcmp (value, "none") == 0) - cache_mode = cache_none; + if (strcmp (value, &qu...
2020 Aug 08
0
Re: [PATCH nbdkit] plugins: file: More standard cache mode names
...che_none } cache_mode = cache_default; > +static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback; > > /* Any callbacks using lseek must be protected by this lock. */ > static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER; > @@ -140,10 +140,10 @@ file_config (const char *key, const char *value) > } > } > else if (strcmp (key, "cache") == 0) { > - if (strcmp (value, "default") == 0) > - cache_mode = cache_default; > - else if (strcmp (value, "none") == 0) > - cache_mode = cach...
2018 Apr 12
4
[nbdkit PATCH v3 0/2] Add nbdkit_realpath
Hi, this is the v3 of my series for nbdkit_realpath; this series adds an extra documentation update to nbdkit_absolute_path, documenting when it can only be used, and then adds nbdkit_realpath. Thanks, Pino Toscano (2): docs: improve documentation of nbdkit_absolute_path plugin: add and use nbdkit_realpath docs/nbdkit-plugin.pod | 24 +++++++++++++++++++++++- include/nbdkit-common.h
2018 Feb 14
2
[nbdkit PATCH v2] plugin: add and use nbdkit_realpath
...-plugin(3). */ - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } diff --git a/plugins/file/file.c b/plugins/file/file.c index f8cb3d3..b6e33de 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -65,7 +65,7 @@ file_config (const char *key, const char *value) if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ free (filename); - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } @@ -90,1...
2018 Feb 13
3
[nbdkit PATCH] plugin: add and use nbdkit_realpath
...-plugin(3). */ - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } diff --git a/plugins/file/file.c b/plugins/file/file.c index f8cb3d3..b6e33de 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -65,7 +65,7 @@ file_config (const char *key, const char *value) if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ free (filename); - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } @@ -90,1...
2020 Aug 25
9
[nbdkit PATCH 0/5] Implement .default_export, nbdkit_string_intern
More patches on the way for improving .list_exports signature and adding .export_description, but this is the promised code showing why nbdkit_string_intern is useful. Patch 4 is somewhat RFC: we could either add new API to take the boilerplate from: foo_config(const char *key, const char *value) { if (strcmp (key, "file") == 0) { CLEANUP_FREE char *tmp = nbdkit_realpath (value);
2020 Aug 08
1
Re: [PATCH nbdkit] plugins: file: More standard cache mode names
...cache_default; > > +static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback; > > > > /* Any callbacks using lseek must be protected by this lock. */ > > static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER; > > @@ -140,10 +140,10 @@ file_config (const char *key, const char *value) > > } > > } > > else if (strcmp (key, "cache") == 0) { > > - if (strcmp (value, "default") == 0) > > - cache_mode = cache_default; > > - else if (strcmp (value, "none") == 0)...
2019 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting history of this in libvirt -- try looking at commit eefb881 plus the commits referencing eefb881 -- but it does seem to work for me using recent GCC and Clang. I only did a few functions because annotating them gets old quickly... Rich.
2020 Aug 07
8
[nbdkit PATCH 0/4] More .list_exports uses
Here's changes to the file plugin (which I'm happy with) and a new exportname filter (which is still at RFC stage; I need to finish implementing strict mode in .open, and add tests). I also discovered that we really want .list_exports and .open to know when they are used on plaintext vs. tls clients for --tls=on, and we may want to split out a new .default_export callback rather than
2018 Jan 17
0
[PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.
...ts, NULL); - } -} - -static void -read_delay (void) -{ - delay (rdelayms); -} - -static void -write_delay (void) -{ - delay (wdelayms); -} - /* Called for each key=value passed on the command line. This plugin * only accepts file=<filename>, which is required. */ @@ -122,15 +69,10 @@ file_config (const char *key, const char *value) if (!filename) return -1; } - else if (strcmp (key, "rdelay") == 0) { - rdelayms = parse_delay (value); - if (rdelayms == -1) - return -1; - } - else if (strcmp (key, "wdelay") == 0) { - wdelayms = parse_delay...
2020 Aug 07
3
[PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.
..._NORMAL) + POSIX_FADV_NORMAL +#else + -1 +#endif + ; + +/* cache mode */ +static enum { cache_default, cache_none } cache_mode = cache_default; + /* Any callbacks using lseek must be protected by this lock. */ static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER; @@ -97,6 +109,46 @@ file_config (const char *key, const char *value) if (!filename) return -1; } + else if (strcmp (key, "fadvise") == 0) { + /* As this is a hint, if the kernel doesn't support the feature + * ignore the parameter. + */ + if (strcmp (value, "normal") == 0) { +...
2018 Sep 07
0
[PATCH nbdkit 3/6] file: Make the file= parameter into a magic config key.
...on=1 + nbdkit --filter=partition file disk.img partition=1 =head1 SEE ALSO diff --git a/plugins/file/file.c b/plugins/file/file.c index e7cbff6..9d03f18 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -476,6 +476,7 @@ static struct nbdkit_plugin plugin = { .config = file_config, .config_complete = file_config_complete, .config_help = file_config_help, + .magic_config_key = "file", .dump_plugin = file_dump_plugin, .open = file_open, .close = file_close, diff --git a/plugins/file/nbdkit-file-plugin.pod b/plug...
2018 Sep 08
0
[PATCH nbdkit v2 3/6] file: Make the file= parameter into a magic config key.
...on=1 + nbdkit --filter=partition file disk.img partition=1 =head1 SEE ALSO diff --git a/plugins/file/file.c b/plugins/file/file.c index e7cbff6..9d03f18 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -476,6 +476,7 @@ static struct nbdkit_plugin plugin = { .config = file_config, .config_complete = file_config_complete, .config_help = file_config_help, + .magic_config_key = "file", .dump_plugin = file_dump_plugin, .open = file_open, .close = file_close, diff --git a/plugins/file/nbdkit-file-plugin.pod b/plug...
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.
2018 Jan 14
10
[PATCH nbdkit INCOMPLETE 0/6] Introduce filters to nbdkit.
This patch isn't complete (patch 6/6 isn't finished) so it's just for discussion, although it does compile and run. This introduces to nbdkit a concept of "filters" which can be placed in front of plugins to modify their behaviour. Some examples where you might use filters: * Serve a subset of the data, such as (offset, range) or a single partition from a disk image.