<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="post-text" itemprop="description">
<p>Hi<br>
</p>
<p>I'm planning to write a new device driver on linux kernel . The
device i intend to write will be a device that'll pipe the data
coming into it to another computer that'll be also having the
same device . So in short the device'll be readable/writable and
should communicate through network . I know it sounds like a
socket but the idea would be to implement a interface in shell
so that if you type </p>
<pre><code> root@host$echo "Hi">>mydevice
</code></pre>
<p>will transfer the word hi to the system on the other side of
network (and may be configure it to store on file). This is a
leisure time project i intend to do and it sounds much like
sockets and other already existing implementations . Well the
questions regarding the design for device implementations are :
1)Should i use a block or a character device . The advantage i
see for a block device is that if i am a initiating a complete
file transfer through the device(which i in tend to support
later) , then it would be fast .</p>
<p>2)How do i write the data on the network . I'm familiar with
sockets and stuff , but using sockets from with in the kernel
has performance issues(I read it somewhere, after all sockets
was desined to be used in userspace) . Will using netfilter or
other stuffs work ?Maybe crafting the packet directly would help
:-)? Any innovations are welcome</p>
<p>3)How do i configure the driver , like how do i let it know
that it should connect to a specific host >in user space
programs we usually do this by config files , but to change the
connection settings of a driver how do you manage it ? (sysfs ??
Frankly i never worked with sysfs or proc/ )</p>
<p>4)Now as the design specifies all the transfer of files is in
kernel space . When i transfer huge chunks of data through
kernel space , will it slow down the system ?. The design
shouldnt overload the system , doing it in a pre-empitble kernel
will help, but are there other charecterstics i should be aware
of to make the design as efficient as possible (i'm doing it on
the latest linux kernel) ? </p>
<p>5)And i dont want to leave a huge memory imprint so is there
any way i can reduce it while tranferring of data , may be
cacheing data on disk ?</p>
<p>6)I will have to design a user space programme to co ordinate
the driver wont i ? I cannot let the driver alone do the whole
task , tat wud be tedious</p>
<p>Comments Welcome<br>
</p>
<p><br>
I've also posted the same question at stackoverflow too <br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/11167424/writing-a-new-device-driver">http://stackoverflow.com/questions/11167424/writing-a-new-device-driver</a><br>
</p>
<p>Regards<br>
Malice<br>
</p>
</div>
</body>
</html>