Linux Driver - how to read/write a block or character device in kernel space (procfs)
Hello,
I'm trying to learn how to make drivers for Linux Kernel. I have looked into some tutorials and used them. I was able to make a working block device driver as well as a character device driver and some procfs entries. These are really easy if you don't need to access the hardware really. Problems start when you try to do real things like these:
Can somebody help me? P.S.: I know about an option to open files in kernel space, but it was written on many places, that if you need it than you're driver is wrongly designed. I want to do it correctly. I looked into the md driver, but I'm lost in the code. It's really badly documented. |
Some info I found, but still I'm lost
I have found the following functions (while studying the md driver), but I don't know how to use them correctly:
There are many other functions using page allocations and "synchronization", but I need just a simple read. I cannot find anything. Even this page sync would be OK, because it would help next time I would like/need to write a driver. I hope, that someone would be interested in this topic. Probably some similar sample driver can be included in the next edition of the "Linux Device Drivers" book. After I would have a first successful read I would publish the code, so it would be easy to include it there. Still I have no idea how to read from the character device. |
All times are GMT -5. The time now is 06:31 PM. |