Re: [Qemu-devel] [PATCH v2 3/4] 9pfs: local: simplify file opening

2017-05-23 Thread Greg Kurz
On Tue, 23 May 2017 10:51:26 -0500
Eric Blake  wrote:

> On 05/23/2017 09:32 AM, Greg Kurz wrote:
> > The logic to open a path currently sits between local_open_nofollow() and
> > the relative_openat_nofollow() helper, which has no other user.
> > 
> > For the sake of clarity, this patch moves all the code of the helper into
> > its unique caller. While here we also:
> > - drop the code to skip leading "/" because the backend isn't supposed to
> >   pass anything but relative paths without consecutive slashes. The assert()
> >   is kept because we really don't want a buggy backend to pass   an 
> > absolute  
> 
> odd spacing
> 
> >   path to openat().
> > - use strchrnul() to get a simpler code. This is ok since virtfs if for  
> 
> s/if/is/
> 

Yeah, I spotted these two nits just after posting the series, as usual :)

I'll fix them before merging.

> >   linux+glibc hosts only.
> > - don't dup() the initial directory and add an assert() to ensure we don't
> >   return the global mountfd to the caller. BTW, this would mean that the
> >   caller passed an empty path, which isn't supposed to happen either.
> > 
> > Signed-off-by: Greg Kurz 
> > ---  
> 
> Reviewed-by: Eric Blake 
> 



pgpD7XR2CQwF1.pgp
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 3/4] 9pfs: local: simplify file opening

2017-05-23 Thread Eric Blake
On 05/23/2017 09:32 AM, Greg Kurz wrote:
> The logic to open a path currently sits between local_open_nofollow() and
> the relative_openat_nofollow() helper, which has no other user.
> 
> For the sake of clarity, this patch moves all the code of the helper into
> its unique caller. While here we also:
> - drop the code to skip leading "/" because the backend isn't supposed to
>   pass anything but relative paths without consecutive slashes. The assert()
>   is kept because we really don't want a buggy backend to pass   an absolute

odd spacing

>   path to openat().
> - use strchrnul() to get a simpler code. This is ok since virtfs if for

s/if/is/

>   linux+glibc hosts only.
> - don't dup() the initial directory and add an assert() to ensure we don't
>   return the global mountfd to the caller. BTW, this would mean that the
>   caller passed an empty path, which isn't supposed to happen either.
> 
> Signed-off-by: Greg Kurz 
> ---

Reviewed-by: Eric Blake 

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



signature.asc
Description: OpenPGP digital signature