diff options
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index a5b857c5c4b8..b86613b21cf1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3445,6 +3445,23 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g) | |||
3445 | return 0; | 3445 | return 0; |
3446 | } | 3446 | } |
3447 | 3447 | ||
3448 | static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
3449 | { | ||
3450 | int drive = (long)bdev->bd_disk->private_data; | ||
3451 | int type = ITYPE(drive_state[drive].fd_device); | ||
3452 | struct floppy_struct *g; | ||
3453 | int ret; | ||
3454 | |||
3455 | ret = get_floppy_geometry(drive, type, &g); | ||
3456 | if (ret) | ||
3457 | return ret; | ||
3458 | |||
3459 | geo->heads = g->head; | ||
3460 | geo->sectors = g->sect; | ||
3461 | geo->cylinders = g->track; | ||
3462 | return 0; | ||
3463 | } | ||
3464 | |||
3448 | static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 3465 | static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, |
3449 | unsigned long param) | 3466 | unsigned long param) |
3450 | { | 3467 | { |
@@ -3474,23 +3491,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
3474 | cmd = FDEJECT; | 3491 | cmd = FDEJECT; |
3475 | } | 3492 | } |
3476 | 3493 | ||
3477 | /* generic block device ioctls */ | ||
3478 | switch (cmd) { | ||
3479 | /* the following have been inspired by the corresponding | ||
3480 | * code for other block devices. */ | ||
3481 | struct floppy_struct *g; | ||
3482 | case HDIO_GETGEO: | ||
3483 | { | ||
3484 | struct hd_geometry loc; | ||
3485 | ECALL(get_floppy_geometry(drive, type, &g)); | ||
3486 | loc.heads = g->head; | ||
3487 | loc.sectors = g->sect; | ||
3488 | loc.cylinders = g->track; | ||
3489 | loc.start = 0; | ||
3490 | return _COPYOUT(loc); | ||
3491 | } | ||
3492 | } | ||
3493 | |||
3494 | /* convert the old style command into a new style command */ | 3494 | /* convert the old style command into a new style command */ |
3495 | if ((cmd & 0xff00) == 0x0200) { | 3495 | if ((cmd & 0xff00) == 0x0200) { |
3496 | ECALL(normalize_ioctl(&cmd, &size)); | 3496 | ECALL(normalize_ioctl(&cmd, &size)); |
@@ -3938,6 +3938,7 @@ static struct block_device_operations floppy_fops = { | |||
3938 | .open = floppy_open, | 3938 | .open = floppy_open, |
3939 | .release = floppy_release, | 3939 | .release = floppy_release, |
3940 | .ioctl = fd_ioctl, | 3940 | .ioctl = fd_ioctl, |
3941 | .getgeo = fd_getgeo, | ||
3941 | .media_changed = check_floppy_change, | 3942 | .media_changed = check_floppy_change, |
3942 | .revalidate_disk = floppy_revalidate, | 3943 | .revalidate_disk = floppy_revalidate, |
3943 | }; | 3944 | }; |