[erlang-questions] Linux device driver communication with Erlang node

Sanya Potapov potapovsanya@REDACTED
Wed Nov 30 08:38:48 CET 2011


I'm not an expert, but AFAIK Linux device driver is essentially a set of
callbacks, by which it communicates with the kernel - it's not an arbitrary
program that could run in the user space put to the kernel space. Usually
it communicates with the user space programs by means of device files in
the /dev/ folder and /proc/ fs. The later is usually used for some setting
and reading some options. For passing a blob from the user space program to
the driver you write it to the device file, like you would do with any
regular file. And in the driver code you have a callback for reading that
data.

On Nov 30, 3:23 am, Motiejus Jakštys <desired....@REDACTED> wrote:
> Hello,
>
> I am thinking of a way for Linux kernel driver to communicate with
> Erlang node. The purpose is send binary blobs and have some logic:
> * The blob has been ack'ed by erlang node
> * Some business operation has been completed with the blob (by node)
>
> C node seems to be the perfect match. Is there anything I should know
> before starting messing around? Any possible gotchas running Erlang node
> in kernel space? Has anybody tried that?
>
> What I am trying to do
> ======================
>
> I am thinking of implementing NBD stack with Erlang and C. NBD server is
> easy (100% userspace), the client is more tricky, since device driver
> code has to be kernel space.
>
> NBD-client would consist of two parts:
> * nbd.c that implements block device interface and talks to Erlang node
> * Erlang node that communicates with another Erlang node nbd-server
>   (which does the "business" part with the blob -- writes to disk)
>
> RFC
> ===
>
> For me distinction between "client" and "server" is unclear in the
> tutorial:http://www.erlang.org/doc/tutorial/cnode.htmlCould somebody
> explain it from the higher perspective?
>
> I have never mixed C and Erlang before, and would appreciate some light
> on C nodes generally. What is a C node from the system point of view?
> Does it use sockets, pipes? What OS processes/threads does it spawn?
>
> Many thanks,
> Motiejus
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@REDACTED://
erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111130/5ea14453/attachment.htm>


More information about the erlang-questions mailing list