VFS event hooks

Richard Gooch (rgooch@atnf.csiro.au)
Sun, 27 Jun 1999 00:07:49 +1000


Dale Amon writes:
> I'd love to see the like under Linux as well. In USER
> land. There is very little that has any place in the
> kernel. One exception is an item on another thread:
> a signal that tells you when a file is written. That
> is very useful, perhaps essential, for NeXTstep type
> GUI's.

There's merit in that idea. It's in keeping with the principle of
having the kernel export information it has to keep anyway to user
space so that user space doesn't have to waste resources regenerating
this information.

You could probably do this in the VFS layer. Just add a new member to
the VFS inode structure which is some kind of communication channel to
a process. If the channel is open, send a message in sys_write().

The channel could be a pid to send a signal to or a file pointer to
write data into. You'd set up this channel using fcntl().

This scheme would work for all file types: directory, regular, device,
whatever. The only cost would be an extra test in sys_write(), which
is relatively cheap, since the common case would see the test
fail. Certainly cheaper than the global kernel lock that we're
planning on chucking.

Hm. You could add interception points for other VFS methods too, like
read, lookup and more. Might make it easier to implement direct mount
automounting.

Linus: is this an idea worth pursuing?

Regards,

Richard....

-
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/