devfs
[Top] [All Lists]

Re: Removeable Media, partitions and devfs?

To: "Kevin P. Fleming" <kevin@xxxxxxxxxxxxx>
Subject: Re: Removeable Media, partitions and devfs?
From: Richard Gooch <rgooch@xxxxxxxxxxxxxxx>
Date: Tue, 4 Dec 2001 23:39:00 -0700
Cc: "Paul Bristow" <paul@xxxxxxxxxxxxxxx>, Andrej.Borsenkow@xxxxxxxxxxxxxx, mfedyk@xxxxxxxxxxxxx, devfs@xxxxxxxxxxx
In-reply-to: <03be01c17d20$5d1b72f0$c8aaa8c0@kevin>
References: <3C0C9AC5.4080504@paulbristow.net> <001801c17d15$758b6760$c8aaa8c0@kevin> <3C0D588F.9000806@paulbristow.net> <03be01c17d20$5d1b72f0$c8aaa8c0@kevin>
Sender: owner-devfs@xxxxxxxxxxx
  Hi, all. While I'm not finished with devfs core hacking, I thought
I'd set aside some time on this issue, as people seem to be tearing
their hair out :-) So here are some thoughts.

What I don't want to see:
- ide-floppy hacked up to explicitely create devfs entries. As far as
  I'm concerned, that driver is correct

- creation of compatibilty symlinks in kernel-space

- structural changes to devfs code in fs/partitions/check.c

- a patch that's more than 20 lines long.

The solution, as I see it, is to force grok_partitions() to call
devfs_register_disc() when size==0 and the GENHD_FL_REMOVABLE flag is
set. This will cause the "disc" entry in the
/dev/ide/host*/bus*/lun*/target* directory to be created, and it will
tag that directory for media revalidation.

If you read that directory, or attempt a lookup of some leaf node, the
media will be revalidated. If there's new media in the drive, the
normal partition handling code should be invoked, and thus the
appropriate leaf nodes will be created. Take the media out, and the
next readdir or lookup will remove partition entries (assuming the
ide-floppy driver doesn't set the size back to 0). Magic. Just the way
god^H^H^HI intended.

So, I've appended a patch which does this. Please try it out and let
me know what you think. And hey! The patch is a mere 11 lines long.

                                Regards,

                                        Richard....
Permanent: rgooch@xxxxxxxxxxxxx
Current:   rgooch@xxxxxxxxxxxxxxx

--- check.c~    Thu Oct 11 18:25:10 2001
+++ check.c     Tue Dec  4 23:36:06 2001
@@ -383,6 +383,8 @@
 
        dev->part[first_minor].nr_sects = size;
        /* No such device or no minors to use for partitions */
+       if (!size && (dev->flags[drive] & GENHD_FL_REMOVABLE))
+               devfs_register_disc (dev, minor);
        if (!size || minors == 1)
                return;
 

<Prev in Thread] Current Thread [Next in Thread>