[gamin] Re: [RFC][PATCH] inotify 0.10.0



On Thu, 2004-09-30 at 00:15, Andrew Morton wrote:
> John McCutchan <ttb tentacle dhs org> 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.

That is what inotify does. Except user space asks the kernel to monitor
a particular path (not an fd).

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

Yes, this is the case that we are discussing. Rescanning the directory
is a waste, if the kernel can cheaply tell userspace what happened.

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

This is what the current inotify code does. You get an event with the
filename relative to your watch descriptor (cookie). 

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]