-   Programming (
-   -   Block device driver (

beandigital 02-06-2013 04:40 AM

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?



smallpond 02-07-2013 02:17 PM

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.

beandigital 02-07-2013 02:22 PM

Thanks for the help I will give it a try.


All times are GMT -5. The time now is 03:42 PM.