Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-06-2013, 03:40 AM   #1
LQ Newbie
Registered: Jan 2013
Posts: 17

Rep: Reputation: Disabled
Block device driver


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?


Old 02-07-2013, 01:17 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,798

Rep: Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749
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
LQ Newbie
Registered: Jan 2013
Posts: 17

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




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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:00 AM.

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