Re: [PATCH 2/4] relayfs: Documentation for non-relay file support

From: Tom Zanussi
Date: Wed Nov 09 2005 - 17:22:16 EST


Andrew Morton writes:
> Tom Zanussi <zanussi@xxxxxxxxxx> wrote:
> >
> > +relay_open() automatically creates files in the relayfs filesystem to
> > +represent the per-cpu kernel buffers; it's often useful for
> > +applications to be able to create their own files in the relayfs
> > +filesystem as well e.g. 'control' files used to communicate control
> > +information between the kernel and user sides of a relayfs
> > +application.
>
> What are the semantics of these control files? How does an application
> know that there's something new to be read from them? select() or poll()
> or blocking read()?

It's completely up to the client to define whatever file operations it
wants, which are passed in to relayfs_create_file(). The relayfs
example apps, for instance, read from these files whenever they're
notifed via the relay file poll implementation that there's a
sub-buffer ready. These are basically the same thing as proc or
debugfs files created by passing explicit file operations.

>
> Can userspace write to the control files? If so, what happens
in-kernel?

Yes, the client can supply a write() file op that does whatever it
wants to. For the relayfs examples, the write() implementation
updates the count of sub-buffers consumed, for instance.

Tom


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