diff options
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index d2815b7a9150..bdb9c2717d40 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -153,6 +153,7 @@ static int cciss_open(struct inode *inode, struct file *filep); | |||
153 | static int cciss_release(struct inode *inode, struct file *filep); | 153 | static int cciss_release(struct inode *inode, struct file *filep); |
154 | static int cciss_ioctl(struct inode *inode, struct file *filep, | 154 | static int cciss_ioctl(struct inode *inode, struct file *filep, |
155 | unsigned int cmd, unsigned long arg); | 155 | unsigned int cmd, unsigned long arg); |
156 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | ||
156 | 157 | ||
157 | static int revalidate_allvol(ctlr_info_t *host); | 158 | static int revalidate_allvol(ctlr_info_t *host); |
158 | static int cciss_revalidate(struct gendisk *disk); | 159 | static int cciss_revalidate(struct gendisk *disk); |
@@ -194,6 +195,7 @@ static struct block_device_operations cciss_fops = { | |||
194 | .open = cciss_open, | 195 | .open = cciss_open, |
195 | .release = cciss_release, | 196 | .release = cciss_release, |
196 | .ioctl = cciss_ioctl, | 197 | .ioctl = cciss_ioctl, |
198 | .getgeo = cciss_getgeo, | ||
197 | #ifdef CONFIG_COMPAT | 199 | #ifdef CONFIG_COMPAT |
198 | .compat_ioctl = cciss_compat_ioctl, | 200 | .compat_ioctl = cciss_compat_ioctl, |
199 | #endif | 201 | #endif |
@@ -633,6 +635,20 @@ static int cciss_ioctl32_big_passthru(struct file *file, unsigned cmd, unsigned | |||
633 | return err; | 635 | return err; |
634 | } | 636 | } |
635 | #endif | 637 | #endif |
638 | |||
639 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
640 | { | ||
641 | drive_info_struct *drv = get_drv(bdev->bd_disk); | ||
642 | |||
643 | if (!drv->cylinders) | ||
644 | return -ENXIO; | ||
645 | |||
646 | geo->heads = drv->heads; | ||
647 | geo->sectors = drv->sectors; | ||
648 | geo->cylinders = drv->cylinders; | ||
649 | return 0; | ||
650 | } | ||
651 | |||
636 | /* | 652 | /* |
637 | * ioctl | 653 | * ioctl |
638 | */ | 654 | */ |
@@ -651,21 +667,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
651 | #endif /* CCISS_DEBUG */ | 667 | #endif /* CCISS_DEBUG */ |
652 | 668 | ||
653 | switch(cmd) { | 669 | switch(cmd) { |
654 | case HDIO_GETGEO: | ||
655 | { | ||
656 | struct hd_geometry driver_geo; | ||
657 | if (drv->cylinders) { | ||
658 | driver_geo.heads = drv->heads; | ||
659 | driver_geo.sectors = drv->sectors; | ||
660 | driver_geo.cylinders = drv->cylinders; | ||
661 | } else | ||
662 | return -ENXIO; | ||
663 | driver_geo.start= get_start_sect(inode->i_bdev); | ||
664 | if (copy_to_user(argp, &driver_geo, sizeof(struct hd_geometry))) | ||
665 | return -EFAULT; | ||
666 | return(0); | ||
667 | } | ||
668 | |||
669 | case CCISS_GETPCIINFO: | 670 | case CCISS_GETPCIINFO: |
670 | { | 671 | { |
671 | cciss_pci_info_struct pciinfo; | 672 | cciss_pci_info_struct pciinfo; |