On Tue, 2009-02-17 at 12:00 +0100, Alexander Larsson wrote: > 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. Thanks, found it. I keep forgetting that signals treat '-' and '_' as the same character. I don't see where the monitor is being canceled in the pre-unmount path, though. I do see where windows are closed, but I don't see where the finalizer cancels any pending file or directory monitors. In fact, I only see monitors being removed after the mount has disappeared (and this is in GIO). How should one cancel a monitor from nautilus-window or nautilus-application? Joe > > -- Joe Marcus Clarke FreeBSD GNOME Team :: gnome FreeBSD org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome
Attachment:
signature.asc
Description: This is a digitally signed message part