X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=block%2Fioctl.c;h=e1109491c234c0ec50d15d220b81589d52cb10c6;hb=7bb3b137abf2b7073e683c14cfe062d811d35247;hp=6e278474f9a8c1f0dcb70a560031fac870eb3220;hpb=407cf84f956ee4b52da5508d5357b8ae212ff77c;p=linux-2.6-omap-h63xx.git diff --git a/block/ioctl.c b/block/ioctl.c index 6e278474f9a..e1109491c23 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -1,6 +1,7 @@ -#include /* for capable() */ +#include #include #include +#include #include #include #include @@ -245,6 +246,27 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, set_device_ro(bdev, n); unlock_kernel(); return 0; + case HDIO_GETGEO: { + struct hd_geometry geo; + + if (!arg) + return -EINVAL; + if (!disk->fops->getgeo) + return -ENOTTY; + + /* + * We need to set the startsect first, the driver may + * want to override it. + */ + geo.start = get_start_sect(bdev); + ret = disk->fops->getgeo(bdev, &geo); + if (ret) + return ret; + if (copy_to_user((struct hd_geometry __user *)arg, &geo, + sizeof(geo))) + return -EFAULT; + return 0; + } } lock_kernel();