LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-30-2010, 06:51 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
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.
 
Old 11-30-2010, 09:45 PM   #2
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
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
 
1 members found this post helpful.
Old 12-01-2010, 06:50 AM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Oh, I don't need one. I'm a native spanish speaker. Thanks! I'll take a look at it.
 
Old 12-02-2010, 08:05 PM   #4
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
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?

Last edited by eantoranz; 12-02-2010 at 08:13 PM.
 
Old 12-02-2010, 08:56 PM   #5
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
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!
 
Old 12-03-2010, 08:28 AM   #6
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
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. :-)
 
  


Reply

Tags
block device, driver, linux, module


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CDROM block device driver souvikdatta Programming 0 10-23-2010 12:04 PM
Mtd driver as block device and char device Linux_Kid_ Linux - Kernel 1 12-27-2009 12:17 PM
problem with ending requests asynchronously in my block device driver cable_plug2000 Programming 0 12-15-2007 05:12 PM
Block device driver for SDcard kingraja84 Linux - Kernel 0 06-13-2007 05:22 AM
Quick and easy solution for writing a linux device driver? mr_segfault Programming 5 01-08-2004 10:45 PM


All times are GMT -5. The time now is 06:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration