Re: VFS event hooks

Brandon S. Allbery KF8NH (allbery@kf8nh.apk.net)
Sat, 26 Jun 1999 14:20:39 -0400


In message <Pine.LNX.3.96.990626195425.22668M-100000@angusbay.vnl.com>, Dale Am
on writes:
+-----
| On Sat, 26 Jun 1999, Linus Torvalds wrote:
| > This is what "poll" is for: it would not be overly hard to add a new
| > POLL_XXX type that says "the underlying data has changed", and make
| > directories and regular files honour that.
|
| By my reading it might not work. Just because an Icon is displayed on
| a desktop or a file shows up in a Workspace Manager with properties
| doesn't mean you actually have an open fd for it. I'm not sure of
+--->8

No, but you can have one for the directory it's in. Or for the filesystem
it's in: OS/2 does it that way, with a DosFSCtl() (IIRC) that asks the
filesystem to send a message on the supplied message queue when any file on
the specified drive (filesystem) changes.

The equivalent on Linux would be to open the mountpoint directory and pass it
to poll() with some POLL_XXX type. Although the file's directory would be a
better choice because then the name's readily available, and it's even sane
to just return a "something changed" indication and let userspace figure out
what; it's asking a bit much for the filesystem-level one to simply say
"something changed" and then have userspace rescan the whole filesystem to
find out what changed, so the message sent by the OS/2 FS layer includes the
path of the changed file.

Although, if poll() can return information about what changed (indirectly, by
making it available for read() on the directory file descriptor), it might be
good enough to return the inode number of the changed file and let userspace
map that to those items it cares about; in most if not all cases, it will
only care about files for which it's done a stat() (or an open(), in which
case it could do an fstat()).

-- 
brandon s. allbery	[os/2][linux][solaris][japh]	 allbery@kf8nh.apk.net
system administrator	     [WAY too many hats]	   allbery@ece.cmu.edu
carnegie mellon / electrical and computer engineering			 KF8NH
     We are Linux. Resistance is an indication that you missed the point.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/