diff options
Diffstat (limited to 'drivers/block/umem.c')
-rw-r--r-- | drivers/block/umem.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 0f48301342da..15299e7a1ade 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -809,34 +809,23 @@ static int mm_revalidate(struct gendisk *disk) | |||
809 | set_capacity(disk, card->mm_size << 1); | 809 | set_capacity(disk, card->mm_size << 1); |
810 | return 0; | 810 | return 0; |
811 | } | 811 | } |
812 | /* | 812 | |
813 | ----------------------------------------------------------------------------------- | 813 | static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
814 | -- mm_ioctl | ||
815 | ----------------------------------------------------------------------------------- | ||
816 | */ | ||
817 | static int mm_ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) | ||
818 | { | 814 | { |
819 | if (cmd == HDIO_GETGEO) { | 815 | struct cardinfo *card = bdev->bd_disk->private_data; |
820 | struct cardinfo *card = i->i_bdev->bd_disk->private_data; | 816 | int size = card->mm_size * (1024 / MM_HARDSECT); |
821 | int size = card->mm_size * (1024 / MM_HARDSECT); | ||
822 | struct hd_geometry geo; | ||
823 | /* | ||
824 | * get geometry: we have to fake one... trim the size to a | ||
825 | * multiple of 2048 (1M): tell we have 32 sectors, 64 heads, | ||
826 | * whatever cylinders. | ||
827 | */ | ||
828 | geo.heads = 64; | ||
829 | geo.sectors = 32; | ||
830 | geo.start = get_start_sect(i->i_bdev); | ||
831 | geo.cylinders = size / (geo.heads * geo.sectors); | ||
832 | |||
833 | if (copy_to_user((void __user *) arg, &geo, sizeof(geo))) | ||
834 | return -EFAULT; | ||
835 | return 0; | ||
836 | } | ||
837 | 817 | ||
838 | return -EINVAL; | 818 | /* |
819 | * get geometry: we have to fake one... trim the size to a | ||
820 | * multiple of 2048 (1M): tell we have 32 sectors, 64 heads, | ||
821 | * whatever cylinders. | ||
822 | */ | ||
823 | geo->heads = 64; | ||
824 | geo->sectors = 32; | ||
825 | geo->cylinders = size / (geo->heads * geo->sectors); | ||
826 | return 0; | ||
839 | } | 827 | } |
828 | |||
840 | /* | 829 | /* |
841 | ----------------------------------------------------------------------------------- | 830 | ----------------------------------------------------------------------------------- |
842 | -- mm_check_change | 831 | -- mm_check_change |
@@ -855,7 +844,7 @@ static int mm_check_change(struct gendisk *disk) | |||
855 | */ | 844 | */ |
856 | static struct block_device_operations mm_fops = { | 845 | static struct block_device_operations mm_fops = { |
857 | .owner = THIS_MODULE, | 846 | .owner = THIS_MODULE, |
858 | .ioctl = mm_ioctl, | 847 | .getgeo = mm_getgeo, |
859 | .revalidate_disk= mm_revalidate, | 848 | .revalidate_disk= mm_revalidate, |
860 | .media_changed = mm_check_change, | 849 | .media_changed = mm_check_change, |
861 | }; | 850 | }; |