Re: [AVFS] Problems with fork, Questions about avfs

Miklos Szeredi <[email protected]> Wed, 09 Feb 2005 10:19:30 +0100
Newsgroups gmane.comp.file-systems.avfs.user
Message-ID <[email protected]>
> I have added this to virtual.c (but by using lstat instead of stat).

Yes, lstat is the right thing to use.

> >> Then there is serious problem with the character # inside filenames.
> > 
> > Hmm.  In theory it should work.  If it doesn't thats a bug.
> 
> The problem was that preprocess_name is only called for non-local files
> in lookup_segment but escape_magic is called for every file in
> av_fd_readdir.

Oh, yes.  I see the problem now.  It wasn't noticed before because
both avfscoda with redir and ld_preload bypass libavfs for local
files.

> Anyway I don't like the method to escape the magic character. The user
> would need to enter double "#" to add a single "#" to the filename.
> I came up with a different solution. In parse_path I firstly ignore the
> magic character for each segment and test for a local file. If this
> fails it is repeated with the magic character taken into account.

Sounds good.

> With this solution it is possible to access any local file while still
> be able to access most virtual files (filenames in archives with the
> magic character are not accessable but they are not accessable at all
> without avfs on the other hand :-) ).
> A possible solution could be the use of the stat function of the
> corresponding avfs struct but this could slowdown the parse_path
> operation.

But only if magic char is present in path.  And anyway stat() is a
very fast operation.  However I don't understand why you do this in
such a complex way in parse_path(), instead of just doing the lstat()
in av_get_ventry() to determine once and for all if the path is local
or not.

> Okay, I also added this function to virtual.c
> 
> I hope you can find some time to look at my changes and tell me your
> thoughts about it.

Seems OK.  One general note: you shuld follow the coding style of the
original code:

  - indent by 4 spaces

  - use 

     if ()
         xxx;
     else
         yyy;

  instead of

      if () xxx;
      else yyy;

   - use if (xxx)  instead of if ( xxx )

I know it's hard to follow other's style but it makes readig code much
harder if it is written in mixed style.

Thanks,
Miklos


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click