The ioctl
dispatching is handled by the blkdev_ioctl
function, which will process some of the ioctls directly, without calling into your driver's specific routine.
For HDIO_GETGEO
, it calls your driver's getgeo
function directly (from kernel 3.13.6, doesn't appear to have changed much since 2.6.32):
[...]
/*
* We need to set the startsect first, the driver may
* want to override it.
*/
memset(&geo, 0, sizeof(geo));
geo.start = get_start_sect(bdev);
ret = disk->fops->getgeo(bdev, &geo); /* <- here */
[...]
For BLKBSZGET
, it calls block_size(bdev))
, which simply returns bdev->bd_block_size
.
You'll find blkdev_ioctl
in block/ioctl.c
if you need to know what happens for other ioctls.