Messages in this thread | | | Subject | Re: Of removable devices | From | Francis GALIEGUE <> | Date | 17 Feb 2000 12:13:54 +0100 |
| |
Jason L Tibbitts III <tibbs@math.uh.edu> writes:
> If only Linux had such a well-integrated system of alerting the > user that they needed to insert media. >
No, this is unacceptable. If a user removes a media in the process of writing, then it's his fault, and his program should get thrashed to give him a lesson.
I already attempted to make removable medium management in user space, but several problems appeared, which can only be solved in kernel space:
1. No device with removable media that I know of (CDROMs, IDE ZIPs and LS120, floppies) can notice the driver of a medium removal/insertion - you have to poll the drive for this. Thanks to Jens Axobe for removing the doubts I had for AIN.
2. (apart from floppies) you *can* send a command to drives so that they allow ejection when the uesr "presses the button", but you must ensure that all writes are finished. This cannot be done in user space. I already had the case where I allowed the medium to eject, then wrote a file on the medium, then pressed the eject button: the allow_eject command popped up in the middle of a write --> fs thrashed
3. detecting which processes use a device from user space is a nightmare, as this requires parsing /proc/*/fd, stat() each symlink and look at the st_rdev field. And even then, a process can write to the file when you had just scanned its /proc/PID/fd.
4. mounting a device doesn't prevent its use as a raw device.
In short, a big mess.
The only secure way of doing this would therefore be in kernel space, with the restriction that a device mounted with the hypothetical MS_SLOPPYMOUNT option can be used either as a filesystem or as a raw device, but not both at a time. But there is another problem: while on heavy I/O duties, "the LED reflex" can no longer be valid: it would be unreasonable to prioritiez the write on a braindead floppy drive while a 150MB file needs to be flushed to disk.
-- fg
# rm *;o o: command not found
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |