diff options
Diffstat (limited to 'drivers/block/DAC960.c')
-rw-r--r-- | drivers/block/DAC960.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 21097a39a057..179c68a3cef3 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -92,34 +92,28 @@ static int DAC960_open(struct inode *inode, struct file *file) | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int DAC960_ioctl(struct inode *inode, struct file *file, | 95 | static int DAC960_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
96 | unsigned int cmd, unsigned long arg) | ||
97 | { | 96 | { |
98 | struct gendisk *disk = inode->i_bdev->bd_disk; | 97 | struct gendisk *disk = bdev->bd_disk; |
99 | DAC960_Controller_T *p = disk->queue->queuedata; | 98 | DAC960_Controller_T *p = disk->queue->queuedata; |
100 | int drive_nr = (long)disk->private_data; | 99 | int drive_nr = (long)disk->private_data; |
101 | struct hd_geometry g; | ||
102 | struct hd_geometry __user *loc = (struct hd_geometry __user *)arg; | ||
103 | |||
104 | if (cmd != HDIO_GETGEO || !loc) | ||
105 | return -EINVAL; | ||
106 | 100 | ||
107 | if (p->FirmwareType == DAC960_V1_Controller) { | 101 | if (p->FirmwareType == DAC960_V1_Controller) { |
108 | g.heads = p->V1.GeometryTranslationHeads; | 102 | geo->heads = p->V1.GeometryTranslationHeads; |
109 | g.sectors = p->V1.GeometryTranslationSectors; | 103 | geo->sectors = p->V1.GeometryTranslationSectors; |
110 | g.cylinders = p->V1.LogicalDriveInformation[drive_nr]. | 104 | geo->cylinders = p->V1.LogicalDriveInformation[drive_nr]. |
111 | LogicalDriveSize / (g.heads * g.sectors); | 105 | LogicalDriveSize / (geo->heads * geo->sectors); |
112 | } else { | 106 | } else { |
113 | DAC960_V2_LogicalDeviceInfo_T *i = | 107 | DAC960_V2_LogicalDeviceInfo_T *i = |
114 | p->V2.LogicalDeviceInformation[drive_nr]; | 108 | p->V2.LogicalDeviceInformation[drive_nr]; |
115 | switch (i->DriveGeometry) { | 109 | switch (i->DriveGeometry) { |
116 | case DAC960_V2_Geometry_128_32: | 110 | case DAC960_V2_Geometry_128_32: |
117 | g.heads = 128; | 111 | geo->heads = 128; |
118 | g.sectors = 32; | 112 | geo->sectors = 32; |
119 | break; | 113 | break; |
120 | case DAC960_V2_Geometry_255_63: | 114 | case DAC960_V2_Geometry_255_63: |
121 | g.heads = 255; | 115 | geo->heads = 255; |
122 | g.sectors = 63; | 116 | geo->sectors = 63; |
123 | break; | 117 | break; |
124 | default: | 118 | default: |
125 | DAC960_Error("Illegal Logical Device Geometry %d\n", | 119 | DAC960_Error("Illegal Logical Device Geometry %d\n", |
@@ -127,12 +121,11 @@ static int DAC960_ioctl(struct inode *inode, struct file *file, | |||
127 | return -EINVAL; | 121 | return -EINVAL; |
128 | } | 122 | } |
129 | 123 | ||
130 | g.cylinders = i->ConfigurableDeviceSize / (g.heads * g.sectors); | 124 | geo->cylinders = i->ConfigurableDeviceSize / |
125 | (geo->heads * geo->sectors); | ||
131 | } | 126 | } |
132 | 127 | ||
133 | g.start = get_start_sect(inode->i_bdev); | 128 | return 0; |
134 | |||
135 | return copy_to_user(loc, &g, sizeof g) ? -EFAULT : 0; | ||
136 | } | 129 | } |
137 | 130 | ||
138 | static int DAC960_media_changed(struct gendisk *disk) | 131 | static int DAC960_media_changed(struct gendisk *disk) |
@@ -157,7 +150,7 @@ static int DAC960_revalidate_disk(struct gendisk *disk) | |||
157 | static struct block_device_operations DAC960_BlockDeviceOperations = { | 150 | static struct block_device_operations DAC960_BlockDeviceOperations = { |
158 | .owner = THIS_MODULE, | 151 | .owner = THIS_MODULE, |
159 | .open = DAC960_open, | 152 | .open = DAC960_open, |
160 | .ioctl = DAC960_ioctl, | 153 | .getgeo = DAC960_getgeo, |
161 | .media_changed = DAC960_media_changed, | 154 | .media_changed = DAC960_media_changed, |
162 | .revalidate_disk = DAC960_revalidate_disk, | 155 | .revalidate_disk = DAC960_revalidate_disk, |
163 | }; | 156 | }; |