Re: [AVFS] Problems with fork, Questions about avfs
Miklos Szeredi <[email protected]> Fri, 18 Feb 2005 11:11:07 +0100
| Newsgroups | gmane.comp.file-systems.avfs.user |
|---|---|
| Message-ID | <[email protected]> |
> 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.
The really general solution would be to try appending the segments
until a '/' is found (in which case it's virtual) or until one file
did exist. In fact to be perfectly correct, the testing should start
from the whole path segement up to the slash, and if it doesn't exist
go backwards removing #foo until either no more # is found or one file
did exist. Does this sound too difficult?
> 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.
Something like that should work IMO.
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