LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Block device driver (http://www.linuxquestions.org/questions/programming-9/block-device-driver-4175448839/)

beandigital 02-06-2013 03:40 AM

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

smallpond 02-07-2013 01: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 01:22 PM

Thanks for the help I will give it a try.

Jon


All times are GMT -5. The time now is 02:32 PM.