Sanya is correct.<div><br></div><div>You would need to write a device driver that implements the block device interface and also provides a conduit to userspace; probably a character device node which Erlang could read and write.  After being spoiled by Erlang, writing linux device drivers in C will make you want to rip your hair out. :)</div>
<div><br></div><div>Incidentally, people abuse the existing NBD client driver to write their own userspace block devices.  You could easily do the same without having to touch kernel code at all.</div><div><br></div><div>
Dan.<br><br><div class="gmail_quote">On Tue, Nov 29, 2011 at 5:23 PM, Motiejus Jakštys <span dir="ltr"><<a href="mailto:desired.mta@gmail.com">desired.mta@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
I am thinking of a way for Linux kernel driver to communicate with<br>
Erlang node. The purpose is send binary blobs and have some logic:<br>
* The blob has been ack'ed by erlang node<br>
* Some business operation has been completed with the blob (by node)<br>
<br>
C node seems to be the perfect match. Is there anything I should know<br>
before starting messing around? Any possible gotchas running Erlang node<br>
in kernel space? Has anybody tried that?<br>
<br>
What I am trying to do<br>
======================<br>
<br>
I am thinking of implementing NBD stack with Erlang and C. NBD server is<br>
easy (100% userspace), the client is more tricky, since device driver<br>
code has to be kernel space.<br>
<br>
NBD-client would consist of two parts:<br>
* nbd.c that implements block device interface and talks to Erlang node<br>
* Erlang node that communicates with another Erlang node nbd-server<br>
  (which does the "business" part with the blob -- writes to disk)<br>
<br>
RFC<br>
===<br>
<br>
For me distinction between "client" and "server" is unclear in the<br>
tutorial: <a href="http://www.erlang.org/doc/tutorial/cnode.html" target="_blank">http://www.erlang.org/doc/tutorial/cnode.html</a> Could somebody<br>
explain it from the higher perspective?<br>
<br>
I have never mixed C and Erlang before, and would appreciate some light<br>
on C nodes generally. What is a C node from the system point of view?<br>
Does it use sockets, pipes? What OS processes/threads does it spawn?<br>
<br>
Many thanks,<br>
Motiejus<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="border-collapse:collapse"><font style="font-family:arial, sans-serif"><font face="Verdana, Helvetica, Arial"><i>Daniel Goertzen<br>Senior Software Engineer<br>
</i></font></font><font face="Calibri, Verdana, Helvetica, Arial" style="font-family:arial, sans-serif">-- <br></font><font color="#0000FB" style="font-family:arial, sans-serif;font-size:x-small"><font face="Verdana, Helvetica, Arial"><b>Network Integrity Systems<br>
</b></font></font><font><font color="#FB0000" style="font-family:arial, sans-serif;font-size:x-small">We Bring Security To Light™<br></font><font face="verdana, sans-serif"><br><font size="1">1937 Tate Blvd. SE</font><br>
<font size="1">Hickory, North Carolina 28602</font><br><font size="1"><br></font></font></font></span><font size="1" face="verdana, sans-serif"><span style="border-collapse:collapse">Phone: </span><span style="color:rgb(51, 51, 51)">828.610.4596</span><span style="border-collapse:collapse"><br>
</span><span style="border-collapse:collapse">Fax: 828.322.5294</span><span style="border-collapse:collapse"><br></span></font><div><div><font face="verdana, sans-serif"><font size="1"><span style="border-collapse:collapse"><br>
</span></font><span style="background-color:rgb(255, 255, 255)"><font><font color="#1609C3" style="font-size:10pt"><br></font><font size="1">Network Integrity Systems’ INTERCEPTOR™ Optical Network Security System is a Smart-PDS™ that ensures superior protection and cost effectiveness of classified networks. <br>
 <br>For more information, visit our website at: <a href="http://www.networkintegritysystems.com/" style="color:rgb(64, 100, 128)" target="_blank">www.networkintegritysystems.com</a> <<font color="#0000FF"><u><a href="http://www.networkintegritysystems.com/" style="color:rgb(64, 100, 128)" target="_blank">http://www.networkintegritysystems.com</a></u></font>><br>
__________________________________________<br></font></font><font><font size="1">INTERCEPTOR™ Optical Network Security System is made in the USA for the USA. Although not an export controlled item, because of the role it plays in the assurance of the safety and integrity of National Security Information, Network Integrity Systems (NIS) is committed to compliance with the U.S. Export Administration Act. Accordingly, NIS will not ship INTERCEPTOR products to certain foreign government end users without U.S. government approval and will refuse transactions with individuals or entities that have been denied export privileges.</font></font></span></font></div>
</div><br>
</div>