diff options
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 73f9652b2ee9..3a93c6f772fa 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -117,6 +117,7 @@ static int ubd_open(struct inode * inode, struct file * filp); | |||
117 | static int ubd_release(struct inode * inode, struct file * file); | 117 | static int ubd_release(struct inode * inode, struct file * file); |
118 | static int ubd_ioctl(struct inode * inode, struct file * file, | 118 | static int ubd_ioctl(struct inode * inode, struct file * file, |
119 | unsigned int cmd, unsigned long arg); | 119 | unsigned int cmd, unsigned long arg); |
120 | static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo); | ||
120 | 121 | ||
121 | #define MAX_DEV (8) | 122 | #define MAX_DEV (8) |
122 | 123 | ||
@@ -125,6 +126,7 @@ static struct block_device_operations ubd_blops = { | |||
125 | .open = ubd_open, | 126 | .open = ubd_open, |
126 | .release = ubd_release, | 127 | .release = ubd_release, |
127 | .ioctl = ubd_ioctl, | 128 | .ioctl = ubd_ioctl, |
129 | .getgeo = ubd_getgeo, | ||
128 | }; | 130 | }; |
129 | 131 | ||
130 | /* Protected by the queue_lock */ | 132 | /* Protected by the queue_lock */ |
@@ -1058,6 +1060,16 @@ static void do_ubd_request(request_queue_t *q) | |||
1058 | } | 1060 | } |
1059 | } | 1061 | } |
1060 | 1062 | ||
1063 | static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
1064 | { | ||
1065 | struct ubd *dev = bdev->bd_disk->private_data; | ||
1066 | |||
1067 | geo->heads = 128; | ||
1068 | geo->sectors = 32; | ||
1069 | geo->cylinders = dev->size / (128 * 32 * 512); | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1061 | static int ubd_ioctl(struct inode * inode, struct file * file, | 1073 | static int ubd_ioctl(struct inode * inode, struct file * file, |
1062 | unsigned int cmd, unsigned long arg) | 1074 | unsigned int cmd, unsigned long arg) |
1063 | { | 1075 | { |
@@ -1070,16 +1082,7 @@ static int ubd_ioctl(struct inode * inode, struct file * file, | |||
1070 | }; | 1082 | }; |
1071 | 1083 | ||
1072 | switch (cmd) { | 1084 | switch (cmd) { |
1073 | struct hd_geometry g; | ||
1074 | struct cdrom_volctrl volume; | 1085 | struct cdrom_volctrl volume; |
1075 | case HDIO_GETGEO: | ||
1076 | if(!loc) return(-EINVAL); | ||
1077 | g.heads = 128; | ||
1078 | g.sectors = 32; | ||
1079 | g.cylinders = dev->size / (128 * 32 * 512); | ||
1080 | g.start = get_start_sect(inode->i_bdev); | ||
1081 | return(copy_to_user(loc, &g, sizeof(g)) ? -EFAULT : 0); | ||
1082 | |||
1083 | case HDIO_GET_IDENTITY: | 1086 | case HDIO_GET_IDENTITY: |
1084 | ubd_id.cyls = dev->size / (128 * 32 * 512); | 1087 | ubd_id.cyls = dev->size / (128 * 32 * 512); |
1085 | if(copy_to_user((char __user *) arg, (char *) &ubd_id, | 1088 | if(copy_to_user((char __user *) arg, (char *) &ubd_id, |