Hi Henrique,<br><div>  I browsed the two links and I think I&#39;ve read parts of the LDD3, but I could find an answer to my questions.  But considering it is sold as a real book, I might prefer to buy it.  I find it easier to read in a book than on screen, for large texts at least.</div>
<div><br></div><div>  And the second link with the howto is seriously impressive!  In fact, if I had found it earlier, I don&#39;t think I would have needed to write my OP!  :)</div><div><br></div><div>Thank you very much,</div>
<div>  Simon</div><div><br></div><div class="gmail_quote">On Thu, Jan 10, 2013 at 10:05 PM, Henrique Rodrigues <span dir="ltr">&lt;<a href="mailto:henriquesilvar@gmail.com" target="_blank">henriquesilvar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the LDD book is a good starting point: <a href="http://lwn.net/Kernel/LDD3/" target="_blank">http://lwn.net/Kernel/LDD3/</a><div>
<br></div><div>You can find some examples of kernel/user communication here: <a href="http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html" target="_blank">http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html</a><span class="HOEnZb"><font color="#888888"><br>



<div><br></div></font></span><div><span class="HOEnZb"><font color="#888888">-- <br>Henrique Rodrigues<br><div><a href="http://www.dcc.ufmg.br/~hsr" target="_blank">http://www.dcc.ufmg.br/~hsr</a></div><br></font></span><div class="gmail_quote">
<div class="im">On Thu, Jan 10, 2013 at 1:09 PM, Simon <span dir="ltr">&lt;<a href="mailto:turner25@gmail.com" target="_blank">turner25@gmail.com</a>&gt;</span> wrote:<br>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div>Hi there,<br></div><div><br></div><div>  I&#39;m rather new to kernel development, but I am somewhat experienced with Linux, kernel compilation, etc.  I&#39;m just passed writing a helloworld module, dummy filesystem (ramfs wrapper) and proc entry.  I would like to know how communication between kernel &amp; user-space is done (the standard) for a high number of tiny and large messages going in both directions (large messages would need to be transfered incrementally, in chunks, can be sequential or random access).  I plan on developping a network filesystem.  I would appreciate if someone could clarify where I&#39;m wrong and confirm where I&#39;m right, and ideally suggest some vocabulary, source files to lookup, online docs or even books.  The minimum you can give will be most appreciated!  =)</div>




<div><br></div><div>  Firstly, I was wondering if it would be possible to implement the filesystem entirely as a kernel module.  I would need TCP/UDP sockets.  I think this is really not the recommended approach, but an advantage I see is it could be used to mount the root filesystem before calling init (that would be before user-space exists, right?).  On the other hand, separating the work to have a program/daemon in user-space do the communication and processing would allow me to write that part in C++ (which I personally prefer).</div>




<div><br></div><div>  Secondly, I wonder how I can &quot;bind&quot; a user-space program/daemon with the kernel-space of the module.</div><div><br></div><div>  Using procfs:  It seems technically possible to achieve my goal with it, but I feel this would not be the standard approach.  I would rather keep it for live config &amp; live status reporting.</div>




<div>  Using sysfs:  I&#39;ve read too much misleading information that I&#39;m not sure anymore what it&#39;s for or even if it&#39;s still used or deprecated!  Can someone clarify?  It looks technically identical to procfs, but it&#39;s mission is a different one, correct?</div>




<div>  Using pipes:  This may be a good way, but again, I&#39;m not sure if it&#39;s the standard way.</div><div>  Using IPC:  As far as I understand, IPC would be the way if we&#39;d be talking of two threads within the same process, or at least within kernel-space.  Though I am likely to be wrong.</div>




<div>  Using a char device:  It seems technically possible as well, but it may be difficult to deal with if I ever have more than one user-space process.</div><div>  Using a block device:  My file system works with files and their metadata, but not with blocks, so this is not suitable.  Though it might be a nice experiment to build a network block device containing an ext2 filesystem (which I think would be similar to iSCSI).</div>




<div>  Using net interface: Not applicable.  And an experiment to try to make it applicable doesn&#39;t even seem remotely fun.  ;)</div><div><br></div><div>  I&#39;ve seen the functions copy_to/from_user() or something like that, but I haven&#39;t seen the user-space counter-part of these.  I think this may actually be the best approach by far, but I really lack info/docs to go that way.  The truly best way might be to use shared memory to avoid copying data internally, but I haven&#39;t looked into that much yet.</div>




<div><br></div><div>  Finally, is it possible/correct/standard to do something similar to the following for the local kernel &amp; user-space communication?  (I haven&#39;t reviewed the syntax, so take it as some kind of pseudo-code!)</div>




<div><br></div><div>struct foo {...} outgoingFoo;</div><div>// foo contains no pointers, so it is of a fixed size always.</div><div>fwrite(&amp;outgoingFoo, 1, sizeof(outgoingFoo), output);</div><div>  [...then on the other end...]</div>




<div>if(sizeof(fread( buffer, 1, buffer_size, input);</div><div>struct foo * incomingFoo = (struct foo *) buffer;</div><div><br></div><div>Regards,</div><div>  Simon</div>
<br></div></div><div class="im">_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></div></blockquote></div><br><br clear="all"><div><br></div>
</div></div>
</blockquote></div><br>