Re: [RFC][PATCH] inotify 0.10.0

From: Andrew Morton
Date: Wed Sep 29 2004 - 20:26:59 EST


John McCutchan <ttb@xxxxxxxxxxxxxxxx> wrote:
>
> > ~ ~
> >
> > As Chris points out, we still need a way to pass the name or path back
> > to userspace when an event occurs, which is the interface I was harping
> > on a few messages back.
> >
> > It seems we're trying to recreate a variant struct dirent for
> > communicating changes to userspace. Perhaps we can learn something from
> > already trodden ground? Just sayin'.
>
> Yes the current method of passing the name back to user space is
> definitely sub par. But I don't think passing a full path to user space
> is reasonable, as that would require walking the dirent tree for every
> event. Really the best we can provide user space is the filename/dirname
> (relative to the directory you are currently watching).

Userspace requests that the kernel start monitoring an fd. The kernel
returns an integer cookie which corresponds to that monitor.

When an event occurs, the kernel returns the event identifier and the
cookie to userspace.

Userspace then does a lookup to work out what pathname corresponds to the
cookie.


Or is it the case that you expect a single monitor on /etc will return
"/etc/passwd" if someone modified that file, or "/etc/hosts" if someone
modified that file? If so, perhaps we should take that feature away and
require that userspace rescan the directory?


Because passing pathnames into and back from the kernel from this manner is
really not a nice design.

A halfway point might be to return {cookie-of-/etc,EVENT_MODIFY,"hosts"} to
a monitor on the /etc directory.

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