Commit e71c9413 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] kill HDIO_GETGEO_BIG_RAW ioctl

HDIO_GETGEO_BIG_RAW is an ide specific hack introduced in 2.3.99-pre3.
There are no known programs using this ioctl.

Its aim was to provide current CHS translation to the user-space,
but very often it provides what driver thinks is a current translation
(drive with LBA have to support only one physical translation, also
 drive may not support chosen translation and there is no return value check).

hdparm -I can be used instead, it provides correct information
(and bogus data is still accessible through /proc/ide/hdX/geometry).
parent 5ae1a1f8
......@@ -28,34 +28,6 @@
#define CODE
#include "compat_ioctl.c"
struct hd_big_geometry32 {
unsigned char heads;
unsigned char sectors;
unsigned int cylinders;
u32 start;
};
static int hdio_getgeo_big(unsigned int fd, unsigned int cmd, unsigned long arg)
{
mm_segment_t old_fs = get_fs();
struct hd_big_geometry geo;
int err;
set_fs (KERNEL_DS);
err = sys_ioctl(fd, cmd, (unsigned long)&geo);
set_fs (old_fs);
if (!err) {
struct hd_big_geometry32 *up = (struct hd_big_geometry32 *) arg;
if (put_user(geo.heads, &up->heads) ||
__put_user(geo.sectors, &up->sectors) ||
__put_user(geo.cylinders, &up->cylinders) ||
__put_user(((u32) geo.start), &up->start))
err = -EFAULT;
}
return err;
}
struct ncp_ioctl_request_32 {
unsigned int function;
unsigned int size;
......@@ -773,7 +745,6 @@ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
/* And these ioctls need translation */
HANDLE_IOCTL(HDIO_GETGEO_BIG_RAW, hdio_getgeo_big)
/* NCPFS */
HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
......
......@@ -40,34 +40,6 @@ static __inline__ void *alloc_user_space(long len)
#define CODE
#include "compat_ioctl.c"
struct hd_big_geometry32 {
unsigned char heads;
unsigned char sectors;
unsigned int cylinders;
u32 start;
};
static int hdio_getgeo_big(unsigned int fd, unsigned int cmd, unsigned long arg)
{
mm_segment_t old_fs = get_fs();
struct hd_big_geometry geo;
int err;
set_fs (KERNEL_DS);
err = sys_ioctl(fd, cmd, (unsigned long)&geo);
set_fs (old_fs);
if (!err) {
struct hd_big_geometry32 *up = (struct hd_big_geometry32 *) arg;
if (put_user(geo.heads, &up->heads) ||
__put_user(geo.sectors, &up->sectors) ||
__put_user(geo.cylinders, &up->cylinders) ||
__put_user(((u32) geo.start), &up->start))
err = -EFAULT;
}
return err;
}
struct fbcmap32 {
int index; /* first element (0 origin) */
int count;
......@@ -1574,7 +1546,6 @@ COMPATIBLE_IOCTL(DM_TARGET_STATUS)
COMPATIBLE_IOCTL(DM_TARGET_WAIT)
#endif
/* And these ioctls need translation */
HANDLE_IOCTL(HDIO_GETGEO_BIG_RAW, hdio_getgeo_big)
/* NCPFS */
HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2)
......
......@@ -1619,18 +1619,6 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
return 0;
}
case HDIO_GETGEO_BIG_RAW:
{
struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL;
if (put_user(drive->head, (u8 *) &loc->heads)) return -EFAULT;
if (put_user(drive->sect, (u8 *) &loc->sectors)) return -EFAULT;
if (put_user(drive->cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)get_start_sect(bdev),
(unsigned long *) &loc->start)) return -EFAULT;
return 0;
}
case HDIO_OBSOLETE_IDENTITY:
case HDIO_GET_IDENTITY:
if (bdev != bdev->bd_contains)
......
......@@ -395,14 +395,6 @@ struct hd_geometry {
unsigned long start;
};
/* BIG GEOMETRY - dying, used only by HDIO_GETGEO_BIG_RAW */
struct hd_big_geometry {
unsigned char heads;
unsigned char sectors;
unsigned int cylinders;
unsigned long start;
};
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
#define HDIO_GETGEO 0x0301 /* get device geometry */
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
......@@ -456,7 +448,7 @@ enum {
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */
#define HDIO_SET_IDE_SCSI 0x0338
#define HDIO_SET_SCSI_IDE 0x0339
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment