Subject: Re: Advice Needed on a NetBSD based project
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 08/08/2004 13:23:52
>> My main problem problem here is that I dont have much idea on how to
>> go about designing a efficient way to communicate between such an
>> indexing daemon and my fs layer.
> You want to develop a message passing interface ... you could use a
> socket or a character special device.  The latter has some prior art:
> Take a look at [CODA].  Other FS projects I have worked on have also
> used the character device approach.

Over the second half of 2002, I did some filesystem work.  One of the
pieces I ended up implementing was a pseudo-filesystem layer, one which
talks to a userland daemon.  Unlike an NFS mount, though, I put the
user/kernel split approximately at the VOP_*() point.

I used a socket for communication.  The filesystem-specific mount
structure for my filesystem included an int which was specified to
contain the file descriptor for one end of a connected AF_LOCAL
SOCK_STREAM socket, which the kernel took over; userland then spoke
with the kernel using the other end of that connection.

I considered allowing any connected SOCK_STREAM socket with PR_ATOMIC
and PR_RIGHTS in its protocol flags, but that equals AF_LOCAL in
practice, and certain buffering issues looked difficult.

The code can be found on ftp.rodents.montreal.qc.ca, in
/mouse/source-tree/patches/working/src/sys/miscfs/pfs/, for anyone
interested.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B