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

Ralf Hoffmann <[email protected]> Tue, 15 Feb 2005 22:07:14 +0100 (CET)
Newsgroups gmane.comp.file-systems.avfs.user
Message-ID <[email protected]>
Hi,

On 15-Feb-2005 Miklos Szeredi wrote:
>> I changed the code so segment_len will now check with another
>> function
>> is the next segment describes a local file. This way parse_path is
>> almost untouched. I currently trying to add the test to virtual
>> files
>> to only enter the next avfs hierarchy if a file containing the magic
>> char is not present in the current avfs mount.
>> Is there a easy way to call av_file_getattr? It looks like I need a
>> vfile which itself needs a ventry which the function currently tries
>> to
>> build.
> 
> Tricky.  How about leaving the test till the next segment: so instead
> of blindly accepting the magic char, at the beginning of the segment,
> do a stat on the file which is the current ps->ve plus from the magic
> char up to the next slash.  This way you already hold the correct
> ventry.  This means that you'd have to modify lookup_segment()
> instead
> of segment_len().  Does this sound solvable?

Do I understand you correctly that you want to test for real file in
lookup_segment before calling lookup_avfs? This could be a good
solution. For the example "/tmp/test#test/x" we have a valid ventry for
"/tmp/test" and now trying to lookup "#test". We need to get "#test"
into the ventry. With this ventry I could call av_file_open. I think the
result should be enough information, stat is not really needed. If it
works there is a local file and we know to ignore the magic. This also
works when testing for such special files in virtual files.

On the other hand this wouldn't work for "test.tar.gz#ugz#something".
lookup_segment wouldn't find a valid file for "test.tar.gz#ugz" so it
would call lookup_avfs for #ugz.

But we could test just before lookup_segment() in parse_path() using
the rest of ps->path up to the slash and if it fails we could continue
as before.

To temporary add a segment to the ventry, can I copy the ventry and
call lookup_virtual, test the existence (using av_file_open), then
delete the copy and repeat with taking the magic into account?

My current thought is something like this:

l = segment_len(ignore_magic = 1)
ps->path[l] = 0
av_copy_ventry(ps->ve, &tempve)
ps->ve = tempve;
lookup_virtual( ps );
if(!av_file_open(&vf, ps->ve,...)) {
  free_ventry(ps->ve),
  ps->ve = oldve;
  l = segment_len( ignore_magic = 0 )
} else {
  av_file_close()
  delete oldve (or redo the same with the original ve)
}
[continue as before]

This code doesn't even care about local or virtual files. It just test
for existence before entering the next level of avfs.

If you think this should work, I will try to implement it.

Best Regards,

Ralf Hoffmann

-- 
Homepage: http://www.boomerangsworld.de
E-Mail: Ralf Hoffmann <[email protected]>
  english or german



-------------------------------------------------------
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_ide95&alloc_id396&op=click