Re: How to remove a monitor before unmounting?



On Mon, 2009-02-16 at 15:20 -0500, Joe Marcus Clarke wrote:
> Alexander Larsson wrote:
> > On Mon, 2009-02-16 at 00:11 -0500, Joe Marcus Clarke wrote:
> >> On FreeBSD, our kernel file monitor requires that we open the
> >> file/directory to be monitored.  This causes a problem when we try and
> >> unmount the file system (e.g. a USB volume).  Because FAM has these file
> >> descriptors open, we always get a "Device busy" error.  I was hoping to
> >> add some code to nautilus to remove the monitor from the volume before
> >> unmounting.  However, I wasn't sure the best/right way to do it.
> >>
> >> If I add a call to nautilus_directory_remove_file_monitors() to
> >> nautilus-file.c:nautilus_file_unmount() will this work?  Is there a
> >> better way to do this?  Thanks.
> > 
> > Hmmm. The general idea is that using the gio API to unmount something
> > should cause the "mount-pre-unmount" signal to be emitted on the mount
> > object which should cause nautilus to close windows in the mount and
> > thus free the monitor.
> > 
> > I can't say i've recently verified that this is what happens, as i'm on
> > inotify atm and that doesn't keep the mount busy. Could you try to find
> > out where this chain is failing?
> 
> I don't see where nautilus listens for this signal.  I see it emitted in
> gvfs, but I don't see the connection to Nautilus.  In fact, I have
> noticed that when I choose to unmount a USB stick in nautilus, the
> window does not close.  I'm currently using Nautilus 2.24.2.

nautilus-application.c:finish_startup() connects to it, and on
pre_unmount (and unmount) mount_removed_callback() gets called which
looks for windows in that mount.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]