Hi Malice, On 06/25/2012 09:42 PM, Malice wrote: > Hi > > 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 > > | root@host$echo "Hi">>mydevice > | > > 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 . > > 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 have a look on the tun/tap driver, I think that's what you need. http://lxr.free-electrons.com/source/drivers/net/tun.c > > 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/ ) > > 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) ? > > 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 ? > > 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 > > Comments Welcome > > > I've also posted the same question at stackoverflow too > http://stackoverflow.com/questions/11167424/writing-a-new-device-driver > > Regards > Malice > > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies