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 02-06-2013, 03:40 AM   #1
beandigital
LQ Newbie
 
Registered: Jan 2013
Posts: 21

Rep: Reputation: Disabled
Block device driver


Hi

I have written a block device driver for Linux on an embedded system. I have managed to "insmod" the module and if I go to /sys/block I can see it. The driver is used for a SATA hard disk. I am having some issues if I try and do mkfs.ext2. It reports that the image is too small. I have looked in Busybox for the mkfs source and I think the trouble is that the size of the drive is not being returned. In my driver I have a getgeo function which I thought was used to return the size. But it doesn't seem to be called as the printk statement is not shown. Does anyone have any thoughts?

Thanks

Jon
 
Old 02-07-2013, 01:17 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,123

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
According to Linux Device Drivers, ch 16. the block driver should call set_capacity with the size of the device in sectors.

Geometry is a holdover from back when disks had cylinders, heads and sectors. Nobody uses that anymore except a few obsolete disk BIOS programs.
 
Old 02-07-2013, 01:22 PM   #3
beandigital
LQ Newbie
 
Registered: Jan 2013
Posts: 21

Original Poster
Rep: Reputation: Disabled
Thanks for the help I will give it a try.

Jon
 
  


Reply

Tags
driver


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
block device driver blk_alloc_queue settings arun.p Linux - Kernel 6 02-21-2011 11:13 AM
linux: easy example of a block device driver? eantoranz Programming 5 12-03-2010 08:28 AM
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
Block device driver for SDcard kingraja84 Linux - Kernel 0 06-13-2007 05:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration