lkml.org 
[lkml]   [2000]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Of removable devices
In <Pine.LNX.3.95.1000216135327.361A-100000@chaos.analogic.com> Richard B. Johnson (root@chaos.analogic.com) wrote:
> On 16 Feb 2000, Henning P. Schmiedehausen wrote:

>> khim@sch57.msk.ru (Khimenko Victor) writes:
>>
>> [...]
>> > can cook up something (it was even done). It'll work sometimes. But
>> > it'll ruin floppies from time to time. MS DOS doing it, Windows
>> > doing it (there are no easy way to check if filesystem is clean and
>> > you can eject floppy safely -- I've ruined my floppies pretty often
>> > on old days when I've used them) but WHY THE HELL Linux should do
>> > this is well ?
>> [...]
>>
>> Users lived with this on the Amiga, Users lived with this on
>> Windows. Just add a notification callback which is called when the
>> kernel wants to sync the floppy, let your desktop add a handler which
>> pops a requester "Please insert floppy "foobla" (as far as I know,
>> there is a unique identifier for both ext2 and DOS) in Drive
>> "/dev/fd0".
>>
>> Worked on the Amiga for me. Why not also on Linux? If there is no
>> hander installed: Bad luck for the user. You asked for it.
>>


> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <sys/ioctl.h>
> #include <ioctls.h>
> #include <fcntl.h>
> #include <linux/fd.h>
> int main(int args, char *argv[]);

> int main(int args, char *argv[])
> {
> int fd;
> if(args < 2)
> {
> fprintf(stderr, "Usage:\n%s <device>\n", argv[0]);
> exit(EXIT_FAILURE);
> }
> if((fd = open(argv[1], O_RDWR)) < 0)
> {
> fprintf(stderr, "Can't open %s\n", argv[1]);
> exit(EXIT_FAILURE);
> }
> if(ioctl(fd, FDFLUSH, NULL) < 0)
> {
> fprintf(stderr, "Bad ioctl(FDFLUSH)\n");
> exit(EXIT_FAILURE);
> }
> (void)close(fd);
> return 0;
> }

> Now eject the floppy.

No. You misunderstood conception again. Idea is simple: user DO NOT NEED TO DO
ANYTHING before floppy removal. But when program tries to write on removed
floppy (even if there are other floppy inserted and even used) kernel will send
message to notification daemon with request to put old floppy back. Process is
stopped and all dirty buffers are kept in memory till floppy is changed back.
When "right" floppy is inserted dirty buffers will be put on said floppy and
process can continue. Without such protection ANY supermount implementations
are just invitations to disaster. And THAT will require lots of changes in VFS.

P.S. Of course if there are three or five processes actively working on with
files on three of five floppies then user's life will be tough but he's asked
for this...




-
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.172 / U:2.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site