[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fuse-devel
Subject:    Re: [fuse-devel] Accessing the underlying directory when	using
From:       Roman V Shaposhnik <rvs () sun ! com>
Date:       2009-07-17 18:07:33
Message-ID: 1247854053.18344.5747.camel () work ! SFBay ! Sun ! COM
[Download RAW message or body]

On Fri, 2009-07-17 at 13:57 +0200, Miklos Szeredi wrote:
> On Thu, 16 Jul 2009, Mike Morrison wrote:
> > John Hendrikx <hjohn@xs4all.nl> writes:
> > 
> > > Hi all,
> > >
> > > How does one access the directory your Fuse filesystem was mounted on
> > > top of?
> > >
> > > For example, I would like to mount a thin layer on top of an existing
> > > directory (let's say /music).  However, as soon as my fs is mounted  
> > > and
> > > I do an ls, it results in an infinite (getattr) loop and I'm forced to
> > > umount -f the filesystem.  This is not too surprising, but how do I
> > > avoid it?
> > >
> > > I seem to remember seeing this explained somewhere, but after googling
> > > and checking the archives of this list I couldn't find how this is  
> > > done.
> > >
> > > Any help appreciated,
> > > --John
> > 
> > Perhaps I'm misunderstanding the question, but I've seen the  
> > combination of:
> > 
> > In main():
> >    cwd = open(mountpoint, O_RDONLY);
> > 
> > In FUSE init():
> >    fchdir(cwd);
> >    close(cwd);
> > 
> > and from then out, use paths relative to mountpoint.
> 
> 
> Yes, apparently that will work too.  But this behavior is probably
> highly Linux specific, 

I don't think it is. fchdir() is part of POSIX.

> AFAIK there's no standard that says fchdir()
> does not follow mounts...

The problem is now that fchdir() follows the mounts (as
it sure does), but what happens once you fchdir into
something that can no longer be accessed via a regular
chdir()/open() calls. How does open() relative to such
current directory behave?

I agree that the POSIX description of open() doesn't
clearly spell that out. However, the openat() description
suggests that it should work:
    http://www.opengroup.org/onlinepubs/9699919799/functions/open.html 

Thanks,
Roman.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic