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
vandrove@vc.cvut.cz
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide-floppy.c linux-2.5.33-c615/drivers/ide/ide-floppy.c
--- linux-2.5.33-c615.dist/drivers/ide/ide-floppy.c 2002-09-05 14:40:47.000000000 +0200
+++ linux-2.5.33-c615/drivers/ide/ide-floppy.c 2002-09-05 20:06:24.000000000 +0200
@@ -1817,7 +1817,7 @@
return (idefloppy_get_format_progress(drive, inode, file,
(int *)arg));
}
- return -EIO;
+ return -EINVAL;
}
/*
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide-tape.c linux-2.5.33-c615/drivers/ide/ide-tape.c
--- linux-2.5.33-c615.dist/drivers/ide/ide-tape.c 2002-09-05 14:40:43.000000000 +0200
+++ linux-2.5.33-c615/drivers/ide/ide-tape.c 2002-09-05 20:06:11.000000000 +0200
@@ -4365,7 +4365,7 @@
return -EFAULT;
break;
default:
- return -EIO;
+ return -EINVAL;
}
return 0;
}
diff -urN linux-2.5.33-c615.dist/drivers/ide/ide.c linux-2.5.33-c615/drivers/ide/ide.c
--- linux-2.5.33-c615.dist/drivers/ide/ide.c 2002-09-05 14:40:42.000000000 +0200
+++ linux-2.5.33-c615/drivers/ide/ide.c 2002-09-05 19:58:15.000000000 +0200
@@ -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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:26 EST