LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   linux: easy example of a block device driver? (http://www.linuxquestions.org/questions/programming-9/linux-easy-example-of-a-block-device-driver-847552/)

eantoranz 11-30-2010 06:51 PM

linux: easy example of a block device driver?
 
Hi!

Is there an easy example of a block device driver I could follow as a guide to write my own module?

Thanks in advance.

TheIndependentAquarius 11-30-2010 09:45 PM

See if you can get a translator for this:
http://www.kernel-labs.org/?q=blockd...7f5c1547f0f15d

I would suggest to get yourself started with some thing very easy like:
  • Writing an interrupt handler for a keyboard (keyboard is a character device)
  • Writing an user space character device driver.
By the above two things you'll come to know what you are heading towards, straightway jumping in the ocean for learning swimming will not help.

Check out this site for further clarifications:
http://tldp.org/LDP/khg/HyperNews/ge...s/devices.html
and
http://tldp.org/LDP/lkmpg/2.6/html/index.html

eantoranz 12-01-2010 06:50 AM

Oh, I don't need one. I'm a native spanish speaker. Thanks! I'll take a look at it.

eantoranz 12-02-2010 08:05 PM

Anishakaul! Look, I'm already decoding the sbull driver from that page with my "Understanding the linux kernel" book in hand. :-)

However, when I try to compile it (maybe it's not the best thing to do but....) I get this message:

Code:

/home/ubuntu/raid5/r5r/sbull/sbull.c:72: error: expected ‘)’ before ‘*’ token
I think it could be related to the definition of request_queue_t, because I changed it for foo_t and it kept the same error. What do you think?

TheIndependentAquarius 12-02-2010 08:56 PM

That link is not working for me now neither do I have that book in my hand!
and secondly, how do you think that I can "guess" what is the cause of the error without reading the code near "line 72" of "sbull.c" ?

For this error you should start a new thread, with the relevant code, then may be someone can help you!

eantoranz 12-03-2010 08:28 AM

Ok. sbull.c is the code taken from the driver page you told me to follow as such.

You are right on having to open a new thread, though. I'll do it later during the day. Thanks anyway. :-)


All times are GMT -5. The time now is 04:07 AM.