Re: [Libguestfs] [nbdkit PATCH] plugin: add and use nbdkit_realpath

2018-02-14 Thread Richard W.M. Jones
On Tue, Feb 13, 2018 at 04:44:02PM +0100, 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
> 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.h |  1 +
>  plugins/example2/example2.c |  2 +-
>  plugins/file/file.c |  6 +-
>  plugins/gzip/gzip.c |  2 +-
>  plugins/nbd/nbd.c   |  2 +-
>  plugins/split/split.c   |  2 +-
>  plugins/vddk/vddk.c |  2 +-
>  plugins/xz/xz.c |  2 +-
>  src/plugins.c   |  2 +-
>  src/utils.c | 19 +++
>  11 files changed, 41 insertions(+), 12 deletions(-)
> 
> diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod
> index 44822fc..4576635 100644
> --- a/docs/nbdkit-plugin.pod
> +++ b/docs/nbdkit-plugin.pod
> @@ -207,6 +207,19 @@ C.  Note that this function does not check that 
> the file exists.
>  
>  The returned string must be freed by the caller.
>  
> +=head2 C
> +
> + char *nbdkit_realpath (const char *filename);
> +
> +The utility function C converts any path to an
> +absolute path, resolving symlinks.  Under the hood, it uses the
> +C function.

Can it say something about the difference between this one and
nbdkit_absolute_path?  Like, that the file / directory must exist
otherwise it's an error.  I think otherwise people would wonder why
there are two functions that seem to do the same thing.

Rest of the patch seems fine, so ACK with updated documentation.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [nbdkit PATCH] plugin: add and use nbdkit_realpath

2018-02-14 Thread Pino Toscano
On Wednesday, 14 February 2018 15:29:39 CET Eric Blake wrote:
> 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/

Fixed locally, thanks.

> > 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.h |  1 +
> 
> Should we also document the helper functions in docs/nbdkit-filter.pod?

If so, that will be a different patch though, since nbdkit-filter does
not document the plugin API, but links to it.

-- 
Pino Toscano

signature.asc
Description: This is a digitally signed message part.
___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Re: [Libguestfs] [nbdkit PATCH] plugin: add and use nbdkit_realpath

2018-02-14 Thread Eric Blake

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
---
  docs/nbdkit-plugin.pod  | 13 +
  include/nbdkit-common.h |  1 +


Should we also document the helper functions in docs/nbdkit-filter.pod?

Otherwise looks good to me

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs