Skip to contentSkip to conversation

1/8 Backport recent 2.6 IDE updates to 2.4.x

PATCH In review Erik Andersen 2 participants 3 messages Aug 17, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 1/8 Backport recent 2.6 IDE updates to 2.4.x

This patch eliminates HDIO_GETGEO_BIG and HDIO_GETGEO_BIG_RAW, where are entirely unused and unnecessary. They were also removed from 2.6.x,

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

arch/ppc64/kernel/ioctl32.c +0 -24
@@ -856,28 +856,6 @@
 	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, HDIO_GETGEO_BIG, (unsigned long)&geo);
-	set_fs (old_fs);
-	if (err)
-		return err;
-	else {
-		struct hd_big_geometry32 *user_geo = (struct hd_big_geometry32 *)arg;
-		err = __put_user (geo.heads, &(user_geo->heads));
-		err |= __put_user (geo.sectors, &(user_geo->sectors));
-		err |= __put_user (geo.cylinders, &(user_geo->cylinders));
-		err |= __put_user (geo.start, &(user_geo->start));
-	}
-	return err ? -EFAULT : 0;
-}
-
-
 static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	mm_segment_t old_fs = get_fs();
@@ -4490,8 +4468,6 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval),
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp),
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo),
-HANDLE_IOCTL(HDIO_GETGEO_BIG, hdio_getgeo_big),
-HANDLE_IOCTL(HDIO_GETGEO_BIG_RAW, hdio_getgeo_big),
 HANDLE_IOCTL(BLKRAGET, w_long),
 HANDLE_IOCTL(BLKGETSIZE, w_long),
 HANDLE_IOCTL(0x1260, broken_blkgetsize),
arch/sparc64/kernel/ioctl32.c +0 -23
@@ -850,27 +850,6 @@
 	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;
@@ -5160,8 +5139,6 @@
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
-HANDLE_IOCTL(HDIO_GETGEO_BIG, hdio_getgeo_big)
-HANDLE_IOCTL(HDIO_GETGEO_BIG_RAW, hdio_getgeo_big)
 HANDLE_IOCTL(BLKRAGET, w_long)
 HANDLE_IOCTL(BLKGETSIZE, w_long)
 HANDLE_IOCTL(0x1260, broken_blkgetsize)
drivers/block/cciss.c +0 -20
@@ -489,26 +489,6 @@
 			return  -EFAULT;
 		return 0;
 	   }
-	case HDIO_GETGEO_BIG:
-	{
-		struct hd_big_geometry driver_geo;
-		if (hba[ctlr]->drv[dsk].cylinders) {
-			driver_geo.heads = hba[ctlr]->drv[dsk].heads;
-			driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
-			driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
-		} else {
-			driver_geo.heads = 0xff;
-			driver_geo.sectors = 0x3f;
-			driver_geo.cylinders = 
-				hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
-		}
-		driver_geo.start= 
-		hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
-		if (copy_to_user((void *) arg, &driver_geo,  
-				sizeof( struct hd_big_geometry)))
-			return  -EFAULT;
-		return 0;
-	}
 	case BLKRRPART:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
drivers/block/cpqarray.c +0 -21
@@ -1251,27 +1251,6 @@
 			return  -EFAULT;
 		return(0);
 	}
-	case HDIO_GETGEO_BIG:
-	{
-		struct hd_big_geometry driver_geo;
-
-		if (hba[ctlr]->drv[dsk].cylinders) {
-			driver_geo.heads = hba[ctlr]->drv[dsk].heads;
-			driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
-			driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
-		} else {
-			driver_geo.heads = 0xff;
-			driver_geo.sectors = 0x3f;
-			driver_geo.cylinders = hba[ctlr]->drv[dsk].nr_blks 
-				/ (0xff*0x3f);
-		}
-		driver_geo.start=
-			hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
-		if (copy_to_user((void *) arg, &driver_geo,
-				sizeof( struct hd_big_geometry)))
-			return  -EFAULT;
-		return(0);
-	}
 
 	case IDAGETDRVINFO:
 	{
drivers/ide/ide.c +0 -24
@@ -1573,30 +1573,6 @@
 			return 0;
 		}
 
-		case HDIO_GETGEO_BIG:
-		{
-			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->bios_head, (u8 *) &loc->heads)) return -EFAULT;
-			if (put_user(drive->bios_sect, (u8 *) &loc->sectors)) return -EFAULT;
-			if (put_user(drive->bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
-			if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect,
-				(unsigned long *) &loc->start)) return -EFAULT;
-			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)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect,
-				(unsigned long *) &loc->start)) return -EFAULT;
-			return 0;
-		}
-
 	 	case BLKGETSIZE:   /* Return device size */
 			return put_user(drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects, (unsigned long *) arg);
 	 	case BLKGETSIZE64:
drivers/ide/raid/hptraid.c +0 -16
@@ -199,22 +199,6 @@
 			return 0;
 		}
 
-		case HDIO_GETGEO_BIG:
-		{
-			struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
-			unsigned int bios_cyl;
-			if (!loc) return -EINVAL;
-			val = 255;
-			if (put_user(val, (byte *) &loc->heads)) return -EFAULT;
-			val = 63;
-			if (put_user(val, (byte *) &loc->sectors)) return -EFAULT;
-			bios_cyl = raid[minor].sectors/63/255;
-			if (put_user(bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
-			if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
-				(unsigned long *) &loc->start)) return -EFAULT;
-			return 0;
-		}
-			
 		default:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 	};
drivers/ide/raid/pdcraid.c +0 -12
@@ -132,18 +132,6 @@
 			return 0;
 		}
 
-		case HDIO_GETGEO_BIG:
-		{
-			struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
-			if (!loc) return -EINVAL;
-			if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
-			if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
-			if (put_user(raid[minor].geom.cylinders, (unsigned int *) &loc->cylinders)) return -EFAULT;
-			if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
-				(unsigned long *) &loc->start)) return -EFAULT;
-			return 0;
-		}
-
 		default:
 			return blk_ioctl(inode->i_rdev, cmd, arg);
 	};
drivers/ide/raid/silraid.c +0 -13
@@ -130,19 +130,6 @@
 			return 0;
 		}
 
-		case HDIO_GETGEO_BIG:
-		{
-			struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
-			if (!loc) return -EINVAL;
-			if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
-			if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
-			if (put_user(raid[minor].geom.cylinders, (unsigned int *) &loc->cylinders)) return -EFAULT;
-			if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,
-				(unsigned long *) &loc->start)) return -EFAULT;
-			return 0;
-		}
-
-			
 		case BLKROSET:
 		case BLKROGET:
 		case BLKSSZGET:
drivers/md/lvm.c +8 -42

79 lines not on this page · raw message

drivers/scsi/sd.c +0 -33
@@ -205,39 +205,6 @@
 				return -EFAULT;
 			return 0;
 		}
-		case HDIO_GETGEO_BIG:
-		{
-			struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;
-
-			if(!loc)
-				return -EINVAL;
-
-			host = rscsi_disks[DEVICE_NR(dev)].device->host;
-
-			/* default to most commonly used values */
-
-			diskinfo[0] = 0x40;
-			diskinfo[1] = 0x20;
-			diskinfo[2] = rscsi_disks[DEVICE_NR(dev)].capacity >> 11;
-
-			/* override with calculated, extended default, or driver values */
-
-			if(host->hostt->bios_param != NULL)
-				host->hostt->bios_param(&rscsi_disks[DEVICE_NR(dev)],
-					    dev,
-					    &diskinfo[0]);
-			else scsicam_bios_param(&rscsi_disks[DEVICE_NR(dev)],
-					dev, &diskinfo[0]);
-
-			if (put_user(diskinfo[0], &loc->heads) ||
-				put_user(diskinfo[1], &loc->sectors) ||
-				put_user(diskinfo[2], (unsigned int *) &loc->cylinders) ||
-				put_user(sd_gendisks[SD_MAJOR_IDX(
-				    inode->i_rdev)].part[MINOR(
-				    inode->i_rdev)].start_sect, &loc->start))
-				return -EFAULT;
-			return 0;
-		}
 		case BLKGETSIZE:
 		case BLKGETSIZE64:
 		case BLKROSET:
include/linux/hdreg.h +3 -11
@@ -361,7 +361,7 @@
 #define SETFEATURES_DIS_MSN	0x31	/* Disable Media Status Notification */
 #define SETFEATURES_DIS_RETRY	0x33	/* Disable Retry */
 #define SETFEATURES_EN_AAM	0x42	/* Enable Automatic Acoustic Management */
-#define SETFEATURES_RW_LONG	0x44	/* Set Lenght of VS bytes */
+#define SETFEATURES_RW_LONG	0x44	/* Set Length of VS bytes */
 #define SETFEATURES_SET_CACHE	0x54	/* Set Cache segments to SC Reg. Val */
 #define SETFEATURES_DIS_RLA	0x55	/* Disable read look-ahead feature */
 #define SETFEATURES_EN_RI	0x5D	/* Enable release interrupt */
@@ -401,14 +401,6 @@
       unsigned long start;
 };
 
-/* BIG GEOMETRY */
-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 */
@@ -462,8 +454,8 @@
 };
 
 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
-#define HDIO_GETGEO_BIG		0x0330	/* */
-#define HDIO_GETGEO_BIG_RAW	0x0331	/* */
+/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
+/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */
 
 #define HDIO_SET_IDE_SCSI	0x0338
 #define HDIO_SET_SCSI_IDE	0x0339
#1 lore raw
Quoted 3 lines · Erik Andersen

This patch eliminates HDIO_GETGEO_BIG and HDIO_GETGEO_BIG_RAW, where are entirely unused and unnecessary. They were also removed from 2.6.x,

Rejected by 2.4 IDE maintainer. Removing API's (even dumb ones) during a stable release is not good practice.

#2 lore raw
Quoted 7 lines · Alan Cox
Quoted 3 lines · Erik Andersen

This patch eliminates HDIO_GETGEO_BIG and HDIO_GETGEO_BIG_RAW, where are entirely unused and unnecessary. They were also removed from 2.6.x,

Rejected by 2.4 IDE maintainer. Removing API's (even dumb ones) during a stable release is not good practice.

No worries. The other patches do not depend on this one and I suspected this one might get struck down. I just carried it along to try and keep the 2.4 and 2.6 drivers consistant,

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--