search for: nbdkit_absolute_path

Displaying 20 results from an estimated 99 matches for "nbdkit_absolute_path".

2018 Feb 14
2
[nbdkit PATCH v2] plugin: add and use nbdkit_realpath
Introduce a new helper function to resolve a path name, calling nbdkit_error on failure: other than doing what nbdkit_absolute_path does, it also checks that the file exists (and thus avoids errors later on). To help distinguish it from nbdkit_absolute_path, improve the documentation of the latter. Apply it where an existing path is required, both in nbdkit itself and in plugins. Related to: https://bugzilla.redhat.com/show_...
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 | 1 + plugins/exam...
2018 Feb 21
2
Re: [nbdkit PATCH v2] plugin: add and use nbdkit_realpath
On Wednesday, 14 February 2018 18:06:10 CET Eric Blake wrote: > On 02/14/2018 10:53 AM, Pino Toscano wrote: > > Introduce a new helper function to resolve a path name, calling > > nbdkit_error on failure: other than doing what nbdkit_absolute_path > > does, it also checks that the file exists (and thus avoids errors later > > on). To help distinguish it from nbdkit_absolute_path, improve the > > documentation of the latter. > > > > Apply it where an existing path is required, both in nbdkit itself and > &gt...
2018 Feb 13
3
[nbdkit PATCH] plugin: add and use nbdkit_realpath
Introduce a new helper function to resolve a path name, calling nbdkit_error on failure: other than doing what nbdkit_absolute_path does, it also checks that the file exist (and thus avoid errors later on). Apply it where an existing path is required, both in nbdkit itself and in plugins. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1527334 --- docs/nbdkit-plugin.pod | 13 +++++++++++++ include/nbdkit-common....
2018 Apr 12
0
[nbdkit PATCH v3 1/2] docs: improve documentation of nbdkit_absolute_path
...scano@redhat.com> --- docs/nbdkit-plugin.pod | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod index 65f3190..27a885e 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -273,7 +273,12 @@ descriptor. char *nbdkit_absolute_path (const char *filename); The utility function C<nbdkit_absolute_path> converts any path to an -absolute path. +absolute path: if it is relative, then all this function does is +prepending the current working directory to the path, with no extra +checks. + +Note that this function works I&lt...
2019 Apr 01
0
[PATCH nbdkit] error: Fix all error-*-file parameters.
...1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/filters/error/error.c b/filters/error/error.c index bf7b442..0f84f12 100644 --- a/filters/error/error.c +++ b/filters/error/error.c @@ -213,27 +213,27 @@ error_config (nbdkit_next_config *next, void *nxdata, extents_settings.file = nbdkit_absolute_path (value); return 0; } - else if (strcmp (key, "error-pread-rate") == 0) { + else if (strcmp (key, "error-pread-file") == 0) { free (pread_settings.file); pread_settings.file = nbdkit_absolute_path (value); return 0; } - else if (strcmp (key, "err...
2019 Mar 26
0
[PATCH nbdkit v4 07/15] error: Extend the error filter so it can inject errors into block status extents requests.
...tings.rate); else if (strcmp (key, "error-zero-rate") == 0) return parse_error_rate (key, value, &zero_settings.rate); + else if (strcmp (key, "error-extents-rate") == 0) + return parse_error_rate (key, value, &extents_settings.rate); /* NB: We are using nbdkit_absolute_path here because the trigger * file probably doesn't exist yet. @@ -202,6 +210,8 @@ error_config (nbdkit_next_config *next, void *nxdata, trim_settings.file = nbdkit_absolute_path (value); free (zero_settings.file); zero_settings.file = nbdkit_absolute_path (value); + free (ex...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 08/19] error: Extend the error filter so it can inject errors into block status extents requests.
...tings.rate); else if (strcmp (key, "error-zero-rate") == 0) return parse_error_rate (key, value, &zero_settings.rate); + else if (strcmp (key, "error-extents-rate") == 0) + return parse_error_rate (key, value, &extents_settings.rate); /* NB: We are using nbdkit_absolute_path here because the trigger * file probably doesn't exist yet. @@ -202,6 +210,8 @@ error_config (nbdkit_next_config *next, void *nxdata, trim_settings.file = nbdkit_absolute_path (value); free (zero_settings.file); zero_settings.file = nbdkit_absolute_path (value); + free (ex...
2018 Feb 14
0
Re: [nbdkit PATCH v2] plugin: add and use nbdkit_realpath
On 02/14/2018 10:53 AM, Pino Toscano wrote: > Introduce a new helper function to resolve a path name, calling > nbdkit_error on failure: other than doing what nbdkit_absolute_path > does, it also checks that the file exists (and thus avoids errors later > on). To help distinguish it from nbdkit_absolute_path, improve the > documentation of the latter. > > Apply it where an existing path is required, both in nbdkit itself and > in plugins. > > Relat...
2018 Feb 21
0
Re: [nbdkit PATCH v2] plugin: add and use nbdkit_realpath
...n 02/21/2018 11:13 AM, Pino Toscano wrote: > On Wednesday, 14 February 2018 18:06:10 CET Eric Blake wrote: >> On 02/14/2018 10:53 AM, Pino Toscano wrote: >>> Introduce a new helper function to resolve a path name, calling >>> nbdkit_error on failure: other than doing what nbdkit_absolute_path >>> does, it also checks that the file exists (and thus avoids errors later >>> on). To help distinguish it from nbdkit_absolute_path, improve the >>> documentation of the latter. >>> >>> Apply it where an existing path is required, both in nbdkit itsel...
2017 Nov 21
1
[nbdkit PATCH] file: Diagnose a missing file earlier
...ile.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) nbdkit_error ("you must supply the file=<FILENAME> parameter after the plugin name on the command line"); return -1; } + if (access (filename, F_OK) < 0) { + nbdkit_er...
2019 Feb 07
1
[PATCH nbdkit] server: utils: Fix nbdkit_parse_size to correctly handle negative values
...024 * 1024 * 8191 }, { "1e", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 }, { "1E", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 }, }; diff --git a/server/utils.c b/server/utils.c index 18011fd..d711b88 100644 --- a/server/utils.c +++ b/server/utils.c @@ -88,21 +88,30 @@ nbdkit_absolute_path (const char *path) int64_t nbdkit_parse_size (const char *str) { - uint64_t size; + int64_t size; char *end; uint64_t scale = 1; - /* Disk sizes cannot usefully exceed off_t (which is signed), so - * scan unsigned, then range check later that result fits. */ + /* Disk sizes cannot...
2020 Sep 01
1
Re: [nbdkit PATCH v2 4/8] api: Add nbdkit_str[n]dup_intern helper
...gt; though the client is directing allocation, the actual call to malloc() > is done by nbdkit proper, so that nbdkit later calling free() does not > tie the plugin's hands, and nbdkit could change its underlying > allocation without breaking ABI. (Note that nbdkit_realpath() and > nbdkit_absolute_path() require the caller to use free(), but as they > are used during .config, it's less of a burden for plugins to take > care of that in .unload.) > > We could document that the burden is on the plugin to avoid the memory > leak, by making sh track all strings it returns, then fin...
2020 Aug 18
0
[PATCH nbdkit 8/9] include: Prefix all exports with NBDKIT_DLLEXPORT.
...INTF (1, 2); -extern void nbdkit_vdebug (const char *msg, va_list args) +extern NBDKIT_DLLEXPORT void nbdkit_debug (const char *msg, ...) + ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern NBDKIT_DLLEXPORT void nbdkit_vdebug (const char *msg, va_list args) ATTRIBUTE_FORMAT_PRINTF (1, 0); -extern char *nbdkit_absolute_path (const char *path); -extern int64_t nbdkit_parse_size (const char *str); -extern int nbdkit_parse_bool (const char *str); -extern int nbdkit_parse_int (const char *what, const char *str, - int *r); -extern int nbdkit_parse_unsigned (const char *what, const char *str, -...
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
...ack (int priority, const char *function, const char *message, void *vp) static void ssh_unload (void) { - free (identity); + free (identities.ptr); free (password); } @@ -133,16 +135,11 @@ ssh_config (const char *key, const char *value) known_hosts = value; /* %-expanded, cannot use nbdkit_absolute_path */ else if (strcmp (key, "identity") == 0) { - const char **new_identity = - realloc (identity, (nr_identities+1) * sizeof (const char *)); - if (new_identity == NULL) { + /* %-expanded, cannot use nbdkit_absolute_path on value */ + if (const_string_vector_append (&a...
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.
2018 Feb 02
0
[RFC nbdkit PATCH] utils: Revamp nbdkit_parse_size
...c/utils.c index 5663043..6e04bc8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,5 +1,5 @@ /* nbdkit - * Copyright (C) 2013 Red Hat Inc. + * Copyright (C) 2013-2018 Red Hat Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,49 +80,78 @@ nbdkit_absolute_path (const char *path) return ret; } -/* XXX Multiple problems with this function. Really we should use the - * 'human*' functions from gnulib. +/* Parse a string with possible scaling suffix, or return -1 after reporting + * the error. */ int64_t nbdkit_parse_size (const char *str)...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...want to export some symbols to plugins, but at -# the same time we don't want plugins to be able to call arbitrary -# functions from nbdkit, so this script lists only the symbols we want -# to export. +# nbdkit binary. { - # The functions we want plugins and filters to call. global: - nbdkit_absolute_path; - nbdkit_add_extent; nbdkit_debug; nbdkit_error; nbdkit_export_name; - nbdkit_extents_count; - nbdkit_extents_free; - nbdkit_extents_new; - nbdkit_get_extent; nbdkit_nanosleep; - nbdkit_parse_bool; - nbdkit_parse_int8_t; - nbdkit_parse_int16_t; - nbdk...
2018 Feb 07
3
[nbdkit PATCH v2 0/2] Improve nbdkit_parse_size
Take two, this time split into two patches. I liked Rich's suggestion of unit-testing src/ files directly in src/, and automake is a lot happier with this than with my v1 attempt that tried to compile .c files across directories. It's still enough of a change that I'm not pushing it right away. Eric Blake (2): build: Add unit-testing of internal files utils: Revamp
2018 Feb 14
0
Re: [nbdkit PATCH] plugin: add and use nbdkit_realpath
On 02/13/2018 09:44 AM, Pino Toscano wrote: > Introduce a new helper function to resolve a path name, calling > nbdkit_error on failure: other than doing what nbdkit_absolute_path > does, it also checks that the file exist (and thus avoid errors later s/exist/exists/ s/avoid/avoids/ > on). > > Apply it where an existing path is required, both in nbdkit itself and > in plugins. > > Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1527334 > -...