Skip to contentSkip to conversation

IDE cleanup (1.612) broke all fdisks I have...

PATCH In review Petr Vandrovec 3 participants 3 messages Sep 5, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE cleanup (1.612) broke all fdisks I have...

Hi Al,
it is nice that blkdev_ioctl calls blk_ioctl itself, but unfortunately
it does that only if driver's ioctl returns -EINVAL - and IDE returns -EIO :-(

Patch below is tested for disks - I do not have IDE floppy nor IDE tape.

I have couple of additional questions:
(1) should not we use -ENOTTY for unimplemented ioctl, like other subsystems do?
(2) IDE returns -EIO also for default_open. -ENXIO/-ENODEV?
(3) if drive->driver == NULL, ioctl returns -EPERM. I believe that this check is not needed because of ide_open checks for drive->driver != NULL. And if we can invoke ide's ioctl without previous open, should not we return -ENODEV?
Thanks,
Petr Vandrovec [email protected]

drivers/ide/ide-floppy.c +1 -1
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide-floppy.c linux-2.5.33-c615/drivers/ide/ide-floppy.c
@@ -1817,7 +1817,7 @@
 		return (idefloppy_get_format_progress(drive, inode, file,
 						      (int *)arg));
 	}
- 	return -EIO;
+ 	return -EINVAL;
 }
 
 /*
drivers/ide/ide-tape.c +1 -1
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide-tape.c linux-2.5.33-c615/drivers/ide/ide-tape.c
@@ -4365,7 +4365,7 @@
 				return -EFAULT;
 			break;
 		default:
-			return -EIO;
+			return -EINVAL;
 	}
 	return 0;
 }
drivers/ide/ide.c +1 -1
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide.c linux-2.5.33-c615/drivers/ide/ide.c
@@ -3347,7 +3347,7 @@
 static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
 			  unsigned int cmd, unsigned long arg)
 {
-	return -EIO;
+	return -EINVAL;
 }
 
 static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
#1 lore raw

Petr,

I know you are active in 2.5, and I would like to tap your resouces and ideas. Would it be possible to put things behind and move forward, as Halloween is near? TIA!

Cheers,

Andre

#2 lore raw
In reply to Petr Vandrovec
Quoted 5 lines · Petr Vandrovec

Hi Al,
it is nice that blkdev_ioctl calls blk_ioctl itself, but unfortunately
it does that only if driver's ioctl returns -EINVAL - and IDE returns -EIO :-(

Patch below is tested for disks - I do not have IDE floppy nor IDE tape.

For ide-disk.c, ide-floppy.c and ide-cd.c patch is OK. For ide-tape.c... Not needed.

Keep in mind that current setup (some ioctls are unconditionally done in fs/block_dev.c, for some we only call driver, for some - give driver a chance and do our thing if it doesn't recongnize the ioctl) will change. Most of the 3rd group actually belong to the 1st one - the only reason why they are not there is handling of unpartitioned devices that don't have gendisks. When that gets fixed, the kludge with calling driver and handling -EINVAL will disappear...