Ticket #14834 (closed enhancement: fixed)
wxFileSystemWatcher: Add wxFSW_EVENT_UNMOUNT flag for inotify's IN_UNMOUNT
| Reported by: | dghart | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | base | Version: | 2.9-svn |
| Keywords: | wxFileSystemWatcher wxFSW_EVENT_UNMOUNT | Cc: | |
| Blocked By: | Patch: | yes | |
| Blocking: |
Description
Inotify emits an IN_UNMOUNT event when a watched item's filesystem is unmounted. wxFileSystemWatcher currently treats this event as an error; I'm not sure why. The attached patch (which should be applied after the IN_ATTRIB one but doesn't depend it) converts it to wxFSW_EVENT_UNMOUNT which I've added to the wxFSWFlags enum (using the IN_UNMOUNT value for no important reason). It shouldn't be included in wxFSW_EVENT_ALL as IN_UNMOUNT is not intended to be a user-requested watch and is outside the INOTIFY_ADD_WATCH bit-mask.
As unmounting is not entirely cross-platform, I've #if def.ed wxFSW_EVENT_UNMOUNT in common code. In the future, NOTE_REVOKE looks like the best kqueue match; this is currently ignored.
I can't think of a good way to add a test for this, but it can be seen to work in the fswatcher sample: mount something, watch a dir inside that filesystem, then unmount it.

