Re: [AVFS] ~/.avfs and symlinks

Miklos Szeredi <[email protected]> Wed, 08 Mar 2006 13:18:57 +0100
Newsgroups gmane.comp.file-systems.avfs.user
Message-ID <[email protected]>
> > Attached the symlink transformation in sshfs.  sshfs.base_path is the
> > path within the remote filesystem which is mounted.  For example if
> > you mount 'user@host:/', then base path is '/', if you mount
> > 'user@host:/foo' then the base path is '/foo'.  If you mount
> > 'user@host:', then the base path is '.' (which means the home
> > directory), in this case the transformation doesn't work.
> 
> Is this code GPL'd?

Yes.

> I used the code to modify the readlink function, see the attached patch.
> I still have some questions:

OK, I think it belongs in av_readlink() in oper.c rather than avfsd.c,
because this is relevant not just for the FUSE frontend.  Oh, and
follow_link() in parse.c should then also call av_readlink() instead
of ->readlink() directly.  Do you see a problem with this?

> Is it possible to add a mount option or something to switch the symlink
> rewriting on or off?

There could be a parameter in '/#avfsstat' You can register this with
av_avfsstat_register().

> I think we don't need to take care of the mount point since it looks
> like fuse passes the path without the mount point. But you are the
> export in fuse, are my changes in transform_symlink okay?
> 
> >     newlink = malloc(dotdots * 3 + l ? strlen(l) : 1 + 10);
> 
> There is a bug in the malloc argument: the expression is equal to
> 
> (dotdots * 3 + l) ? strlen(l) : (l + 10)
> 
> which is not correct, it should be
> 
> dotdots * 3 + (*l ? strlen(l) : 1) + 10

Good spotting.  It's a wonder how I managed to cram so many bugs into
that expression.

Thanks,
Miklos


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642