diff options
Diffstat (limited to 'drivers/block/cpqarray.c')
-rw-r--r-- | drivers/block/cpqarray.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 9bddb6874873..9f0664dd3800 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -160,6 +160,7 @@ static int sendcmd( | |||
160 | static int ida_open(struct inode *inode, struct file *filep); | 160 | static int ida_open(struct inode *inode, struct file *filep); |
161 | static int ida_release(struct inode *inode, struct file *filep); | 161 | static int ida_release(struct inode *inode, struct file *filep); |
162 | static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg); | 162 | static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg); |
163 | static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo); | ||
163 | static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io); | 164 | static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io); |
164 | 165 | ||
165 | static void do_ida_request(request_queue_t *q); | 166 | static void do_ida_request(request_queue_t *q); |
@@ -199,6 +200,7 @@ static struct block_device_operations ida_fops = { | |||
199 | .open = ida_open, | 200 | .open = ida_open, |
200 | .release = ida_release, | 201 | .release = ida_release, |
201 | .ioctl = ida_ioctl, | 202 | .ioctl = ida_ioctl, |
203 | .getgeo = ida_getgeo, | ||
202 | .revalidate_disk= ida_revalidate, | 204 | .revalidate_disk= ida_revalidate, |
203 | }; | 205 | }; |
204 | 206 | ||
@@ -1124,6 +1126,23 @@ static void ida_timer(unsigned long tdata) | |||
1124 | h->misc_tflags = 0; | 1126 | h->misc_tflags = 0; |
1125 | } | 1127 | } |
1126 | 1128 | ||
1129 | static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
1130 | { | ||
1131 | drv_info_t *drv = get_drv(bdev->bd_disk); | ||
1132 | |||
1133 | if (drv->cylinders) { | ||
1134 | geo->heads = drv->heads; | ||
1135 | geo->sectors = drv->sectors; | ||
1136 | geo->cylinders = drv->cylinders; | ||
1137 | } else { | ||
1138 | geo->heads = 0xff; | ||
1139 | geo->sectors = 0x3f; | ||
1140 | geo->cylinders = drv->nr_blks / (0xff*0x3f); | ||
1141 | } | ||
1142 | |||
1143 | return 0; | ||
1144 | } | ||
1145 | |||
1127 | /* | 1146 | /* |
1128 | * ida_ioctl does some miscellaneous stuff like reporting drive geometry, | 1147 | * ida_ioctl does some miscellaneous stuff like reporting drive geometry, |
1129 | * setting readahead and submitting commands from userspace to the controller. | 1148 | * setting readahead and submitting commands from userspace to the controller. |
@@ -1133,27 +1152,10 @@ static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, | |||
1133 | drv_info_t *drv = get_drv(inode->i_bdev->bd_disk); | 1152 | drv_info_t *drv = get_drv(inode->i_bdev->bd_disk); |
1134 | ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); | 1153 | ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); |
1135 | int error; | 1154 | int error; |
1136 | int diskinfo[4]; | ||
1137 | struct hd_geometry __user *geo = (struct hd_geometry __user *)arg; | ||
1138 | ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg; | 1155 | ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg; |
1139 | ida_ioctl_t *my_io; | 1156 | ida_ioctl_t *my_io; |
1140 | 1157 | ||
1141 | switch(cmd) { | 1158 | switch(cmd) { |
1142 | case HDIO_GETGEO: | ||
1143 | if (drv->cylinders) { | ||
1144 | diskinfo[0] = drv->heads; | ||
1145 | diskinfo[1] = drv->sectors; | ||
1146 | diskinfo[2] = drv->cylinders; | ||
1147 | } else { | ||
1148 | diskinfo[0] = 0xff; | ||
1149 | diskinfo[1] = 0x3f; | ||
1150 | diskinfo[2] = drv->nr_blks / (0xff*0x3f); | ||
1151 | } | ||
1152 | put_user(diskinfo[0], &geo->heads); | ||
1153 | put_user(diskinfo[1], &geo->sectors); | ||
1154 | put_user(diskinfo[2], &geo->cylinders); | ||
1155 | put_user(get_start_sect(inode->i_bdev), &geo->start); | ||
1156 | return 0; | ||
1157 | case IDAGETDRVINFO: | 1159 | case IDAGETDRVINFO: |
1158 | if (copy_to_user(&io->c.drv, drv, sizeof(drv_info_t))) | 1160 | if (copy_to_user(&io->c.drv, drv, sizeof(drv_info_t))) |
1159 | return -EFAULT; | 1161 | return -EFAULT; |